Merge b-i to m-c, a=merge

This commit is contained in:
Phil Ringnalda 2015-07-03 19:12:38 -07:00
commit b20f0f1c2a
19 changed files with 77 additions and 161 deletions

View File

@ -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="c2438f746a3236398735202c0d79fab28cd019ae"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="75071a1117605a7ac79c51025caf6ffcfc4dfa95"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -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="c2438f746a3236398735202c0d79fab28cd019ae"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="75071a1117605a7ac79c51025caf6ffcfc4dfa95"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -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="c2438f746a3236398735202c0d79fab28cd019ae"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="75071a1117605a7ac79c51025caf6ffcfc4dfa95"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="87a2d8ab9248540910e56921654367b78a587095"/>

View File

@ -17,7 +17,7 @@
</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="c2438f746a3236398735202c0d79fab28cd019ae"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="75071a1117605a7ac79c51025caf6ffcfc4dfa95"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>

View File

@ -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="c2438f746a3236398735202c0d79fab28cd019ae"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="75071a1117605a7ac79c51025caf6ffcfc4dfa95"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c2438f746a3236398735202c0d79fab28cd019ae"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="75071a1117605a7ac79c51025caf6ffcfc4dfa95"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -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="c2438f746a3236398735202c0d79fab28cd019ae"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="75071a1117605a7ac79c51025caf6ffcfc4dfa95"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="87a2d8ab9248540910e56921654367b78a587095"/>

View File

@ -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="c2438f746a3236398735202c0d79fab28cd019ae"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="75071a1117605a7ac79c51025caf6ffcfc4dfa95"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "c2438f746a3236398735202c0d79fab28cd019ae",
"git_revision": "75071a1117605a7ac79c51025caf6ffcfc4dfa95",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "0312e33fddf5c92fad3933fd16f39075d6e6190f",
"revision": "22c58f4fec82075c7110bbc59ca7f6aad0a232a8",
"repo_path": "integration/gaia-central"
}

View File

