Closed Bug 990392 Opened 10 years ago Closed 10 years ago

[Bluetooth] Cleanup shared variables in BluetoothDBusService.cpp

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: tzimmermann, Assigned: tzimmermann)

References

Details

Attachments

(6 files, 4 obsolete files)

1.03 KB, patch
echou
: review+
Details | Diff | Splinter Review
5.25 KB, patch
echou
: review+
Details | Diff | Splinter Review
4.19 KB, patch
echou
: review+
Details | Diff | Splinter Review
39.64 KB, patch
tzimmermann
: review+
Details | Diff | Splinter Review
3.31 KB, patch
tzimmermann
: review+
Details | Diff | Splinter Review
1.93 KB, patch
tzimmermann
: review+
Details | Diff | Splinter Review
BluetoothDBusService.cpp lists several shared variables that should be reviewer for thread-safety and possibly cleaned up.
s/reviewer/reviewed
Depends on: 972249
Attachment #8401281 - Attachment description: [03] Bug 990392: Move sAuthorizedServiceClass to I/O thread → [03] Bug 990392: Cleanup |GetServiceChannel| in BluetoothDBusService
Attachment #8401278 - Flags: review?(echou) → review+
Comment on attachment 8401279 [details] [diff] [review]
[02] Bug 990392: Move sAuthorizedServiceClass to I/O thread

Review of attachment 8401279 [details] [diff] [review]:
-----------------------------------------------------------------

Hi Thomas,

This looks fine to me. However I was thinking that maybe we should make sAuthorizedServiceClass a constant which contains BluetoothServiceClass::A2DP and BluetoothServiceClass::HID since sAuthorizedServiceClass won't be changed from the beginning. What do you think?
Hi

(In reply to Eric Chou [:ericchou] [:echou] from comment #8)
> Comment on attachment 8401279 [details] [diff] [review]
> [02] Bug 990392: Move sAuthorizedServiceClass to I/O thread
> 
> Review of attachment 8401279 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Hi Thomas,
> 
> This looks fine to me. However I was thinking that maybe we should make
> sAuthorizedServiceClass a constant which contains
> BluetoothServiceClass::A2DP and BluetoothServiceClass::HID since
> sAuthorizedServiceClass won't be changed from the beginning. What do you
> think?

This definitely makes sense to me. I'll update the patch accordingly.
Comment on attachment 8401281 [details] [diff] [review]
[03] Bug 990392: Cleanup |GetServiceChannel| in BluetoothDBusService

Review of attachment 8401281 [details] [diff] [review]:
-----------------------------------------------------------------

I can't believe you found this!
Attachment #8401281 - Flags: review?(echou) → review+
Comment on attachment 8401282 [details] [diff] [review]
[04] Bug 990392: Move |sAdapterPath| to I/O thread

Review of attachment 8401282 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with nits addressed.

::: dom/bluetooth/bluez/BluetoothDBusService.cpp
@@ +3565,5 @@
>  
>    void Run() MOZ_OVERRIDE
>    {
>      MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
>      MOZ_ASSERT(sDBusConnection);

nit: MOZ_ASSERT(!sAdapterPath.IsEmpty()), please.

@@ +3736,5 @@
>  
>  class SendMetadataTask : public Task
>  {
>  public:
> +  SendMetadataTask(const nsString& aDeviceAddress,

nit: please use const nsAString& instead of const nsString& if there's no special reason.

@@ +3760,5 @@
>  
>    void Run() MOZ_OVERRIDE
>    {
>      MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
>      MOZ_ASSERT(sDBusConnection);

nit: MOZ_ASSERT(!sAdapterPath.IsEmpty()), please.

@@ +3920,5 @@
>  
>    void Run() MOZ_OVERRIDE
>    {
>      MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
>      MOZ_ASSERT(sDBusConnection);

nit: MOZ_ASSERT(!sAdapterPath.IsEmpty()), please.

@@ +4042,5 @@
>  
>    void Run() MOZ_OVERRIDE
>    {
>      MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
>      MOZ_ASSERT(sDBusConnection);

nit: MOZ_ASSERT(!sAdapterPath.IsEmpty()), please.

@@ +4107,5 @@
>  
>    void Run() MOZ_OVERRIDE
>    {
>      MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
>      MOZ_ASSERT(sDBusConnection);

nit: MOZ_ASSERT(!sAdapterPath.IsEmpty()), please.
Attachment #8401282 - Flags: review?(echou) → review+
Attachment #8401283 - Flags: review?(echou) → review+
Comment on attachment 8401284 [details] [diff] [review]
[06] Bug 990392: Fix comments about shared variables in BluetoothDBusService

Review of attachment 8401284 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks!
Attachment #8401284 - Flags: review?(echou) → review+
Changes since v1:

  - converted sAuthorizedServiceClass to static const array.

That's so much better than before. :)
Attachment #8401279 - Attachment is obsolete: true
Attachment #8401279 - Flags: review?(echou)
Attachment #8403921 - Flags: review?(echou)
Changes since v1:

  - fixed parameter of type nsString
  - added extra asserts for !sAdapterPath.IsEmpty()
Attachment #8401282 - Attachment is obsolete: true
Attachment #8403928 - Flags: review+
Changes since v1:

  - only rebased
Attachment #8401283 - Attachment is obsolete: true
Attachment #8403929 - Flags: review+
Changes since v1:

  - rebased
  - added missing period in comment
Attachment #8401284 - Attachment is obsolete: true
Attachment #8403930 - Flags: review+
Comment on attachment 8403921 [details] [diff] [review]
[02] Bug 990392: Move sAuthorizedServiceClass to I/O thread (v2)

Review of attachment 8403921 [details] [diff] [review]:
-----------------------------------------------------------------

Looks decent!
Attachment #8403921 - Flags: review?(echou) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: