mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 09:49:14 +00:00
Merge m-c to fx-team. a=merge
This commit is contained in:
commit
6214e9fde8
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4e3e21a4ba3f188b45623ee2297f21d0791f8667"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="302a448729ff2b336581cf94b66327ea836294c7"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4e3e21a4ba3f188b45623ee2297f21d0791f8667"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="302a448729ff2b336581cf94b66327ea836294c7"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4e3e21a4ba3f188b45623ee2297f21d0791f8667"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="302a448729ff2b336581cf94b66327ea836294c7"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="8bc59310552179f9a8bc6cdd0188e2475df52fb7"/>
|
||||
|
@ -12,12 +12,12 @@
|
||||
<!--original fetch url was https://git.mozilla.org/releases-->
|
||||
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
|
||||
<!-- B2G specific things. -->
|
||||
<project name="platform_build" path="build" remote="b2g" revision="4efd19d199ae52656604f794c5a77518400220fd">
|
||||
<project name="platform_build" path="build" remote="b2g" revision="660169a3d7e034a892359e39135e8c2785a6ad6f">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4e3e21a4ba3f188b45623ee2297f21d0791f8667"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="302a448729ff2b336581cf94b66327ea836294c7"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5bb657ada461be666c35f419dbe072ed2ce632fc"/>
|
||||
@ -30,6 +30,7 @@
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="b89fda71fcd0fa0cf969310e75be3ea33e048b44"/>
|
||||
<project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="2e7d5348f35575870b3c7e567a9a9f6d66f8d6c5"/>
|
||||
<project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" revision="1342fd7b4b000ac3e76a5dfe111a0de9d710b4c8"/>
|
||||
<project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9" revision="a70724fae4d4c571e5657340f80a0c130d5283ec"/>
|
||||
<project groups="linux,x86" name="platform/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" path="prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" revision="1b26ad444462ccbd97f6319565b4735f7bd779e5"/>
|
||||
<project name="device/common" path="device/common" revision="4e1a38704dcfadef60ed2da3cfeba02a56b069d2"/>
|
||||
<project name="device/sample" path="device/sample" revision="b045905b46c8b4ee630d0c2aee7db63eaec722d9"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4e3e21a4ba3f188b45623ee2297f21d0791f8667"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="302a448729ff2b336581cf94b66327ea836294c7"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="07c383a786f188904311a37f6062c2cb84c9b61d">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4e3e21a4ba3f188b45623ee2297f21d0791f8667"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="302a448729ff2b336581cf94b66327ea836294c7"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4e3e21a4ba3f188b45623ee2297f21d0791f8667"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="302a448729ff2b336581cf94b66327ea836294c7"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="8bc59310552179f9a8bc6cdd0188e2475df52fb7"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4e3e21a4ba3f188b45623ee2297f21d0791f8667"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="302a448729ff2b336581cf94b66327ea836294c7"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"git": {
|
||||
"git_revision": "4e3e21a4ba3f188b45623ee2297f21d0791f8667",
|
||||
"git_revision": "302a448729ff2b336581cf94b66327ea836294c7",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "995162ffe23e554b4de57f72e6341916e2844e92",
|
||||
"revision": "6b3d9ecc195e6fac9fd71a17b4a0d5d0fcac9093",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
@ -12,12 +12,12 @@
|
||||
<!--original fetch url was https://git.mozilla.org/releases-->
|
||||
<remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
|
||||
<!-- B2G specific things. -->
|
||||
<project name="platform_build" path="build" remote="b2g" revision="4efd19d199ae52656604f794c5a77518400220fd">
|
||||
<project name="platform_build" path="build" remote="b2g" revision="660169a3d7e034a892359e39135e8c2785a6ad6f">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4e3e21a4ba3f188b45623ee2297f21d0791f8667"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="302a448729ff2b336581cf94b66327ea836294c7"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5bb657ada461be666c35f419dbe072ed2ce632fc"/>
|
||||
@ -30,6 +30,7 @@
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="b89fda71fcd0fa0cf969310e75be3ea33e048b44"/>
|
||||
<project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-eabi-4.7" revision="2e7d5348f35575870b3c7e567a9a9f6d66f8d6c5"/>
|
||||
<project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7" revision="1342fd7b4b000ac3e76a5dfe111a0de9d710b4c8"/>
|
||||
<project groups="linux,arm" name="platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9" path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9" revision="a70724fae4d4c571e5657340f80a0c130d5283ec"/>
|
||||
<project groups="linux,x86" name="platform/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" path="prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7" revision="1b26ad444462ccbd97f6319565b4735f7bd779e5"/>
|
||||
<project name="device/common" path="device/common" revision="4e1a38704dcfadef60ed2da3cfeba02a56b069d2"/>
|
||||
<project name="device/sample" path="device/sample" revision="b045905b46c8b4ee630d0c2aee7db63eaec722d9"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="07c383a786f188904311a37f6062c2cb84c9b61d">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4e3e21a4ba3f188b45623ee2297f21d0791f8667"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="302a448729ff2b336581cf94b66327ea836294c7"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -19,862 +19,6 @@ BEGIN_BLUETOOTH_NAMESPACE
|
||||
nsresult
|
||||
Convert(nsresult aIn, BluetoothStatus& aOut);
|
||||
|
||||
//
|
||||
// Result handling
|
||||
//
|
||||
// The classes of type |BluetoothResultRunnable[0..3]| transfer
|
||||
// a result handler from the I/O thread to the main thread for
|
||||
// execution. Call the methods |Create| and |Dispatch| to create or
|
||||
// create-and-dispatch a result runnable.
|
||||
//
|
||||
// You need to specify the called method. The |Create| and |Dispatch|
|
||||
// methods of |BluetoothResultRunnable[1..3]| receive an extra argument
|
||||
// for initializing the result's arguments. During creation, the result
|
||||
// runnable calls the supplied class's call operator with the result's
|
||||
// argument. This is where initialization and conversion from backend-
|
||||
// specific types is performed.
|
||||
//
|
||||
|
||||
template <typename Obj, typename Res>
|
||||
class BluetoothResultRunnable0 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef BluetoothResultRunnable0<Obj, Res> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Obj* aObj, Res (Obj::*aMethod)(), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aObj, aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Obj* aObj, Res (Obj::*aMethod)(), const InitOp& aInitOp)
|
||||
{
|
||||
if (!aObj) {
|
||||
return; // silently return if no result runnable has been given
|
||||
}
|
||||
nsRefPtr<SelfType> runnable = Create(aObj, aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
BT_LOGR("BluetoothResultRunnable0::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_LOGR("NS_DispatchToMainThread failed: %X", unsigned(rv));
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
((*mObj).*mMethod)();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothResultRunnable0(Obj* aObj, Res (Obj::*aMethod)())
|
||||
: mObj(aObj)
|
||||
, mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mObj);
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult
|
||||
Init(const InitOp& aInitOp)
|
||||
{
|
||||
return aInitOp();
|
||||
}
|
||||
|
||||
nsRefPtr<Obj> mObj;
|
||||
void (Obj::*mMethod)();
|
||||
};
|
||||
|
||||
template <typename Obj, typename Res, typename Tin1, typename Arg1>
|
||||
class BluetoothResultRunnable1 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef BluetoothResultRunnable1<Obj, Res, Tin1, Arg1> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Obj* aObj, Res (Obj::*aMethod)(Arg1), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aObj, aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Obj* aObj, Res (Obj::*aMethod)(Arg1), const InitOp& aInitOp)
|
||||
{
|
||||
if (!aObj) {
|
||||
return; // silently return if no result runnable has been given
|
||||
}
|
||||
nsRefPtr<SelfType> runnable = Create(aObj, aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
BT_LOGR("BluetoothResultRunnable1::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_LOGR("NS_DispatchToMainThread failed: %X", unsigned(rv));
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
((*mObj).*mMethod)(mArg1);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothResultRunnable1(Obj* aObj, Res (Obj::*aMethod)(Arg1))
|
||||
: mObj(aObj)
|
||||
, mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mObj);
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult
|
||||
Init(const InitOp& aInitOp)
|
||||
{
|
||||
return aInitOp(mArg1);
|
||||
}
|
||||
|
||||
nsRefPtr<Obj> mObj;
|
||||
Res (Obj::*mMethod)(Arg1);
|
||||
Tin1 mArg1;
|
||||
};
|
||||
|
||||
template <typename Obj, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Arg1, typename Arg2, typename Arg3>
|
||||
class BluetoothResultRunnable3 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef BluetoothResultRunnable3<Obj, Res,
|
||||
Tin1, Tin2, Tin3,
|
||||
Arg1, Arg2, Arg3> SelfType;
|
||||
|
||||
template<typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Obj* aObj, Res (Obj::*aMethod)(Arg1, Arg2, Arg3),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aObj, aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
static void
|
||||
Dispatch(Obj* aObj, Res (Obj::*aMethod)(Arg1, Arg2, Arg3),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
if (!aObj) {
|
||||
return; // silently return if no result runnable has been given
|
||||
}
|
||||
nsRefPtr<SelfType> runnable = Create(aObj, aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
BT_LOGR("BluetoothResultRunnable3::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
((*mObj).*mMethod)(mArg1, mArg2, mArg3);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothResultRunnable3(Obj* aObj, Res (Obj::*aMethod)(Arg1, Arg2, Arg3))
|
||||
: mObj(aObj)
|
||||
, mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mObj);
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult
|
||||
Init(const InitOp& aInitOp)
|
||||
{
|
||||
return aInitOp(mArg1, mArg2, mArg3);
|
||||
}
|
||||
|
||||
nsRefPtr<Obj> mObj;
|
||||
Res (Obj::*mMethod)(Arg1, Arg2, Arg3);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
};
|
||||
|
||||
//
|
||||
// Notification handling
|
||||
//
|
||||
// The classes of type |BluetoothNotificationRunnable[0..5]| transfer
|
||||
// a notification from the I/O thread to a notification handler on the
|
||||
// main thread. Call the methods |Create| and |Dispatch| to create or
|
||||
// create-and-dispatch a notification runnable.
|
||||
//
|
||||
// Like with result runnables, you need to specify the called method.
|
||||
// And like with result runnables, the |Create| and |Dispatch| methods
|
||||
// of |BluetoothNotificationRunnable[1..5]| receive an extra argument
|
||||
// for initializing the notification's arguments. During creation, the
|
||||
// notification runnable calls the class's call operator with the
|
||||
// notification's argument. This is where initialization and conversion
|
||||
// from backend-specific types is performed.
|
||||
//
|
||||
|
||||
template <typename ObjectWrapper, typename Res>
|
||||
class BluetoothNotificationRunnable0 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef BluetoothNotificationRunnable0<ObjectWrapper, Res> SelfType;
|
||||
|
||||
template<typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Res (ObjectType::*aMethod)(), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
BT_WARNING("BluetoothNotificationRunnable0::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
BT_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothNotificationRunnable0(Res (ObjectType::*aMethod)())
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult
|
||||
Init(const InitOp& aInitOp)
|
||||
{
|
||||
return aInitOp();
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)();
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Arg1=Tin1>
|
||||
class BluetoothNotificationRunnable1 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef BluetoothNotificationRunnable1<ObjectWrapper, Res,
|
||||
Tin1, Arg1> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Res (ObjectType::*aMethod)(Arg1), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
|
||||
if (!runnable) {
|
||||
BT_WARNING("BluetoothNotificationRunnable1::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
BT_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothNotificationRunnable1(Res (ObjectType::*aMethod)(Arg1))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult
|
||||
Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1);
|
||||
Tin1 mArg1;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2>
|
||||
class BluetoothNotificationRunnable2 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef BluetoothNotificationRunnable2<ObjectWrapper, Res,
|
||||
Tin1, Tin2,
|
||||
Arg1, Arg2> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Res (ObjectType::*aMethod)(Arg1, Arg2), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1, Arg2), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
BT_WARNING("BluetoothNotificationRunnable2::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
BT_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothNotificationRunnable2(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult
|
||||
Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1, mArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1, Arg2);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2, typename Arg3=Tin3>
|
||||
class BluetoothNotificationRunnable3 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef BluetoothNotificationRunnable3<ObjectWrapper, Res,
|
||||
Tin1, Tin2, Tin3,
|
||||
Arg1, Arg2, Arg3> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
BT_WARNING("BluetoothNotificationRunnable3::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
BT_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2, mArg3);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothNotificationRunnable3(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult
|
||||
Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1, mArg2, mArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1, Arg2, Arg3);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3, typename Tin4,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2,
|
||||
typename Arg3=Tin3, typename Arg4=Tin4>
|
||||
class BluetoothNotificationRunnable4 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef BluetoothNotificationRunnable4<ObjectWrapper, Res,
|
||||
Tin1, Tin2, Tin3, Tin4, Arg1, Arg2, Arg3, Arg4> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType> Create(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
BT_WARNING("BluetoothNotificationRunnable4::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
BT_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2, mArg3, mArg4);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothNotificationRunnable4(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult
|
||||
Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1, mArg2, mArg3, mArg4);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1, Arg2, Arg3, Arg4);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
Tin4 mArg4;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Tin4, typename Tin5,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2, typename Arg3=Tin3,
|
||||
typename Arg4=Tin4, typename Arg5=Tin5>
|
||||
class BluetoothNotificationRunnable5 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef BluetoothNotificationRunnable5<ObjectWrapper, Res,
|
||||
Tin1, Tin2, Tin3, Tin4, Tin5, Arg1, Arg2, Arg3, Arg4, Arg5> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType> Create(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
BT_WARNING("BluetoothNotificationRunnable5::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
BT_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2, mArg3, mArg4, mArg5);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothNotificationRunnable5(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult
|
||||
Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1, mArg2, mArg3, mArg4, mArg5);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1, Arg2, Arg3, Arg4, Arg5);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
Tin4 mArg4;
|
||||
Tin5 mArg5;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Tin4, typename Tin5, typename Tin6,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2, typename Arg3=Tin3,
|
||||
typename Arg4=Tin4, typename Arg5=Tin5, typename Arg6=Tin6>
|
||||
class BluetoothNotificationRunnable6 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef BluetoothNotificationRunnable6<ObjectWrapper, Res,
|
||||
Tin1, Tin2, Tin3, Tin4, Tin5, Tin6, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>
|
||||
SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType> Create(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
BT_WARNING("BluetoothNotificationRunnable6::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
BT_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2, mArg3, mArg4, mArg5, mArg6);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothNotificationRunnable6(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult
|
||||
Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1, mArg2, mArg3, mArg4, mArg5, mArg6);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
Tin4 mArg4;
|
||||
Tin5 mArg5;
|
||||
Tin6 mArg6;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Tin4, typename Tin5, typename Tin6,
|
||||
typename Tin7, typename Tin8, typename Tin9,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2, typename Arg3=Tin3,
|
||||
typename Arg4=Tin4, typename Arg5=Tin5, typename Arg6=Tin6,
|
||||
typename Arg7=Tin7, typename Arg8=Tin8, typename Arg9=Tin9>
|
||||
class BluetoothNotificationRunnable9 : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef BluetoothNotificationRunnable9<ObjectWrapper, Res,
|
||||
Tin1, Tin2, Tin3, Tin4, Tin5, Tin6, Tin7, Tin8, Tin9,
|
||||
Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType> Create(
|
||||
Res (ObjectType::*aMethod)(
|
||||
Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(
|
||||
Res (ObjectType::*aMethod)(
|
||||
Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
BT_WARNING("BluetoothNotificationRunnable8::Create failed");
|
||||
return;
|
||||
}
|
||||
nsresult rv = NS_DispatchToMainThread(runnable);
|
||||
if (NS_FAILED(rv)) {
|
||||
BT_WARNING("NS_DispatchToMainThread failed: %X", rv);
|
||||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
BT_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2, mArg3, mArg4,
|
||||
mArg5, mArg6, mArg7, mArg8, mArg9);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
BluetoothNotificationRunnable9(
|
||||
Res (ObjectType::*aMethod)(
|
||||
Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult
|
||||
Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1, mArg2, mArg3, mArg4,
|
||||
mArg5, mArg6, mArg7, mArg8, mArg9);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(
|
||||
Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
Tin4 mArg4;
|
||||
Tin5 mArg5;
|
||||
Tin6 mArg6;
|
||||
Tin7 mArg7;
|
||||
Tin8 mArg8;
|
||||
Tin9 mArg9;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Init operators
|
||||
//
|
||||
|
@ -481,8 +481,8 @@ void
|
||||
BluetoothDaemonA2dpInterface::DispatchError(
|
||||
BluetoothA2dpResultHandler* aRes, BluetoothStatus aStatus)
|
||||
{
|
||||
BluetoothResultRunnable1<BluetoothA2dpResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
DaemonResultRunnable1<BluetoothA2dpResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
aRes, &BluetoothA2dpResultHandler::OnError,
|
||||
ConstantInitOp1<BluetoothStatus>(aStatus));
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "BluetoothDaemonHelpers.h"
|
||||
#include "BluetoothInterface.h"
|
||||
#include "BluetoothInterfaceHelpers.h"
|
||||
#include "mozilla/ipc/DaemonRunnables.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
@ -62,11 +63,12 @@ protected:
|
||||
// Responses
|
||||
//
|
||||
|
||||
typedef BluetoothResultRunnable0<BluetoothA2dpResultHandler, void>
|
||||
typedef mozilla::ipc::DaemonResultRunnable0<
|
||||
BluetoothA2dpResultHandler, void>
|
||||
ResultRunnable;
|
||||
|
||||
typedef BluetoothResultRunnable1<BluetoothA2dpResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>
|
||||
typedef mozilla::ipc::DaemonResultRunnable1<
|
||||
BluetoothA2dpResultHandler, void, BluetoothStatus, BluetoothStatus>
|
||||
ErrorRunnable;
|
||||
|
||||
void ErrorRsp(const DaemonSocketPDUHeader& aHeader,
|
||||
@ -91,23 +93,19 @@ protected:
|
||||
|
||||
class NotificationHandlerWrapper;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
BluetoothA2dpConnectionState,
|
||||
nsString,
|
||||
BluetoothA2dpConnectionState,
|
||||
const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, BluetoothA2dpConnectionState, nsString,
|
||||
BluetoothA2dpConnectionState, const nsAString&>
|
||||
ConnectionStateNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
BluetoothA2dpAudioState,
|
||||
nsString,
|
||||
BluetoothA2dpAudioState,
|
||||
const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, BluetoothA2dpAudioState, nsString,
|
||||
BluetoothA2dpAudioState, const nsAString&>
|
||||
AudioStateNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<NotificationHandlerWrapper, void,
|
||||
nsString, uint32_t, uint8_t,
|
||||
const nsAString&, uint32_t, uint8_t>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
NotificationHandlerWrapper, void, nsString, uint32_t, uint8_t,
|
||||
const nsAString&, uint32_t, uint8_t>
|
||||
AudioConfigNotification;
|
||||
|
||||
class ConnectionStateInitOp;
|
||||
|
@ -1090,8 +1090,8 @@ void
|
||||
BluetoothDaemonAvrcpInterface::DispatchError(
|
||||
BluetoothAvrcpResultHandler* aRes, BluetoothStatus aStatus)
|
||||
{
|
||||
BluetoothResultRunnable1<BluetoothAvrcpResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
DaemonResultRunnable1<BluetoothAvrcpResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
aRes, &BluetoothAvrcpResultHandler::OnError,
|
||||
ConstantInitOp1<BluetoothStatus>(aStatus));
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "BluetoothDaemonHelpers.h"
|
||||
#include "BluetoothInterface.h"
|
||||
#include "BluetoothInterfaceHelpers.h"
|
||||
#include "mozilla/ipc/DaemonRunnables.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
@ -126,11 +127,12 @@ protected:
|
||||
// Responses
|
||||
//
|
||||
|
||||
typedef BluetoothResultRunnable0<BluetoothAvrcpResultHandler, void>
|
||||
typedef mozilla::ipc::DaemonResultRunnable0<
|
||||
BluetoothAvrcpResultHandler, void>
|
||||
ResultRunnable;
|
||||
|
||||
typedef BluetoothResultRunnable1<BluetoothAvrcpResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>
|
||||
typedef mozilla::ipc::DaemonResultRunnable1<
|
||||
BluetoothAvrcpResultHandler, void, BluetoothStatus, BluetoothStatus>
|
||||
ErrorRunnable;
|
||||
|
||||
void ErrorRsp(const DaemonSocketPDUHeader& aHeader,
|
||||
@ -187,57 +189,61 @@ protected:
|
||||
|
||||
class NotificationHandlerWrapper;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
nsString, unsigned long,
|
||||
const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, nsString, unsigned long,
|
||||
const nsAString&>
|
||||
RemoteFeatureNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable0<NotificationHandlerWrapper, void>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable0<
|
||||
NotificationHandlerWrapper, void>
|
||||
GetPlayStatusNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable0<NotificationHandlerWrapper, void>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable0<
|
||||
NotificationHandlerWrapper, void>
|
||||
ListPlayerAppAttrNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable1<NotificationHandlerWrapper, void,
|
||||
BluetoothAvrcpPlayerAttribute>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable1<
|
||||
NotificationHandlerWrapper, void, BluetoothAvrcpPlayerAttribute>
|
||||
ListPlayerAppValuesNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
uint8_t, nsAutoArrayPtr<BluetoothAvrcpPlayerAttribute>,
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, uint8_t,
|
||||
nsAutoArrayPtr<BluetoothAvrcpPlayerAttribute>,
|
||||
uint8_t, const BluetoothAvrcpPlayerAttribute*>
|
||||
GetPlayerAppValueNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
uint8_t, nsAutoArrayPtr<BluetoothAvrcpPlayerAttribute>,
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, uint8_t,
|
||||
nsAutoArrayPtr<BluetoothAvrcpPlayerAttribute>,
|
||||
uint8_t, const BluetoothAvrcpPlayerAttribute*>
|
||||
GetPlayerAppAttrsTextNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<NotificationHandlerWrapper, void,
|
||||
uint8_t, uint8_t,
|
||||
nsAutoArrayPtr<uint8_t>, uint8_t,
|
||||
uint8_t, const uint8_t*>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
NotificationHandlerWrapper, void, uint8_t, uint8_t,
|
||||
nsAutoArrayPtr<uint8_t>, uint8_t, uint8_t, const uint8_t*>
|
||||
GetPlayerAppValuesTextNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable1<NotificationHandlerWrapper, void,
|
||||
BluetoothAvrcpPlayerSettings,
|
||||
const BluetoothAvrcpPlayerSettings&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable1<
|
||||
NotificationHandlerWrapper, void, BluetoothAvrcpPlayerSettings,
|
||||
const BluetoothAvrcpPlayerSettings&>
|
||||
SetPlayerAppValueNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
uint8_t, nsAutoArrayPtr<BluetoothAvrcpMediaAttribute>,
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, uint8_t,
|
||||
nsAutoArrayPtr<BluetoothAvrcpMediaAttribute>,
|
||||
uint8_t, const BluetoothAvrcpMediaAttribute*>
|
||||
GetElementAttrNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
BluetoothAvrcpEvent, uint32_t>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, BluetoothAvrcpEvent, uint32_t>
|
||||
RegisterNotificationNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
uint8_t, uint8_t>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, uint8_t, uint8_t>
|
||||
VolumeChangeNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
int, int>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, int, int>
|
||||
PassthroughCmdNotification;
|
||||
|
||||
class GetElementAttrInitOp;
|
||||
|
@ -2964,8 +2964,8 @@ void
|
||||
BluetoothDaemonGattClientInterface::DispatchError(
|
||||
BluetoothGattClientResultHandler* aRes, BluetoothStatus aStatus)
|
||||
{
|
||||
BluetoothResultRunnable1<BluetoothGattClientResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
DaemonResultRunnable1<BluetoothGattClientResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
aRes, &BluetoothGattResultHandler::OnError,
|
||||
ConstantInitOp1<BluetoothStatus>(aStatus));
|
||||
}
|
||||
@ -2986,8 +2986,8 @@ void
|
||||
BluetoothDaemonGattServerInterface::DispatchError(
|
||||
BluetoothGattServerResultHandler* aRes, BluetoothStatus aStatus)
|
||||
{
|
||||
BluetoothResultRunnable1<BluetoothGattServerResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
DaemonResultRunnable1<BluetoothGattServerResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
aRes, &BluetoothGattResultHandler::OnError,
|
||||
ConstantInitOp1<BluetoothStatus>(aStatus));
|
||||
}
|
||||
@ -3008,8 +3008,8 @@ void
|
||||
BluetoothDaemonGattInterface::DispatchError(
|
||||
BluetoothGattResultHandler* aRes, BluetoothStatus aStatus)
|
||||
{
|
||||
BluetoothResultRunnable1<BluetoothGattResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
DaemonResultRunnable1<BluetoothGattResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
aRes, &BluetoothGattResultHandler::OnError,
|
||||
ConstantInitOp1<BluetoothStatus>(aStatus));
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "BluetoothDaemonHelpers.h"
|
||||
#include "BluetoothInterface.h"
|
||||
#include "BluetoothInterfaceHelpers.h"
|
||||
#include "mozilla/ipc/DaemonRunnables.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
@ -313,21 +314,25 @@ protected:
|
||||
// Responses
|
||||
//
|
||||
|
||||
typedef BluetoothResultRunnable0<BluetoothGattClientResultHandler, void>
|
||||
typedef mozilla::ipc::DaemonResultRunnable0<
|
||||
BluetoothGattClientResultHandler, void>
|
||||
ClientResultRunnable;
|
||||
|
||||
typedef BluetoothResultRunnable1<BluetoothGattClientResultHandler, void,
|
||||
BluetoothTypeOfDevice, BluetoothTypeOfDevice>
|
||||
typedef mozilla::ipc::DaemonResultRunnable1<
|
||||
BluetoothGattClientResultHandler, void,
|
||||
BluetoothTypeOfDevice, BluetoothTypeOfDevice>
|
||||
ClientGetDeviceTypeResultRunnable;
|
||||
|
||||
typedef BluetoothResultRunnable0<BluetoothGattServerResultHandler, void>
|
||||
typedef mozilla::ipc::DaemonResultRunnable0<
|
||||
BluetoothGattServerResultHandler, void>
|
||||
ServerResultRunnable;
|
||||
|
||||
typedef BluetoothResultRunnable0<BluetoothGattResultHandler, void>
|
||||
typedef mozilla::ipc::DaemonResultRunnable0<
|
||||
BluetoothGattResultHandler, void>
|
||||
ResultRunnable;
|
||||
|
||||
typedef BluetoothResultRunnable1<BluetoothGattResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>
|
||||
typedef mozilla::ipc::DaemonResultRunnable1<
|
||||
BluetoothGattResultHandler, void, BluetoothStatus, BluetoothStatus>
|
||||
ErrorRunnable;
|
||||
|
||||
void ErrorRsp(const DaemonSocketPDUHeader& aHeader,
|
||||
@ -488,42 +493,42 @@ protected:
|
||||
class ClientNotificationHandlerWrapper;
|
||||
class ServerNotificationHandlerWrapper;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, BluetoothUuid,
|
||||
BluetoothGattStatus, int, const BluetoothUuid&>
|
||||
ClientRegisterNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
nsString, int, BluetoothGattAdvData,
|
||||
const nsAString&, int, const BluetoothGattAdvData&>
|
||||
ClientScanResultNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable4<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable4<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattStatus, int, nsString,
|
||||
int, BluetoothGattStatus, int, const nsAString&>
|
||||
ClientConnectNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable4<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable4<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattStatus, int, nsString,
|
||||
int, BluetoothGattStatus, int, const nsAString&>
|
||||
ClientDisconnectNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattStatus>
|
||||
ClientSearchCompleteNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattServiceId,
|
||||
int, const BluetoothGattServiceId&>
|
||||
ClientSearchResultNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable5<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable5<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattStatus, BluetoothGattServiceId,
|
||||
BluetoothGattId, BluetoothGattCharProp,
|
||||
@ -531,7 +536,7 @@ protected:
|
||||
const BluetoothGattId&, const BluetoothGattCharProp&>
|
||||
ClientGetCharacteristicNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable5<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable5<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattStatus, BluetoothGattServiceId,
|
||||
BluetoothGattId, BluetoothGattId,
|
||||
@ -539,14 +544,14 @@ protected:
|
||||
const BluetoothGattId&, const BluetoothGattId&>
|
||||
ClientGetDescriptorNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable4<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable4<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattStatus, BluetoothGattServiceId, BluetoothGattServiceId,
|
||||
int, BluetoothGattStatus, const BluetoothGattServiceId&,
|
||||
const BluetoothGattServiceId&>
|
||||
ClientGetIncludedServiceNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable5<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable5<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, int, BluetoothGattStatus,
|
||||
BluetoothGattServiceId, BluetoothGattId,
|
||||
@ -554,121 +559,121 @@ protected:
|
||||
const BluetoothGattServiceId&, const BluetoothGattId&>
|
||||
ClientRegisterNotificationNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattNotifyParam,
|
||||
int, const BluetoothGattNotifyParam&>
|
||||
ClientNotifyNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattStatus, BluetoothGattReadParam,
|
||||
int, BluetoothGattStatus, const BluetoothGattReadParam&>
|
||||
ClientReadCharacteristicNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattStatus, BluetoothGattWriteParam,
|
||||
int, BluetoothGattStatus, const BluetoothGattWriteParam&>
|
||||
ClientWriteCharacteristicNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattStatus, BluetoothGattReadParam,
|
||||
int, BluetoothGattStatus, const BluetoothGattReadParam&>
|
||||
ClientReadDescriptorNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattStatus, BluetoothGattWriteParam,
|
||||
int, BluetoothGattStatus, const BluetoothGattWriteParam&>
|
||||
ClientWriteDescriptorNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, BluetoothGattStatus>
|
||||
ClientExecuteWriteNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable4<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable4<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
int, nsString, int, BluetoothGattStatus,
|
||||
int, const nsAString&, int, BluetoothGattStatus>
|
||||
ClientReadRemoteRssiNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
ClientNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int>
|
||||
ClientListenNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
ServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, BluetoothUuid,
|
||||
BluetoothGattStatus, int, const BluetoothUuid&>
|
||||
ServerRegisterNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable4<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable4<
|
||||
ServerNotificationHandlerWrapper, void,
|
||||
int, int, bool, nsString,
|
||||
int, int, bool, const nsAString&>
|
||||
ServerConnectionNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable4<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable4<
|
||||
ServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, BluetoothGattServiceId, int,
|
||||
BluetoothGattStatus, int, const BluetoothGattServiceId&, int>
|
||||
ServerServiceAddedNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable4<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable4<
|
||||
ServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, int, int>
|
||||
ServerIncludedServiceAddedNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable5<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable5<
|
||||
ServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, BluetoothUuid, int, int,
|
||||
BluetoothGattStatus, int, const BluetoothUuid&, int, int>
|
||||
ServerCharacteristicAddedNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable5<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable5<
|
||||
ServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, BluetoothUuid, int, int,
|
||||
BluetoothGattStatus, int, const BluetoothUuid&, int, int>
|
||||
ServerDescriptorAddedNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
ServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, int>
|
||||
ServerServiceStartedNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
ServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, int>
|
||||
ServerServiceStoppedNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
ServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int, int>
|
||||
ServerServiceDeletedNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable6<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable6<
|
||||
ServerNotificationHandlerWrapper, void,
|
||||
int, int, nsString, int, int, bool,
|
||||
int, int, const nsAString&, int, int, bool>
|
||||
ServerRequestReadNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable9<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable9<
|
||||
ServerNotificationHandlerWrapper, void,
|
||||
int, int, nsString, int, int, int, nsAutoArrayPtr<uint8_t>, bool, bool,
|
||||
int, int, const nsAString&, int, int, int, const uint8_t*, bool, bool>
|
||||
ServerRequestWriteNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable4<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable4<
|
||||
ServerNotificationHandlerWrapper, void,
|
||||
int, int, nsString, bool,
|
||||
int, int, const nsAString&, bool>
|
||||
ServerRequestExecuteWriteNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
ServerNotificationHandlerWrapper, void,
|
||||
BluetoothGattStatus, int>
|
||||
ServerResponseConfirmationNotification;
|
||||
|
@ -1799,8 +1799,8 @@ void
|
||||
BluetoothDaemonHandsfreeInterface::DispatchError(
|
||||
BluetoothHandsfreeResultHandler* aRes, BluetoothStatus aStatus)
|
||||
{
|
||||
BluetoothResultRunnable1<BluetoothHandsfreeResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
DaemonResultRunnable1<BluetoothHandsfreeResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
aRes, &BluetoothHandsfreeResultHandler::OnError,
|
||||
ConstantInitOp1<BluetoothStatus>(aStatus));
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "BluetoothDaemonHelpers.h"
|
||||
#include "BluetoothInterface.h"
|
||||
#include "BluetoothInterfaceHelpers.h"
|
||||
#include "mozilla/ipc/DaemonRunnables.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
@ -135,11 +136,12 @@ protected:
|
||||
// Responses
|
||||
//
|
||||
|
||||
typedef BluetoothResultRunnable0<BluetoothHandsfreeResultHandler, void>
|
||||
typedef mozilla::ipc::DaemonResultRunnable0<
|
||||
BluetoothHandsfreeResultHandler, void>
|
||||
ResultRunnable;
|
||||
|
||||
typedef BluetoothResultRunnable1<BluetoothHandsfreeResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>
|
||||
typedef mozilla::ipc::DaemonResultRunnable1<
|
||||
BluetoothHandsfreeResultHandler, void, BluetoothStatus, BluetoothStatus>
|
||||
ErrorRunnable;
|
||||
|
||||
void ErrorRsp(const DaemonSocketPDUHeader& aHeader,
|
||||
@ -216,88 +218,76 @@ protected:
|
||||
|
||||
class NotificationHandlerWrapper;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
BluetoothHandsfreeConnectionState,
|
||||
nsString,
|
||||
BluetoothHandsfreeConnectionState,
|
||||
const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, BluetoothHandsfreeConnectionState,
|
||||
nsString, BluetoothHandsfreeConnectionState, const nsAString&>
|
||||
ConnectionStateNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
BluetoothHandsfreeAudioState,
|
||||
nsString,
|
||||
BluetoothHandsfreeAudioState,
|
||||
const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, BluetoothHandsfreeAudioState,
|
||||
nsString, BluetoothHandsfreeAudioState, const nsAString&>
|
||||
AudioStateNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
BluetoothHandsfreeVoiceRecognitionState, nsString,
|
||||
BluetoothHandsfreeVoiceRecognitionState, const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, BluetoothHandsfreeVoiceRecognitionState,
|
||||
nsString, BluetoothHandsfreeVoiceRecognitionState, const nsAString&>
|
||||
VoiceRecognitionNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable1<NotificationHandlerWrapper, void,
|
||||
nsString,
|
||||
const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable1<
|
||||
NotificationHandlerWrapper, void, nsString, const nsAString&>
|
||||
AnswerCallNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable1<NotificationHandlerWrapper, void,
|
||||
nsString,
|
||||
const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable1<
|
||||
NotificationHandlerWrapper, void, nsString, const nsAString&>
|
||||
HangupCallNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<NotificationHandlerWrapper, void,
|
||||
BluetoothHandsfreeVolumeType, int, nsString,
|
||||
BluetoothHandsfreeVolumeType, int, const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
NotificationHandlerWrapper, void, BluetoothHandsfreeVolumeType,
|
||||
int, nsString, BluetoothHandsfreeVolumeType, int, const nsAString&>
|
||||
VolumeNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
nsString, nsString,
|
||||
const nsAString&, const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, nsString, nsString, const nsAString&,
|
||||
const nsAString&>
|
||||
DialCallNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
char, nsString,
|
||||
char, const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, char, nsString, char, const nsAString&>
|
||||
DtmfNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
BluetoothHandsfreeNRECState, nsString,
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, BluetoothHandsfreeNRECState, nsString,
|
||||
BluetoothHandsfreeNRECState, const nsAString&>
|
||||
NRECNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
BluetoothHandsfreeCallHoldType, nsString,
|
||||
BluetoothHandsfreeCallHoldType, const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, BluetoothHandsfreeCallHoldType,
|
||||
nsString, BluetoothHandsfreeCallHoldType, const nsAString&>
|
||||
CallHoldNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable1<NotificationHandlerWrapper, void,
|
||||
nsString,
|
||||
const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable1<
|
||||
NotificationHandlerWrapper, void, nsString, const nsAString&>
|
||||
CnumNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable1<NotificationHandlerWrapper, void,
|
||||
nsString,
|
||||
const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable1<
|
||||
NotificationHandlerWrapper, void, nsString, const nsAString&>
|
||||
CindNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable1<NotificationHandlerWrapper, void,
|
||||
nsString,
|
||||
const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable1<
|
||||
NotificationHandlerWrapper, void, nsString, const nsAString&>
|
||||
CopsNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable1<NotificationHandlerWrapper, void,
|
||||
nsString,
|
||||
const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable1<
|
||||
NotificationHandlerWrapper, void, nsString, const nsAString&>
|
||||
ClccNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
nsCString, nsString,
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, nsCString, nsString,
|
||||
const nsACString&, const nsAString&>
|
||||
UnknownAtNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable1<NotificationHandlerWrapper, void,
|
||||
nsString,
|
||||
const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable1<
|
||||
NotificationHandlerWrapper, void, nsString, const nsAString&>
|
||||
KeyPressedNotification;
|
||||
|
||||
class ConnectionStateInitOp;
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "BluetoothDaemonSetupInterface.h"
|
||||
#include "BluetoothDaemonSocketInterface.h"
|
||||
#include "BluetoothInterfaceHelpers.h"
|
||||
#include "mozilla/ipc/DaemonRunnables.h"
|
||||
#include "mozilla/ipc/DaemonSocket.h"
|
||||
#include "mozilla/ipc/ListenSocket.h"
|
||||
#include "mozilla/unused.h"
|
||||
@ -147,11 +148,12 @@ private:
|
||||
// Responses
|
||||
//
|
||||
|
||||
typedef BluetoothResultRunnable0<BluetoothSetupResultHandler, void>
|
||||
typedef mozilla::ipc::DaemonResultRunnable0<
|
||||
BluetoothSetupResultHandler, void>
|
||||
ResultRunnable;
|
||||
|
||||
typedef BluetoothResultRunnable1<BluetoothSetupResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>
|
||||
typedef mozilla::ipc::DaemonResultRunnable1<
|
||||
BluetoothSetupResultHandler, void, BluetoothStatus, BluetoothStatus>
|
||||
ErrorRunnable;
|
||||
|
||||
void
|
||||
@ -619,11 +621,12 @@ private:
|
||||
// Responses
|
||||
//
|
||||
|
||||
typedef BluetoothResultRunnable0<BluetoothResultHandler, void>
|
||||
typedef mozilla::ipc::DaemonResultRunnable0<
|
||||
BluetoothResultHandler, void>
|
||||
ResultRunnable;
|
||||
|
||||
typedef BluetoothResultRunnable1<BluetoothResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>
|
||||
typedef mozilla::ipc::DaemonResultRunnable1<
|
||||
BluetoothResultHandler, void, BluetoothStatus, BluetoothStatus>
|
||||
ErrorRunnable;
|
||||
|
||||
void ErrorRsp(const DaemonSocketPDUHeader& aHeader,
|
||||
@ -881,63 +884,58 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
typedef BluetoothNotificationRunnable1<NotificationHandlerWrapper, void,
|
||||
bool>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable1<
|
||||
NotificationHandlerWrapper, void, bool>
|
||||
AdapterStateChangedNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<NotificationHandlerWrapper, void,
|
||||
BluetoothStatus, int,
|
||||
nsAutoArrayPtr<BluetoothProperty>,
|
||||
BluetoothStatus, int,
|
||||
const BluetoothProperty*>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
NotificationHandlerWrapper, void, BluetoothStatus, int,
|
||||
nsAutoArrayPtr<BluetoothProperty>, BluetoothStatus, int,
|
||||
const BluetoothProperty*>
|
||||
AdapterPropertiesNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable4<NotificationHandlerWrapper, void,
|
||||
BluetoothStatus, nsString, int,
|
||||
nsAutoArrayPtr<BluetoothProperty>,
|
||||
BluetoothStatus, const nsAString&,
|
||||
int, const BluetoothProperty*>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable4<
|
||||
NotificationHandlerWrapper, void, BluetoothStatus, nsString, int,
|
||||
nsAutoArrayPtr<BluetoothProperty>, BluetoothStatus, const nsAString&,
|
||||
int, const BluetoothProperty*>
|
||||
RemoteDevicePropertiesNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
int,
|
||||
nsAutoArrayPtr<BluetoothProperty>,
|
||||
int, const BluetoothProperty*>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, int, nsAutoArrayPtr<BluetoothProperty>,
|
||||
int, const BluetoothProperty*>
|
||||
DeviceFoundNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable1<NotificationHandlerWrapper, void,
|
||||
bool>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable1<
|
||||
NotificationHandlerWrapper, void, bool>
|
||||
DiscoveryStateChangedNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<NotificationHandlerWrapper, void,
|
||||
nsString, nsString, uint32_t,
|
||||
const nsAString&, const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
NotificationHandlerWrapper, void, nsString, nsString, uint32_t,
|
||||
const nsAString&, const nsAString&>
|
||||
PinRequestNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable5<NotificationHandlerWrapper, void,
|
||||
nsString, nsString, uint32_t,
|
||||
BluetoothSspVariant, uint32_t,
|
||||
const nsAString&, const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable5<
|
||||
NotificationHandlerWrapper, void, nsString, nsString, uint32_t,
|
||||
BluetoothSspVariant, uint32_t, const nsAString&, const nsAString&>
|
||||
SspRequestNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<NotificationHandlerWrapper, void,
|
||||
BluetoothStatus, nsString,
|
||||
BluetoothBondState,
|
||||
BluetoothStatus, const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
NotificationHandlerWrapper, void, BluetoothStatus, nsString,
|
||||
BluetoothBondState, BluetoothStatus, const nsAString&>
|
||||
BondStateChangedNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<NotificationHandlerWrapper, void,
|
||||
BluetoothStatus, nsString, bool,
|
||||
BluetoothStatus, const nsAString&>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
NotificationHandlerWrapper, void, BluetoothStatus, nsString, bool,
|
||||
BluetoothStatus, const nsAString&>
|
||||
AclStateChangedNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable3<NotificationHandlerWrapper, void,
|
||||
uint16_t, nsAutoArrayPtr<uint8_t>,
|
||||
uint8_t, uint16_t, const uint8_t*>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
NotificationHandlerWrapper, void, uint16_t, nsAutoArrayPtr<uint8_t>,
|
||||
uint8_t, uint16_t, const uint8_t*>
|
||||
DutModeRecvNotification;
|
||||
|
||||
typedef BluetoothNotificationRunnable2<NotificationHandlerWrapper, void,
|
||||
BluetoothStatus, uint16_t>
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
NotificationHandlerWrapper, void, BluetoothStatus, uint16_t>
|
||||
LeTestModeNotification;
|
||||
|
||||
void AdapterStateChangedNtf(const DaemonSocketPDUHeader& aHeader,
|
||||
@ -2241,7 +2239,7 @@ void
|
||||
BluetoothDaemonInterface::DispatchError(BluetoothResultHandler* aRes,
|
||||
BluetoothStatus aStatus)
|
||||
{
|
||||
BluetoothResultRunnable1<
|
||||
DaemonResultRunnable1<
|
||||
BluetoothResultHandler, void, BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
aRes, &BluetoothResultHandler::OnError,
|
||||
ConstantInitOp1<BluetoothStatus>(aStatus));
|
||||
|
@ -366,8 +366,8 @@ void
|
||||
BluetoothDaemonSocketInterface::DispatchError(
|
||||
BluetoothSocketResultHandler* aRes, BluetoothStatus aStatus)
|
||||
{
|
||||
BluetoothResultRunnable1<BluetoothSocketResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
DaemonResultRunnable1<BluetoothSocketResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>::Dispatch(
|
||||
aRes, &BluetoothSocketResultHandler::OnError,
|
||||
ConstantInitOp1<BluetoothStatus>(aStatus));
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "BluetoothDaemonHelpers.h"
|
||||
#include "BluetoothInterface.h"
|
||||
#include "BluetoothInterfaceHelpers.h"
|
||||
#include "mozilla/ipc/DaemonRunnables.h"
|
||||
|
||||
BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
@ -58,20 +59,21 @@ private:
|
||||
// Responses
|
||||
//
|
||||
|
||||
typedef BluetoothResultRunnable0<BluetoothSocketResultHandler, void>
|
||||
typedef mozilla::ipc::DaemonResultRunnable0<
|
||||
BluetoothSocketResultHandler, void>
|
||||
ResultRunnable;
|
||||
|
||||
typedef BluetoothResultRunnable1<BluetoothSocketResultHandler, void,
|
||||
int, int>
|
||||
typedef mozilla::ipc::DaemonResultRunnable1<
|
||||
BluetoothSocketResultHandler, void, int, int>
|
||||
IntResultRunnable;
|
||||
|
||||
typedef BluetoothResultRunnable1<BluetoothSocketResultHandler, void,
|
||||
BluetoothStatus, BluetoothStatus>
|
||||
typedef mozilla::ipc::DaemonResultRunnable1<
|
||||
BluetoothSocketResultHandler, void, BluetoothStatus, BluetoothStatus>
|
||||
ErrorRunnable;
|
||||
|
||||
typedef BluetoothResultRunnable3<BluetoothSocketResultHandler, void,
|
||||
int, nsString, int,
|
||||
int, const nsAString_internal&, int>
|
||||
typedef mozilla::ipc::DaemonResultRunnable3<
|
||||
BluetoothSocketResultHandler, void, int, nsString, int, int,
|
||||
const nsAString_internal&, int>
|
||||
IntStringIntResultRunnable;
|
||||
|
||||
void ErrorRsp(const DaemonSocketPDUHeader& aHeader,
|
||||
|
808
ipc/hal/DaemonRunnables.h
Normal file
808
ipc/hal/DaemonRunnables.h
Normal file
@ -0,0 +1,808 @@
|
||||
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_ipc_DaemonRunnables_h
|
||||
#define mozilla_ipc_DaemonRunnables_h
|
||||
|
||||
#include "mozilla/unused.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
//
|
||||
// Result handling
|
||||
//
|
||||
// The classes of type |DaemonResultRunnable[0..3]| transfer a result
|
||||
// handler from the I/O thread to the main thread for execution. Call
|
||||
// the methods |Create| and |Dispatch| to create or create-and-dispatch
|
||||
// a result runnable.
|
||||
//
|
||||
// You need to specify the called method. The |Create| and |Dispatch|
|
||||
// methods of |DaemonResultRunnable[1..3]| receive an extra argument
|
||||
// for initializing the result's arguments. During creation, the result
|
||||
// runnable calls the supplied class's call operator with the result's
|
||||
// argument. This is where initialization and conversion from backend-
|
||||
// specific types is performed.
|
||||
//
|
||||
|
||||
template <typename Obj, typename Res>
|
||||
class DaemonResultRunnable0 final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef DaemonResultRunnable0<Obj, Res> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Obj* aObj, Res (Obj::*aMethod)(), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aObj, aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Obj* aObj, Res (Obj::*aMethod)(), const InitOp& aInitOp)
|
||||
{
|
||||
if (!aObj) {
|
||||
return; // silently return if no result runnable has been given
|
||||
}
|
||||
nsRefPtr<SelfType> runnable = Create(aObj, aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
return;
|
||||
}
|
||||
unused << NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable)));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Run() override
|
||||
{
|
||||
((*mObj).*mMethod)();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
DaemonResultRunnable0(Obj* aObj, Res (Obj::*aMethod)())
|
||||
: mObj(aObj)
|
||||
, mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mObj);
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult Init(const InitOp& aInitOp)
|
||||
{
|
||||
return aInitOp();
|
||||
}
|
||||
|
||||
nsRefPtr<Obj> mObj;
|
||||
void (Obj::*mMethod)();
|
||||
};
|
||||
|
||||
template <typename Obj, typename Res, typename Tin1, typename Arg1>
|
||||
class DaemonResultRunnable1 final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef DaemonResultRunnable1<Obj, Res, Tin1, Arg1> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Obj* aObj, Res (Obj::*aMethod)(Arg1), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aObj, aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Obj* aObj, Res (Obj::*aMethod)(Arg1), const InitOp& aInitOp)
|
||||
{
|
||||
if (!aObj) {
|
||||
return; // silently return if no result runnable has been given
|
||||
}
|
||||
nsRefPtr<SelfType> runnable = Create(aObj, aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
return;
|
||||
}
|
||||
unused << NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable)));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Run() override
|
||||
{
|
||||
((*mObj).*mMethod)(mArg1);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
DaemonResultRunnable1(Obj* aObj, Res (Obj::*aMethod)(Arg1))
|
||||
: mObj(aObj)
|
||||
, mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mObj);
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult Init(const InitOp& aInitOp)
|
||||
{
|
||||
return aInitOp(mArg1);
|
||||
}
|
||||
|
||||
nsRefPtr<Obj> mObj;
|
||||
Res (Obj::*mMethod)(Arg1);
|
||||
Tin1 mArg1;
|
||||
};
|
||||
|
||||
template <typename Obj, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Arg1, typename Arg2, typename Arg3>
|
||||
class DaemonResultRunnable3 final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef DaemonResultRunnable3<Obj, Res,
|
||||
Tin1, Tin2, Tin3,
|
||||
Arg1, Arg2, Arg3> SelfType;
|
||||
|
||||
template<typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Obj* aObj, Res (Obj::*aMethod)(Arg1, Arg2, Arg3),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aObj, aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
static void
|
||||
Dispatch(Obj* aObj, Res (Obj::*aMethod)(Arg1, Arg2, Arg3),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
if (!aObj) {
|
||||
return; // silently return if no result runnable has been given
|
||||
}
|
||||
nsRefPtr<SelfType> runnable = Create(aObj, aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
return;
|
||||
}
|
||||
unused << NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable)));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Run() override
|
||||
{
|
||||
((*mObj).*mMethod)(mArg1, mArg2, mArg3);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
DaemonResultRunnable3(Obj* aObj, Res (Obj::*aMethod)(Arg1, Arg2, Arg3))
|
||||
: mObj(aObj)
|
||||
, mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mObj);
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult
|
||||
Init(const InitOp& aInitOp)
|
||||
{
|
||||
return aInitOp(mArg1, mArg2, mArg3);
|
||||
}
|
||||
|
||||
nsRefPtr<Obj> mObj;
|
||||
Res (Obj::*mMethod)(Arg1, Arg2, Arg3);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
};
|
||||
|
||||
//
|
||||
// Notification handling
|
||||
//
|
||||
// The classes of type |DaemonNotificationRunnable[0..9]| transfer a
|
||||
// notification from the I/O thread to a notification handler on the
|
||||
// main thread. Call the methods |Create| and |Dispatch| to create or
|
||||
// create-and-dispatch a notification runnable.
|
||||
//
|
||||
// Like with result runnables, you need to specify the called method.
|
||||
// And like with result runnables, the |Create| and |Dispatch| methods
|
||||
// of |DaemonNotificationRunnable[1..9]| receive an extra argument
|
||||
// for initializing the notification's arguments. During creation, the
|
||||
// notification runnable calls the class's call operator with the
|
||||
// notification's argument. This is where initialization and conversion
|
||||
// from backend-specific types is performed.
|
||||
//
|
||||
|
||||
template <typename ObjectWrapper, typename Res>
|
||||
class DaemonNotificationRunnable0 final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef DaemonNotificationRunnable0<ObjectWrapper, Res> SelfType;
|
||||
|
||||
template<typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Res (ObjectType::*aMethod)(), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
return;
|
||||
}
|
||||
unused << NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable)));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
NS_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
DaemonNotificationRunnable0(Res (ObjectType::*aMethod)())
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult Init(const InitOp& aInitOp)
|
||||
{
|
||||
return aInitOp();
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)();
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Arg1=Tin1>
|
||||
class DaemonNotificationRunnable1 final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef DaemonNotificationRunnable1<ObjectWrapper, Res,
|
||||
Tin1, Arg1> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Res (ObjectType::*aMethod)(Arg1), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
return;
|
||||
}
|
||||
unused << NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable)));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
NS_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
DaemonNotificationRunnable1(Res (ObjectType::*aMethod)(Arg1))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1);
|
||||
Tin1 mArg1;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2>
|
||||
class DaemonNotificationRunnable2 final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef DaemonNotificationRunnable2<ObjectWrapper, Res,
|
||||
Tin1, Tin2,
|
||||
Arg1, Arg2> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Res (ObjectType::*aMethod)(Arg1, Arg2), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1, Arg2), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
return;
|
||||
}
|
||||
unused << NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable)));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
NS_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
DaemonNotificationRunnable2(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1, mArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1, Arg2);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2, typename Arg3=Tin3>
|
||||
class DaemonNotificationRunnable3 final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef DaemonNotificationRunnable3<ObjectWrapper, Res,
|
||||
Tin1, Tin2, Tin3,
|
||||
Arg1, Arg2, Arg3> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType>
|
||||
Create(Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3), const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
return;
|
||||
}
|
||||
unused << NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable)));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
NS_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2, mArg3);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
DaemonNotificationRunnable3(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1, mArg2, mArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1, Arg2, Arg3);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3, typename Tin4,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2,
|
||||
typename Arg3=Tin3, typename Arg4=Tin4>
|
||||
class DaemonNotificationRunnable4 final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef DaemonNotificationRunnable4<ObjectWrapper, Res,
|
||||
Tin1, Tin2, Tin3, Tin4, Arg1, Arg2, Arg3, Arg4> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType> Create(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
return;
|
||||
}
|
||||
unused << NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable)));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
NS_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2, mArg3, mArg4);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
DaemonNotificationRunnable4(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1, mArg2, mArg3, mArg4);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1, Arg2, Arg3, Arg4);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
Tin4 mArg4;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Tin4, typename Tin5,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2, typename Arg3=Tin3,
|
||||
typename Arg4=Tin4, typename Arg5=Tin5>
|
||||
class DaemonNotificationRunnable5 final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef DaemonNotificationRunnable5<ObjectWrapper, Res,
|
||||
Tin1, Tin2, Tin3, Tin4, Tin5, Arg1, Arg2, Arg3, Arg4, Arg5> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType> Create(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
return;
|
||||
}
|
||||
unused << NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable)));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
NS_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2, mArg3, mArg4, mArg5);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
DaemonNotificationRunnable5(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1, mArg2, mArg3, mArg4, mArg5);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1, Arg2, Arg3, Arg4, Arg5);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
Tin4 mArg4;
|
||||
Tin5 mArg5;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Tin4, typename Tin5, typename Tin6,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2, typename Arg3=Tin3,
|
||||
typename Arg4=Tin4, typename Arg5=Tin5, typename Arg6=Tin6>
|
||||
class DaemonNotificationRunnable6 final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef DaemonNotificationRunnable6<ObjectWrapper, Res,
|
||||
Tin1, Tin2, Tin3, Tin4, Tin5, Tin6, Arg1, Arg2, Arg3, Arg4, Arg5, Arg6>
|
||||
SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType> Create(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
return;
|
||||
}
|
||||
unused << NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable)));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
NS_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2, mArg3, mArg4, mArg5, mArg6);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
DaemonNotificationRunnable6(
|
||||
Res (ObjectType::*aMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1, mArg2, mArg3, mArg4, mArg5, mArg6);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
Tin4 mArg4;
|
||||
Tin5 mArg5;
|
||||
Tin6 mArg6;
|
||||
};
|
||||
|
||||
template <typename ObjectWrapper, typename Res,
|
||||
typename Tin1, typename Tin2, typename Tin3,
|
||||
typename Tin4, typename Tin5, typename Tin6,
|
||||
typename Tin7, typename Tin8, typename Tin9,
|
||||
typename Arg1=Tin1, typename Arg2=Tin2, typename Arg3=Tin3,
|
||||
typename Arg4=Tin4, typename Arg5=Tin5, typename Arg6=Tin6,
|
||||
typename Arg7=Tin7, typename Arg8=Tin8, typename Arg9=Tin9>
|
||||
class DaemonNotificationRunnable9 final : public nsRunnable
|
||||
{
|
||||
public:
|
||||
typedef typename ObjectWrapper::ObjectType ObjectType;
|
||||
typedef DaemonNotificationRunnable9<ObjectWrapper, Res,
|
||||
Tin1, Tin2, Tin3, Tin4, Tin5, Tin6, Tin7, Tin8, Tin9,
|
||||
Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9> SelfType;
|
||||
|
||||
template <typename InitOp>
|
||||
static already_AddRefed<SelfType> Create(
|
||||
Res (ObjectType::*aMethod)(
|
||||
Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable(new SelfType(aMethod));
|
||||
if (NS_FAILED(runnable->Init(aInitOp))) {
|
||||
return nullptr;
|
||||
}
|
||||
return runnable.forget();
|
||||
}
|
||||
|
||||
template <typename InitOp>
|
||||
static void
|
||||
Dispatch(
|
||||
Res (ObjectType::*aMethod)(
|
||||
Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9),
|
||||
const InitOp& aInitOp)
|
||||
{
|
||||
nsRefPtr<SelfType> runnable = Create(aMethod, aInitOp);
|
||||
if (!runnable) {
|
||||
return;
|
||||
}
|
||||
unused << NS_WARN_IF(NS_FAILED(NS_DispatchToMainThread(runnable)));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP Run() override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ObjectType* obj = ObjectWrapper::GetInstance();
|
||||
if (!obj) {
|
||||
NS_WARNING("Notification handler not initialized");
|
||||
} else {
|
||||
((*obj).*mMethod)(mArg1, mArg2, mArg3, mArg4,
|
||||
mArg5, mArg6, mArg7, mArg8, mArg9);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
DaemonNotificationRunnable9(
|
||||
Res (ObjectType::*aMethod)(
|
||||
Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9))
|
||||
: mMethod(aMethod)
|
||||
{
|
||||
MOZ_ASSERT(mMethod);
|
||||
}
|
||||
|
||||
template<typename InitOp>
|
||||
nsresult Init(const InitOp& aInitOp)
|
||||
{
|
||||
nsresult rv = aInitOp(mArg1, mArg2, mArg3, mArg4,
|
||||
mArg5, mArg6, mArg7, mArg8, mArg9);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
Res (ObjectType::*mMethod)(
|
||||
Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9);
|
||||
Tin1 mArg1;
|
||||
Tin2 mArg2;
|
||||
Tin3 mArg3;
|
||||
Tin4 mArg4;
|
||||
Tin5 mArg5;
|
||||
Tin6 mArg6;
|
||||
Tin7 mArg7;
|
||||
Tin8 mArg8;
|
||||
Tin9 mArg9;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // mozilla_ipc_DaemonRunnables_h
|
@ -5,6 +5,7 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXPORTS.mozilla.ipc += [
|
||||
'DaemonRunnables.h',
|
||||
'DaemonSocket.h',
|
||||
'DaemonSocketConsumer.h',
|
||||
'DaemonSocketPDU.h'
|
||||
|
Loading…
x
Reference in New Issue
Block a user