@ -17,7 +17,7 @@
</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="c2438f746a3236398735202c0d79fab28cd019ae"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="75071a1117605a7ac79c51025caf6ffcfc4dfa95"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="46da1a05ac04157669685246d70ac59d48699c9e"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="49192a4e48d080e44a0d66f059e6897f07cf67f8"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="61e82f99bb8bc78d52b5717e9a2481ec7267fa33">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="c2438f746a3236398735202c0d79fab28cd019ae"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="75071a1117605a7ac79c51025caf6ffcfc4dfa95"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3477513bcd385571aa01c0d074849e35bd5e2376"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -68,8 +68,7 @@ class StartDiscoveryTask final : public BluetoothReplyRunnable
{
public:
StartDiscoveryTask(BluetoothAdapter* aAdapter, Promise* aPromise)
: BluetoothReplyRunnable(nullptr, aPromise,
NS_LITERAL_STRING("StartDiscovery"))
: BluetoothReplyRunnable(nullptr, aPromise)
, mAdapter(aAdapter)
{
MOZ_ASSERT(aPromise);
@ -117,8 +116,7 @@ class StartLeScanTask final : public BluetoothReplyRunnable
public:
StartLeScanTask(BluetoothAdapter* aAdapter, Promise* aPromise,
const nsTArray<nsString>& aServiceUuids)
: BluetoothReplyRunnable(nullptr, aPromise,
NS_LITERAL_STRING("StartLeScan"))
: BluetoothReplyRunnable(nullptr, aPromise)
, mAdapter(aAdapter)
, mServiceUuids(aServiceUuids)
{
@ -175,8 +173,7 @@ public:
StopLeScanTask(BluetoothAdapter* aAdapter,
Promise* aPromise,
const nsAString& aScanUuid)
: BluetoothReplyRunnable(nullptr, aPromise,
NS_LITERAL_STRING("StopLeScan"))
: BluetoothReplyRunnable(nullptr, aPromise)
, mAdapter(aAdapter)
, mScanUuid(aScanUuid)
{
@ -574,9 +571,7 @@ BluetoothAdapter::StartDiscovery(ErrorResult& aRv)
}
// Return BluetoothDiscoveryHandle in StartDiscoveryTask
nsRefPtr<BluetoothReplyRunnable> result =
new StartDiscoveryTask(this, promise);
bs->StartDiscoveryInternal(result);
bs->StartDiscoveryInternal(new StartDiscoveryTask(this, promise));
return promise.forget();
}
@ -606,11 +601,7 @@ BluetoothAdapter::StopDiscovery(ErrorResult& aRv)
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr /* DOMRequest */,
promise,
NS_LITERAL_STRING("StopDiscovery"));
bs->StopDiscoveryInternal(result);
bs->StopDiscoveryInternal(new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}
@ -707,13 +698,10 @@ BluetoothAdapter::SetName(const nsAString& aName, ErrorResult& aRv)
nsString name(aName);
BluetoothNamedValue property(NS_LITERAL_STRING("Name"),
BluetoothValue(name));
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr /* DOMRequest */,
promise,
NS_LITERAL_STRING("SetName"));
BT_ENSURE_TRUE_REJECT(
NS_SUCCEEDED(bs->SetProperty(BluetoothObjectType::TYPE_ADAPTER,
property, result)),
NS_SUCCEEDED(
bs->SetProperty(BluetoothObjectType::TYPE_ADAPTER, property,
new BluetoothVoidReplyRunnable(nullptr, promise))),
promise,
NS_ERROR_DOM_OPERATION_ERR);
@ -750,13 +738,10 @@ BluetoothAdapter::SetDiscoverable(bool aDiscoverable, ErrorResult& aRv)
// Wrap property to set and runnable to handle result
BluetoothNamedValue property(NS_LITERAL_STRING("Discoverable"),
BluetoothValue(aDiscoverable));
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr /* DOMRequest */,
promise,
NS_LITERAL_STRING("SetDiscoverable"));
BT_ENSURE_TRUE_REJECT(
NS_SUCCEEDED(bs->SetProperty(BluetoothObjectType::TYPE_ADAPTER,
property, result)),
NS_SUCCEEDED(
bs->SetProperty(BluetoothObjectType::TYPE_ADAPTER, property,
new BluetoothVoidReplyRunnable(nullptr, promise))),
promise,
NS_ERROR_DOM_OPERATION_ERR);
@ -832,19 +817,12 @@ BluetoothAdapter::PairUnpair(bool aPair, const nsAString& aDeviceAddress,
nsresult rv;
if (aPair) {
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr /* DOMRequest */,
promise,
NS_LITERAL_STRING("Pair"));
rv = bs->CreatePairedDeviceInternal(aDeviceAddress,
kCreatePairedDeviceTimeout,
result);
rv = bs->CreatePairedDeviceInternal(
aDeviceAddress, kCreatePairedDeviceTimeout,
new BluetoothVoidReplyRunnable(nullptr, promise));
} else {
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr /* DOMRequest */,
promise,
NS_LITERAL_STRING("Unpair"));
rv = bs->RemoveDeviceInternal(aDeviceAddress, result);
rv = bs->RemoveDeviceInternal(aDeviceAddress,
new BluetoothVoidReplyRunnable(nullptr, promise));
}
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(rv), promise, NS_ERROR_DOM_OPERATION_ERR);
@ -891,9 +869,7 @@ BluetoothAdapter::Enable(ErrorResult& aRv)
// Wrap runnable to handle result
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr, /* DOMRequest */
promise,
NS_LITERAL_STRING("Enable"));
new BluetoothVoidReplyRunnable(nullptr, promise);
if (NS_FAILED(bs->EnableDisable(true, result))) {
// Restore adapter state and reject promise
@ -932,9 +908,7 @@ BluetoothAdapter::Disable(ErrorResult& aRv)
// Wrap runnable to handle result
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr, /* DOMRequest */
promise,
NS_LITERAL_STRING("Disable"));
new BluetoothVoidReplyRunnable(nullptr, promise);
if (NS_FAILED(bs->EnableDisable(false, result))) {
// Restore adapter state and reject promise

View File

@ -54,9 +54,8 @@ class FetchUuidsTask final : public BluetoothReplyRunnable
{
public:
FetchUuidsTask(Promise* aPromise,
const nsAString& aName,
BluetoothDevice* aDevice)
: BluetoothReplyRunnable(nullptr /* DOMRequest */, aPromise, aName)
: BluetoothReplyRunnable(nullptr, aPromise)
, mDevice(aDevice)
{
MOZ_ASSERT(aPromise);
@ -185,16 +184,14 @@ BluetoothDevice::FetchUuids(ErrorResult& aRv)
nsRefPtr<Promise> promise = Promise::Create(global, aRv);
NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
// Ensure BluetoothService is available
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
nsRefPtr<BluetoothReplyRunnable> result =
new FetchUuidsTask(promise,
NS_LITERAL_STRING("FetchUuids"),
this);
nsresult rv = bs->FetchUuidsInternal(mAddress, result);
BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(rv), promise, NS_ERROR_DOM_OPERATION_ERR);
BT_ENSURE_TRUE_REJECT(
NS_SUCCEEDED(
bs->FetchUuidsInternal(mAddress, new FetchUuidsTask(promise, this))),
promise, NS_ERROR_DOM_OPERATION_ERR);
return promise.forget();
}
@ -382,7 +379,7 @@ BluetoothDevice::UpdatePropertiesFromAdvData(const nsTArray<uint8_t>& aAdvData)
dataLength -= 2;
}
char uuidStr[36];
char uuidStr[37]; // one more char to be null-terminated
if (type == GAP_INCOMPLETE_UUID16 || type == GAP_COMPLETE_UUID16) {
// Convert 16-bits UUID into string.
snprintf(uuidStr, sizeof(uuidStr),

View File

@ -121,13 +121,8 @@ BluetoothGatt::Connect(ErrorResult& aRv)
}
UpdateConnectionState(BluetoothConnectionState::Connecting);
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr /* DOMRequest */,
promise,
NS_LITERAL_STRING("ConnectGattClient"));
bs->ConnectGattClientInternal(mAppUuid,
mDeviceAddr,
result);
bs->ConnectGattClientInternal(
mAppUuid, mDeviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}
@ -153,11 +148,8 @@ BluetoothGatt::Disconnect(ErrorResult& aRv)
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
UpdateConnectionState(BluetoothConnectionState::Disconnecting);
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr /* DOMRequest */,
promise,
NS_LITERAL_STRING("DisconnectGattClient"));
bs->DisconnectGattClientInternal(mAppUuid, mDeviceAddr, result);
bs->DisconnectGattClientInternal(
mAppUuid, mDeviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}
@ -166,8 +158,7 @@ class ReadRemoteRssiTask final : public BluetoothReplyRunnable
{
public:
ReadRemoteRssiTask(Promise* aPromise)
: BluetoothReplyRunnable(nullptr, aPromise,
NS_LITERAL_STRING("GattClientReadRemoteRssi"))
: BluetoothReplyRunnable(nullptr, aPromise)
{
MOZ_ASSERT(aPromise);
}
@ -205,9 +196,8 @@ BluetoothGatt::ReadRemoteRssi(ErrorResult& aRv)
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
nsRefPtr<BluetoothReplyRunnable> result =
new ReadRemoteRssiTask(promise);
bs->GattClientReadRemoteRssiInternal(mClientIf, mDeviceAddr, result);
bs->GattClientReadRemoteRssiInternal(
mClientIf, mDeviceAddr, new ReadRemoteRssiTask(promise));
return promise.forget();
}
@ -236,11 +226,9 @@ BluetoothGatt::DiscoverServices(ErrorResult& aRv)
mDiscoveringServices = true;
mServices.Clear();
BluetoothGattBinding::ClearCachedServicesValue(this);
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr /* DOMRequest */,
promise,
NS_LITERAL_STRING("DiscoverGattServices"));
bs->DiscoverGattServicesInternal(mAppUuid, result);
bs->DiscoverGattServicesInternal(
mAppUuid, new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}

