Closed
Bug 811569
Opened 12 years ago
Closed 11 years ago
[b2g-bluetooth] Bluetooth cleanup
Categories
(Core :: DOM: Device Interfaces, defect)
Tracking
()
People
(Reporter: gyeh, Assigned: gyeh)
References
Details
(Whiteboard: [LOE:M])
Attachments
(4 files, 14 obsolete files)
27.74 KB,
patch
|
Details | Diff | Splinter Review | |
15.16 KB,
patch
|
Details | Diff | Splinter Review | |
21.07 KB,
patch
|
Details | Diff | Splinter Review | |
16.67 KB,
patch
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•12 years ago
|
||
Attachment #681318 -
Flags: review?(echou)
Assignee | ||
Comment 2•12 years ago
|
||
No propertychange event in adapter and device. Also, since agent events like onrequestconfirmation is sent by system message, remove those from adapter.
Attachment #681320 -
Flags: review?(echou)
Assignee | ||
Comment 3•12 years ago
|
||
Attachment #681320 -
Attachment is obsolete: true
Attachment #681320 -
Flags: review?(echou)
Attachment #681323 -
Flags: review?(echou)
Assignee | ||
Comment 4•12 years ago
|
||
Attachment #681323 -
Attachment is obsolete: true
Attachment #681323 -
Flags: review?(echou)
Attachment #681325 -
Flags: review?(echou)
Assignee | ||
Comment 5•12 years ago
|
||
Attachment #681331 -
Flags: review?(echou)
Assignee | ||
Comment 6•12 years ago
|
||
Attachment #681334 -
Flags: review?(echou)
Assignee | ||
Comment 7•12 years ago
|
||
Attachment #681334 -
Attachment is obsolete: true
Attachment #681334 -
Flags: review?(echou)
Attachment #681335 -
Flags: review?(echou)
Assignee | ||
Comment 8•12 years ago
|
||
Attachment #681325 -
Attachment is obsolete: true
Attachment #681325 -
Flags: review?(echou)
Attachment #681339 -
Flags: review?(echou)
Assignee | ||
Comment 9•12 years ago
|
||
Attachment #681340 -
Flags: review?(echou)
Assignee | ||
Comment 10•12 years ago
|
||
Attachment #681360 -
Flags: review?(echou)
Assignee | ||
Comment 11•12 years ago
|
||
Attachment #681360 -
Attachment is obsolete: true
Attachment #681360 -
Flags: review?(echou)
Attachment #681362 -
Flags: review?(echou)
Comment 12•12 years ago
|
||
We won't block on this. If this is safe, please request uplift on the patches.
blocking-basecamp: ? → -
Assignee | ||
Updated•12 years ago
|
Attachment #681362 -
Flags: review?(echou)
Comment 13•12 years ago
|
||
Comment on attachment 681318 [details] [diff] [review] Patch 1(v1): Remove unused files Review of attachment 681318 [details] [diff] [review]: ----------------------------------------------------------------- r=me with nits addressed. ::: dom/bluetooth/BluetoothAdapter.cpp @@ +266,3 @@ > BluetoothAdapter::Notify(const BluetoothSignal& aData) > { > InfallibleTArray<BluetoothNamedValue> arr; Nit: this can be removed, right? @@ +309,5 @@ > > + NS_ASSERTION(arr.Length() == 1, > + "Got more than one property in a change message!"); > + BluetoothNamedValue property = arr[0]; > + SetPropertyByValue(property); Nit: it seems like we could just use arr[0] directly ::: dom/bluetooth/BluetoothDevice.cpp @@ +182,3 @@ > "PropertyChanged: Invalid value type"); > + InfallibleTArray<BluetoothNamedValue> arr = > + v.get_ArrayOfBluetoothNamedValue(); Question: should we use const InfallibleTArray<BluetoothNamedValue>& to catch returned value of v.get_ArrayOfBluetoothNamedValue()? Same question in BluetoothAdapter.cpp @@ +185,5 @@ > > + NS_ASSERTION(arr.Length() == 1, > + "Got more than one property in a change message!"); > + BluetoothNamedValue property = arr[0]; > + SetPropertyByValue(property); Nit: it seems like we could just use arr[0] directly
Attachment #681318 -
Flags: review?(echou) → review+
Assignee | ||
Comment 14•12 years ago
|
||
Attachment #681318 -
Attachment is obsolete: true
Comment 15•12 years ago
|
||
Comment on attachment 681331 [details] [diff] [review] Patch 3(v1): Support array of nsString in SetJsObject Review of attachment 681331 [details] [diff] [review]: ----------------------------------------------------------------- Looks good, some nits need to be fixed, though. ::: dom/bluetooth/BluetoothAdapter.cpp @@ +243,3 @@ > > + BluetoothService* bs = BluetoothService::Get(); > + NS_ENSURE_TRUE(bs, nullptr); Nit: In order to save a memory allocation, I would suggest to call NS_ENSURE_TRUE(bs, nullptr) before creating an adapter object. ::: dom/bluetooth/BluetoothDevice.cpp @@ +159,3 @@ > > + BluetoothService* bs = BluetoothService::Get(); > + NS_ENSURE_TRUE(bs, nullptr); Nit: In order to save a memory allocation, I would suggest to call NS_ENSURE_TRUE(bs, nullptr) before creating an adapter object. ::: dom/bluetooth/BluetoothUtils.cpp @@ +15,3 @@ > #include "nsISystemMessagesInternal.h" > #include "nsTArray.h" > +#include "nsTArrayHelpers.h" Nit: alphabetical order, please. @@ +23,3 @@ > mozilla::dom::bluetooth::SetJsObject(JSContext* aContext, > + const BluetoothValue& aValue, > + JSObject* aObj) Curious: why changing the order of the last two parameters? :P @@ +26,2 @@ > { > + MOZ_ASSERT(aContext && aObj); check aValue as well? @@ +29,5 @@ > + if (aValue.type() == BluetoothValue::TArrayOfnsString) { > + nsTArray<nsString> sourceArray = aValue.get_ArrayOfnsString(); > + if (NS_FAILED(nsTArrayToJSArray(aContext, > + sourceArray, > + &aObj))) { Nit: one line should be enough for this if-statement @@ +32,5 @@ > + sourceArray, > + &aObj))) { > +#ifdef DEBUG > + NS_WARNING("Cannot set JS UUIDs object!"); > +#endif no need to use DEBUG flag on NS_WARNING, here and below. @@ +38,4 @@ > } > > + return NS_OK; > + } else if (aValue.type() == BluetoothValue::TArrayOfBluetoothNamedValue) { Nit: an additional whitespace between else and if @@ +81,5 @@ > + > +#ifdef DEBUG > + NS_WARNING("Not handle the type of BluetoothValue!"); > +#endif > + return NS_ERROR_FAILURE; I may add an "else" to handle exception and return NS_OK at bottom, then you don't have to call return NS_OK in each block. ... } else { NS_WARNING("Not handle the type of BluetoothValue!"); return NS_ERROR_FAILURE; } return NS_OK; ::: dom/bluetooth/BluetoothUtils.h @@ +10,5 @@ > #include "BluetoothCommon.h" > > class JSContext; > class JSObject; > +class nsIScriptContext; It seems that we don't need this forward declaration. @@ +20,2 @@ > > +nsresult Since this is an internal use function, returning bool should be fine.
Attachment #681331 -
Flags: review?(echou) → review+
Assignee | ||
Comment 16•12 years ago
|
||
Attachment #695995 -
Attachment is obsolete: true
Assignee | ||
Comment 17•12 years ago
|
||
Attachment #681331 -
Attachment is obsolete: true
Assignee | ||
Updated•12 years ago
|
Attachment #681362 -
Attachment is obsolete: true
Attachment #681362 -
Attachment is patch: false
Comment 18•11 years ago
|
||
Comment on attachment 681335 [details] [diff] [review] Patch 4(v1): Cleanup for DOMRequest related checking and do_GetService checking Review of attachment 681335 [details] [diff] [review]: ----------------------------------------------------------------- r=me with nit addressed. ::: dom/bluetooth/BluetoothAdapter.cpp @@ +107,5 @@ > return false; > } > > + rv = > + nsTArrayToJSArray(sc->GetNativeContext(), devices, &JsDevices); Question: why wrapping this? It doesn't seem to exceed 80 chars. @@ +328,2 @@ > nsCOMPtr<nsIDOMDOMRequest> req; > + PrepareDOMRequest(GetOwner(), getter_AddRefs(req)); This could fail. We should check the returned value. Here and below. @@ +416,1 @@ > } nit: trailing whitespace ::: dom/bluetooth/BluetoothHfpManager.cpp @@ +895,5 @@ > > void > BluetoothHfpManager::OnConnectSuccess() > { > + super-nit: extra blank line @@ +944,5 @@ > > void > BluetoothHfpManager::OnDisconnect() > { > + super-nit: extra blank line @@ +945,5 @@ > void > BluetoothHfpManager::OnDisconnect() > { > + > + // When we close a connected socket, then restart listening again and super-nit: trailing whitespace ::: dom/bluetooth/BluetoothReplyRunnable.cpp @@ +39,1 @@ > super-nit: additional blanks @@ +46,5 @@ > BluetoothReplyRunnable::FireErrorString() > { > nsCOMPtr<nsIDOMRequestService> rs = > do_GetService("@mozilla.org/dom/dom-request-service;1"); > + NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE); nit: trailing whitespace @@ +51,1 @@ > super-nit: additional blanks
Attachment #681335 -
Flags: review?(echou) → review+
Comment 19•11 years ago
|
||
Comment on attachment 681340 [details] [diff] [review] Patch 5(v1): Remove asynchronous function GetProperty Review of attachment 681340 [details] [diff] [review]: ----------------------------------------------------------------- Looks good! However many parts of code have been removed already, so please remember to revise your patch for current codebase. ::: dom/bluetooth/BluetoothService.cpp @@ +274,5 @@ > BluetoothService::Cleanup() > { > MOZ_ASSERT(NS_IsMainThread()); > > + mBluetoothSignalObserverTable.Clear(); We don't clear the table here since it will be executed in UnregisterAllSignalHandlers() ::: dom/bluetooth/BluetoothService.h @@ +388,3 @@ > > #ifdef DEBUG > bool mLastRequestedEnable; I think we can remove this variable since no one is using it. ::: dom/bluetooth/linux/BluetoothDBusService.cpp @@ +429,5 @@ > LOG("%s: Invalid arguments for RequestConfirmation() method", __FUNCTION__); > errorStr.AssignLiteral("Invalid arguments for RequestConfirmation() method"); > } else { > parameters.AppendElement(BluetoothNamedValue( > + NS_LITERAL_STRING("path"), Nice catch!
Attachment #681340 -
Flags: review?(echou) → review+
Assignee | ||
Updated•11 years ago
|
Attachment #681339 -
Attachment is obsolete: true
Attachment #681339 -
Attachment is patch: false
Attachment #681339 -
Flags: review?(echou)
Assignee | ||
Updated•11 years ago
|
Attachment #696209 -
Attachment description: Patch 3: Support array of nsString in SetJsObject, r=echou → Final patch, Patch 2: Support array of nsString in SetJsObject, r=echou
Assignee | ||
Updated•11 years ago
|
Attachment #696208 -
Attachment description: Patch 1: Remove unused files, r=echou → Final patch, Patch 1: Remove unused files, r=echou
Assignee | ||
Comment 20•11 years ago
|
||
Attachment #681335 -
Attachment is obsolete: true
Assignee | ||
Comment 21•11 years ago
|
||
Attachment #681340 -
Attachment is obsolete: true
Assignee | ||
Comment 22•11 years ago
|
||
Attachment #696208 -
Attachment is obsolete: true
Assignee | ||
Comment 23•11 years ago
|
||
Attachment #696209 -
Attachment is obsolete: true
Comment 24•11 years ago
|
||
Try run for b838c17e9b35 is complete. Detailed breakdown of the results available here: https://tbpl.mozilla.org/?tree=Try&rev=b838c17e9b35 Results (out of 19 total builds): success: 17 warnings: 1 failure: 1 Builds (or logs if builds failed) available at: http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/gyeh@mozilla.com-b838c17e9b35
Assignee | ||
Comment 25•11 years ago
|
||
try: https://tbpl.mozilla.org/?tree=Try&rev=4eebf415b7c0
Comment 26•11 years ago
|
||
Try run for 4b75f2e4f6ce is complete. Detailed breakdown of the results available here: https://tbpl.mozilla.org/?tree=Try&rev=4b75f2e4f6ce Results (out of 1 total builds): success: 1 Builds (or logs if builds failed) available at: http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/gyeh@mozilla.com-4b75f2e4f6ce
Assignee | ||
Comment 27•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/7d02aa8c36b2 https://hg.mozilla.org/integration/mozilla-inbound/rev/80e9c08418ec https://hg.mozilla.org/integration/mozilla-inbound/rev/55ec088a4aba https://hg.mozilla.org/integration/mozilla-inbound/rev/84706f3c1abe
Comment 28•11 years ago
|
||
Comment on attachment 707011 [details] [diff] [review] Final patch, Patch 2: Support array of nsString in SetJsObject, r=echou Review of attachment 707011 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/bluetooth/BluetoothUtils.cpp @@ +65,5 @@ > + if (!JS_SetProperty(aContext, aObj, > + NS_ConvertUTF16toUTF8(arr[i].name()).get(), > + &val)) { > + NS_WARNING("Failed to set property"); > + return NS_ERROR_FAILURE; You're returning a nsresult from a function with a bool return type, I don't think this does what you want it to.
Assignee | ||
Comment 29•11 years ago
|
||
Oops! Thanks for reminding, Peter. :) I'll file another bug to fix it soon.
Comment 30•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/7d02aa8c36b2 https://hg.mozilla.org/mozilla-central/rev/80e9c08418ec https://hg.mozilla.org/mozilla-central/rev/55ec088a4aba https://hg.mozilla.org/mozilla-central/rev/84706f3c1abe
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
Comment 31•11 years ago
|
||
(In reply to Gina Yeh from comment #29) > I'll file another bug to fix it soon. Could you mention the bug number here?
Comment 32•11 years ago
|
||
(In reply to Peter Van der Beken [:peterv] from comment #31) > (In reply to Gina Yeh from comment #29) > > I'll file another bug to fix it soon. > > Could you mention the bug number here? I think it's Bug 835740
You need to log in
before you can comment on or make changes to this bug.
Description
•