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

Unified Diff: device/bluetooth/bluetooth_adapter_factory.h

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: device/bluetooth/bluetooth_adapter_factory.h
diff --git a/device/bluetooth/bluetooth_adapter_factory.h b/device/bluetooth/bluetooth_adapter_factory.h
index f2203aa7cbc6f5296abc24503370727ea775896b..49753376ed834fe72d06bb85102ab806e132db88 100644
--- a/device/bluetooth/bluetooth_adapter_factory.h
+++ b/device/bluetooth/bluetooth_adapter_factory.h
@@ -18,18 +18,23 @@ namespace device {
// adapter" which may change depending on availability.
class BluetoothAdapterFactory {
public:
+ typedef base::Callback<void(scoped_refptr<BluetoothAdapter> adapter)>
+ AdapterCallback;
+
// Returns true if the Bluetooth adapter is available for the current
// platform.
static bool IsBluetoothAdapterAvailable();
- // Runs the callback with the shared instance for the default adapter when the
- // adapter is available to be used.
- static void RunCallbackOnAdapterReady(
- const BluetoothAdapter::AdapterCallback& callback);
+ // Returns the shared instance of the default adapter, creating and
+ // initializing it if necessary. |callback| is called with the adapter
+ // instance passed only once the adapter is fully initialized and ready to
+ // use.
+ static void GetAdapter(const AdapterCallback& callback);
- // Returns the shared instance of the adapter that has already been created.
+ // Returns the shared instance of the adapter that has already been created,
+ // but may or may not have been initialized.
// It returns NULL if no adapter has been created at the time.
- static scoped_refptr<BluetoothAdapter> GetAdapter();
+ static scoped_refptr<BluetoothAdapter> MaybeGetAdapter();
// Creates an instance for a specific adapter at address |address|.
static BluetoothAdapter* Create(const std::string& address);
« no previous file with comments | « device/bluetooth/bluetooth_adapter_devices_chromeos_unittest.cc ('k') | device/bluetooth/bluetooth_adapter_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698