View File

@ -99,15 +99,9 @@ BluetoothGattCharacteristic::StartNotifications(ErrorResult& aRv)
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
BT_ENSURE_TRUE_REJECT(mService, promise, NS_ERROR_NOT_AVAILABLE);
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(
nullptr /* DOMRequest */,
promise,
NS_LITERAL_STRING("GattClientStartNotifications"));
bs->GattClientStartNotificationsInternal(mService->GetAppUuid(),
mService->GetServiceId(),
mCharId,
result);
bs->GattClientStartNotificationsInternal(
mService->GetAppUuid(), mService->GetServiceId(), mCharId,
new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}
@ -128,15 +122,9 @@ BluetoothGattCharacteristic::StopNotifications(ErrorResult& aRv)
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
BT_ENSURE_TRUE_REJECT(mService, promise, NS_ERROR_NOT_AVAILABLE);
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(
nullptr /* DOMRequest */,
promise,
NS_LITERAL_STRING("GattClientStopNotifications"));
bs->GattClientStopNotificationsInternal(mService->GetAppUuid(),
mService->GetServiceId(),
mCharId,
result);
bs->GattClientStopNotificationsInternal(
mService->GetAppUuid(), mService->GetServiceId(), mCharId,
new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}
@ -212,9 +200,7 @@ class ReadValueTask final : public BluetoothReplyRunnable
{
public:
ReadValueTask(BluetoothGattCharacteristic* aCharacteristic, Promise* aPromise)
: BluetoothReplyRunnable(
nullptr, aPromise,
NS_LITERAL_STRING("GattClientReadCharacteristicValue"))
: BluetoothReplyRunnable(nullptr, aPromise)
, mCharacteristic(aCharacteristic)
{
MOZ_ASSERT(aCharacteristic);
@ -271,11 +257,9 @@ BluetoothGattCharacteristic::ReadValue(ErrorResult& aRv)
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
nsRefPtr<BluetoothReplyRunnable> result = new ReadValueTask(this, promise);
bs->GattClientReadCharacteristicValueInternal(mService->GetAppUuid(),
mService->GetServiceId(),
mCharId,
result);
bs->GattClientReadCharacteristicValueInternal(
mService->GetAppUuid(), mService->GetServiceId(), mCharId,
new ReadValueTask(this, promise));
return promise.forget();
}
@ -308,14 +292,10 @@ BluetoothGattCharacteristic::WriteValue(const ArrayBuffer& aValue,
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
nsRefPtr<BluetoothReplyRunnable> result = new BluetoothVoidReplyRunnable(
nullptr, promise, NS_LITERAL_STRING("GattClientWriteCharacteristicValue"));
bs->GattClientWriteCharacteristicValueInternal(mService->GetAppUuid(),
mService->GetServiceId(),
mCharId,
mWriteType,
value,
result);
bs->GattClientWriteCharacteristicValueInternal(
mService->GetAppUuid(), mService->GetServiceId(),
mCharId, mWriteType, value,
new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}

View File

@ -122,9 +122,7 @@ class ReadValueTask final : public BluetoothReplyRunnable
{
public:
ReadValueTask(BluetoothGattDescriptor* aDescriptor, Promise* aPromise)
: BluetoothReplyRunnable(
nullptr, aPromise,
NS_LITERAL_STRING("GattClientReadDescriptorValue"))
: BluetoothReplyRunnable(nullptr, aPromise)
, mDescriptor(aDescriptor)
{
MOZ_ASSERT(aDescriptor);
@ -177,13 +175,12 @@ BluetoothGattDescriptor::ReadValue(ErrorResult& aRv)
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
nsRefPtr<BluetoothReplyRunnable> result = new ReadValueTask(this, promise);
bs->GattClientReadDescriptorValueInternal(
mCharacteristic->Service()->GetAppUuid(),
mCharacteristic->Service()->GetServiceId(),
mCharacteristic->GetCharacteristicId(),
mDescriptorId,
result);
new ReadValueTask(this, promise));
return promise.forget();
}
@ -209,15 +206,13 @@ BluetoothGattDescriptor::WriteValue(
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
nsRefPtr<BluetoothReplyRunnable> result = new BluetoothVoidReplyRunnable(
nullptr, promise, NS_LITERAL_STRING("GattClientWriteDescriptorValue"));
bs->GattClientWriteDescriptorValueInternal(
mCharacteristic->Service()->GetAppUuid(),
mCharacteristic->Service()->GetServiceId(),
mCharacteristic->GetCharacteristicId(),
mDescriptorId,
value,
result);
new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}

View File

@ -82,11 +82,8 @@ BluetoothPairingHandle::SetPinCode(const nsAString& aPinCode, ErrorResult& aRv)
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr /* DOMRequest */,
promise,
NS_LITERAL_STRING("SetPinCode"));
bs->PinReplyInternal(mDeviceAddress, true /* accept */, aPinCode, result);
bs->PinReplyInternal(mDeviceAddress, true /* accept */, aPinCode,
new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}
@ -116,12 +113,8 @@ BluetoothPairingHandle::Accept(ErrorResult& aRv)
promise,
NS_ERROR_DOM_OPERATION_ERR);
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr /* DOMRequest */,
promise,
NS_LITERAL_STRING("Accept"));
bs->SspReplyInternal(
mDeviceAddress, variant, true /* aAccept */, result);
bs->SspReplyInternal(mDeviceAddress, variant, true /* aAccept */,
new BluetoothVoidReplyRunnable(nullptr, promise));
return promise.forget();
}
@ -141,22 +134,17 @@ BluetoothPairingHandle::Reject(ErrorResult& aRv)
BluetoothService* bs = BluetoothService::Get();
BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
nsRefPtr<BluetoothReplyRunnable> result =
new BluetoothVoidReplyRunnable(nullptr /* DOMRequest */,
promise,
NS_LITERAL_STRING("Reject"));
if (mType.EqualsLiteral(PAIRING_REQ_TYPE_ENTERPINCODE)) { // Pin request
bs->PinReplyInternal(
mDeviceAddress, false /* aAccept */, EmptyString(), result);
bs->PinReplyInternal(mDeviceAddress, false /* aAccept */, EmptyString(),
new BluetoothVoidReplyRunnable(nullptr, promise));
} else { // Ssp request
BluetoothSspVariant variant;
BT_ENSURE_TRUE_REJECT(GetSspVariant(variant),
promise,
NS_ERROR_DOM_OPERATION_ERR);
bs->SspReplyInternal(
mDeviceAddress, variant, false /* aAccept */, result);
bs->SspReplyInternal(mDeviceAddress, variant, false /* aAccept */,
new BluetoothVoidReplyRunnable(nullptr, promise));
}
return promise.forget();

View File

@ -17,12 +17,10 @@ using namespace mozilla::dom;
USING_BLUETOOTH_NAMESPACE
BluetoothReplyRunnable::BluetoothReplyRunnable(nsIDOMDOMRequest* aReq,
Promise* aPromise,
const nsAString& aName)
Promise* aPromise)
: mDOMRequest(aReq)
, mPromise(aPromise)
, mErrorStatus(STATUS_FAIL)
, mName(aName)
{}
void
@ -121,9 +119,8 @@ BluetoothReplyRunnable::Run()
}
BluetoothVoidReplyRunnable::BluetoothVoidReplyRunnable(nsIDOMDOMRequest* aReq,
Promise* aPromise,
const nsAString& aName)
: BluetoothReplyRunnable(aReq, aPromise, aName)
Promise* aPromise)
: BluetoothReplyRunnable(aReq, aPromise)
{}
BluetoothVoidReplyRunnable::~BluetoothVoidReplyRunnable()

View File

@ -30,8 +30,7 @@ public:
NS_DECL_NSIRUNNABLE
BluetoothReplyRunnable(nsIDOMDOMRequest* aReq,
Promise* aPromise = nullptr,
const nsAString& aName = EmptyString());
Promise* aPromise = nullptr);
void SetReply(BluetoothReply* aReply);
@ -71,15 +70,13 @@ private:
BluetoothStatus mErrorStatus;
nsString mErrorString;
nsString mName; // for debugging
};
class BluetoothVoidReplyRunnable : public BluetoothReplyRunnable
{
public:
BluetoothVoidReplyRunnable(nsIDOMDOMRequest* aReq,
Promise* aPromise = nullptr,
const nsAString& aName = EmptyString());
Promise* aPromise = nullptr);
~BluetoothVoidReplyRunnable();
protected: