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

Unified Diff: chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc

Issue 12018024: Implemented Asynchronous Initialization of BluetoothAdapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Turned adapter_callbacks to a lazy instance. Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc
index b6b786a2709c5ad953845c05c02ca06197808417..bbe72444c3167b86094efbb9092bdba0b3abbdcf 100644
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_event_router.cc
@@ -47,14 +47,14 @@ bool ExtensionBluetoothEventRouter::IsBluetoothSupported() const {
device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable();
}
-void ExtensionBluetoothEventRouter::RunCallbackOnAdapterReady(
- const device::BluetoothAdapter::AdapterCallback& callback) {
+void ExtensionBluetoothEventRouter::GetAdapter(
+ const device::BluetoothAdapterFactory::AdapterCallback& callback) {
if (adapter_) {
callback.Run(scoped_refptr<device::BluetoothAdapter>(adapter_));
return;
}
- device::BluetoothAdapterFactory::RunCallbackOnAdapterReady(callback);
+ device::BluetoothAdapterFactory::GetAdapter(callback);
}
void ExtensionBluetoothEventRouter::OnListenerAdded() {
@@ -186,9 +186,8 @@ void ExtensionBluetoothEventRouter::DeviceAdded(
void ExtensionBluetoothEventRouter::InitializeAdapterIfNeeded() {
if (!adapter_) {
- RunCallbackOnAdapterReady(
- base::Bind(&ExtensionBluetoothEventRouter::InitializeAdapter,
- weak_ptr_factory_.GetWeakPtr()));
+ GetAdapter(base::Bind(&ExtensionBluetoothEventRouter::InitializeAdapter,
+ weak_ptr_factory_.GetWeakPtr()));
}
}

Powered by Google App Engine
This is Rietveld 408576698