Closed Bug 1164498 Opened 11 years ago Closed 11 years ago

Replace |DispatchBluetoothReply| by v2 interfaces

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(firefox41 fixed)

RESOLVED FIXED
2.2 S13 (29may)
Tracking Status
firefox41 --- fixed

People

(Reporter: tzimmermann, Assigned: tzimmermann)

References

Details

Attachments

(5 files, 3 obsolete files)

1.59 KB, patch
ben.tian
: review+
Details | Diff | Splinter Review
4.60 KB, patch
ben.tian
: review+
Details | Diff | Splinter Review
5.92 KB, patch
ben.tian
: review+
Details | Diff | Splinter Review
22.42 KB, patch
tzimmermann
: review+
Details | Diff | Splinter Review
2.60 KB, patch
tzimmermann
: review+
Details | Diff | Splinter Review
We can reduce the differences between Bluetooth v1 and v2 by replacing |DispatchBluetoothReply| with either |DispatchReplySuccess| or |DispatchReplyError|.
Comment on attachment 8605435 [details] [diff] [review] [01] Bug 1164498: Cleanup Bluetooth utility functions for dispatching replies Review of attachment 8605435 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bluetooth/BluetoothUtils.cpp @@ +282,5 @@ > { > MOZ_ASSERT(aRunnable); > MOZ_ASSERT(aValue.type() != BluetoothValue::T__None); > > +#if MOZ_B2G_BT_API_V2 Remove the whole #if since the same assertion already exists above. ::: dom/bluetooth/BluetoothUtils.h @@ +166,5 @@ > * Dispatch failed bluetooth reply with error status. > * > + * TODO: Remove this function. |BluetoothStatus| is an internal > + * error code and not supposed to be exported. Its value > + * should be converted to a string before dispatching it. We should keep it since Promises rejection doesn't accept error strings (bug 1016560). As a result, bug 1032755 converts |BluetoothStatus| to nsresult for promise rejection. That's why we have this function.
Attachment #8605435 - Flags: review?(btian)
Comment on attachment 8605438 [details] [diff] [review] [02] Bug 1164498: Remove |DispatchBluetoothReply| from |BluetoothServiceBluedroid| Review of attachment 8605438 [details] [diff] [review]: ----------------------------------------------------------------- r=me with comment addressed. ::: dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp @@ +1178,5 @@ > #else > int requestedDeviceCount = aDeviceAddress.Length(); > if (requestedDeviceCount == 0) { > InfallibleTArray<BluetoothNamedValue> emptyArr; > + DispatchReplySuccess(aRunnable, BluetoothValue(emptyArr)); We can remove |BluetoothValue| since |BluetoothNamedValue| is a BluetoothValue [1]. DispatchReplySuccess(aRunnable, emptyArr); [1] https://dxr.mozilla.org/mozilla-central/source/dom/bluetooth/bluetooth1/ipc/BluetoothTypes.ipdlh#24 @@ +1214,5 @@ > #else > void StartDiscovery() override > { > MOZ_ASSERT(NS_IsMainThread()); > + DispatchReplySuccess(mRunnable, true); Simplify to following since [2]. DispatchReplySuccess(mRunnable); [2] https://dxr.mozilla.org/mozilla-central/source/dom/bluetooth/BluetoothUtils.cpp#277 @@ +1263,5 @@ > #else > void CancelDiscovery() override > { > MOZ_ASSERT(NS_IsMainThread()); > + DispatchReplySuccess(mRunnable, true); Ditto. @@ +1533,5 @@ > { } > > void PinReply() override > { > + DispatchReplySuccess(mRunnable, BluetoothValue(true)); Ditto. @@ +1633,5 @@ > { } > > void SspReply() override > { > + DispatchReplySuccess(mRunnable, BluetoothValue(true)); Ditto. @@ +2367,5 @@ > > // Send reply for SetProperty > > if (!sSetPropertyRunnableArray.IsEmpty()) { > + DispatchReplySuccess(sSetPropertyRunnableArray[0], BluetoothValue(true)); Ditto. @@ +2936,5 @@ > NS_LITERAL_STRING(KEY_ADAPTER), > BluetoothValue(propertiesChangeArray))); > > if (bonded && !sBondingRunnableArray.IsEmpty()) { > + DispatchReplySuccess(sBondingRunnableArray[0], BluetoothValue(true)); Ditto. @@ +2941,4 @@ > > sBondingRunnableArray.RemoveElementAt(0); > } else if (!bonded && !sUnbondingRunnableArray.IsEmpty()) { > + DispatchReplySuccess(sUnbondingRunnableArray[0], BluetoothValue(true)); Ditto.
Attachment #8605438 - Flags: review?(btian) → review+
Comment on attachment 8605439 [details] [diff] [review] [03] Bug 1164498: Remove |DispatchBluetoothReply| from |BluetoothProfileController| Review of attachment 8605439 [details] [diff] [review]: ----------------------------------------------------------------- r=me with comment addressed. ::: dom/bluetooth/bluetooth1/BluetoothProfileController.cpp @@ +264,5 @@ > > // The action has completed, so the DOM request should be replied then invoke > // the callback. > if (mSuccess) { > + DispatchReplySuccess(mRunnable, BluetoothValue(true)); Simplify to DispatchReplySuccess(mRunnable);
Attachment #8605439 - Flags: review?(btian) → review+
Comment on attachment 8605441 [details] [diff] [review] [04] Bug 1164498: Remove |DispatchBluetoothReply| from |BluetoothHfpManger| Review of attachment 8605441 [details] [diff] [review]: ----------------------------------------------------------------- LGTM.
Attachment #8605441 - Flags: review?(btian) → review+
Comment on attachment 8605442 [details] [diff] [review] [05] Bug 1164498: Remove |DispatchBluetoothReply| Review of attachment 8605442 [details] [diff] [review]: ----------------------------------------------------------------- LGTM.
Attachment #8605442 - Flags: review?(btian) → review+
Changes since v1: - further cleanup according to review Thanks for the rational on the use of BluetoothStatus. I was afraid that BluetoothStatus would some day become (unintentionally) part of the WebAPI. Looks like that's been solved already. :)
Attachment #8605435 - Attachment is obsolete: true
Attachment #8606972 - Flags: review?(btian)
Changes since v1: - simplified calls to |DispatchReplySuccess| according to review
Attachment #8605438 - Attachment is obsolete: true
Attachment #8606973 - Flags: review+
Changes since v1: - simplified calls to |DispatchReplySuccess| according to review
Attachment #8605439 - Attachment is obsolete: true
Attachment #8606975 - Flags: review+
Comment on attachment 8606972 [details] [diff] [review] [01] Bug 1164498: Cleanup Bluetooth utility functions for dispatching replies (v2) Review of attachment 8606972 [details] [diff] [review]: ----------------------------------------------------------------- LGTM.
Attachment #8606972 - Flags: review?(btian) → review+
Blocks: 1172914
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: