Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Issue 12018024: Implemented Asynchronous Initialization of BluetoothAdapter. (Closed)

Created:
7 years, 11 months ago by youngki
Modified:
7 years, 11 months ago
CC:
chromium-reviews, Aaron Boodman, yoshiki+watch_chromium.org, chromium-apps-reviews_chromium.org, bryeung, Ami GONE FROM CHROMIUM
Visibility:
Public.

Description

We cannot run adapter callbacks inside BluetoothAdapterWin because passing scoped_refptr<BluetoothAdapter>(this) will destroy the adapter itself after the callback is finished. Instead, bluetooth_adapter_factory.cc maintains a vector of callbacks and they will be run once the adapter is initialized. I also put Bluetooth API initialization code into bluetooth_init_win.h and bluetooth_init_win.cc. From now on any code that wants to use Windows Bluetooth APIs should just include bluetooth_init_win.h. BUG=135470 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=178311

Patch Set 1 #

Patch Set 2 : Change GetAdapter to MaybeGetAdapter #

Patch Set 3 : Renamed RunCallbackOnAdapterReady to GetAdapter. #

Total comments: 6

Patch Set 4 : Replaced bluetooth_includes_win.h with bluetooth_init_win.h #

Total comments: 1

Patch Set 5 : Turned adapter_callbacks to a lazy instance. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+195 lines, -145 lines) Patch
M chrome/browser/chromeos/system/ash_system_tray_delegate.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h View 1 2 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc View 1 2 2 chunks +5 lines, -6 lines 0 comments Download
M chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.h View 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc View 1 2 3 chunks +7 lines, -9 lines 0 comments Download
M chrome/browser/ui/webui/options/chromeos/bluetooth_options_handler.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/extensions/permissions/bluetooth_device_permission.cc View 1 1 chunk +1 line, -1 line 0 comments Download
M device/bluetooth/bluetooth_adapter.h View 3 chunks +0 lines, -8 lines 0 comments Download
M device/bluetooth/bluetooth_adapter.cc View 1 chunk +0 lines, -4 lines 0 comments Download
M device/bluetooth/bluetooth_adapter_chromeos_unittest.cc View 1 2 29 chunks +29 lines, -29 lines 0 comments Download
M device/bluetooth/bluetooth_adapter_devices_chromeos_unittest.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M device/bluetooth/bluetooth_adapter_factory.h View 1 2 3 1 chunk +11 lines, -6 lines 0 comments Download
M device/bluetooth/bluetooth_adapter_factory.cc View 1 2 3 4 7 chunks +29 lines, -6 lines 0 comments Download
M device/bluetooth/bluetooth_adapter_win.h View 3 chunks +5 lines, -1 line 0 comments Download
M device/bluetooth/bluetooth_adapter_win.cc View 3 chunks +8 lines, -2 lines 0 comments Download
M device/bluetooth/bluetooth_adapter_win_unittest.cc View 2 chunks +18 lines, -2 lines 0 comments Download
D device/bluetooth/bluetooth_includes_win.h View 1 2 3 1 chunk +0 lines, -20 lines 0 comments Download
A + device/bluetooth/bluetooth_init_win.h View 1 2 3 2 chunks +14 lines, -3 lines 0 comments Download
A device/bluetooth/bluetooth_init_win.cc View 1 chunk +45 lines, -0 lines 0 comments Download
M device/bluetooth/bluetooth_service_record_win.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M device/bluetooth/bluetooth_task_manager_win.h View 1 chunk +0 lines, -5 lines 0 comments Download
M device/bluetooth/bluetooth_task_manager_win.cc View 1 2 3 4 chunks +13 lines, -33 lines 0 comments Download
M device/bluetooth/bluetooth_task_manager_win_unittest.cc View 2 chunks +2 lines, -1 line 0 comments Download
M device/device.gyp View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 16 (0 generated)
youngki
7 years, 11 months ago (2013-01-18 21:54:57 UTC) #1
youngki
Hi Scott, could you review this CL? This CL should complete the asynchronous initialization of ...
7 years, 11 months ago (2013-01-18 21:56:07 UTC) #2
keybuk
What is the continuing purpose of BluetoothAdapterFactory::GetAdapter() ? It doesn't look like this method will ...
7 years, 11 months ago (2013-01-18 22:58:15 UTC) #3
youngki
On 2013/01/18 22:58:15, keybuk wrote: > What is the continuing purpose of BluetoothAdapterFactory::GetAdapter() ? It ...
7 years, 11 months ago (2013-01-18 23:06:36 UTC) #4
keybuk
I don't think this is entirely clear from the method names and comments, in particular ...
7 years, 11 months ago (2013-01-18 23:13:54 UTC) #5
youngki
On 2013/01/18 23:13:54, keybuk wrote: > I don't think this is entirely clear from the ...
7 years, 11 months ago (2013-01-19 01:25:31 UTC) #6
keybuk
Let's call RunCallbackOnAdapterReady() just GetAdapter() then :-)
7 years, 11 months ago (2013-01-19 01:32:29 UTC) #7
youngki
On 2013/01/19 01:32:29, keybuk wrote: > Let's call RunCallbackOnAdapterReady() just GetAdapter() then :-) Done.
7 years, 11 months ago (2013-01-19 02:29:13 UTC) #8
keybuk
lgtm with a few nits below https://chromiumcodereview.appspot.com/12018024/diff/1019/chrome/common/extensions/permissions/bluetooth_device_permission.cc File chrome/common/extensions/permissions/bluetooth_device_permission.cc (right): https://chromiumcodereview.appspot.com/12018024/diff/1019/chrome/common/extensions/permissions/bluetooth_device_permission.cc#newcode49 chrome/common/extensions/permissions/bluetooth_device_permission.cc:49: if (bluetooth_adapter) { ...
7 years, 11 months ago (2013-01-22 18:40:57 UTC) #9
youngki
Thanks for the review Scott. I am now assigning this to Mike and Nikita for ...
7 years, 11 months ago (2013-01-22 20:38:13 UTC) #10
miket_OOO
> Mike, could you review the following files for ownership approval? > > chrome/browser/extensions/* > ...
7 years, 11 months ago (2013-01-22 22:37:03 UTC) #11
Nikita (slow)
lgtm
7 years, 11 months ago (2013-01-23 09:58:14 UTC) #12
youngki
Thanks for reviewing; putting it on CQ now.
7 years, 11 months ago (2013-01-23 15:05:01 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/youngki@chromium.org/12018024/17001
7 years, 11 months ago (2013-01-23 15:05:14 UTC) #14
commit-bot: I haz the power
Change committed as 178311
7 years, 11 months ago (2013-01-23 16:58:03 UTC) #15
Ami GONE FROM CHROMIUM
7 years, 11 months ago (2013-01-23 17:40:58 UTC) #16
Message was sent while issue was closed.
https://chromiumcodereview.appspot.com/12018024/diff/17001/device/bluetooth/b...
File device/bluetooth/bluetooth_adapter_factory.cc (right):

https://chromiumcodereview.appspot.com/12018024/diff/17001/device/bluetooth/b...
device/bluetooth/bluetooth_adapter_factory.cc:33:
std::vector<BluetoothAdapterFactory::AdapterCallback> adapter_callbacks;
Post-commit note:

This violates the style guide which prohibits global variables of class type. 
It also broke the Linux "sizes" test because it introduced a static initializer
to a file that previously had none.

Powered by Google App Engine
This is Rietveld 408576698