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

Unified Diff: device/bluetooth/bluetooth_adapter_chromeos.h

Issue 982593002: Fix BluetoothAdapterProfileChromeOS lifecycle management (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nits, remove test debug logging Created 5 years, 9 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_chromeos.h
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.h b/device/bluetooth/bluetooth_adapter_chromeos.h
index 61e4a3a3da9c3c12e5545a96e13a7a059cb80b00..d8c1d9b48f8f7f7f4c96488fbfe0e956e564e70d 100644
--- a/device/bluetooth/bluetooth_adapter_chromeos.h
+++ b/device/bluetooth/bluetooth_adapter_chromeos.h
@@ -145,8 +145,9 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
const ProfileRegisteredCallback& success_callback,
const ErrorCompletionCallback& error_callback);
- // Releases the profile associated with |uuid|
- void ReleaseProfile(const device::BluetoothUUID& uuid);
+ // Release use of a profile by a device.
+ void ReleaseProfile(const dbus::ObjectPath& device_path,
+ BluetoothAdapterProfileChromeOS* profile);
protected:
// BluetoothAdapter:
@@ -283,20 +284,21 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// Called by dbus:: on completion of the D-Bus method to register a profile.
void OnRegisterProfile(const device::BluetoothUUID& uuid,
- const dbus::ObjectPath& device_path,
- BluetoothProfileServiceProvider::Delegate* delegate,
- const ProfileRegisteredCallback& success_callback,
- const ErrorCompletionCallback& error_callback);
- bool SetProfileDelegate(const device::BluetoothUUID& uuid,
+ scoped_ptr<BluetoothAdapterProfileChromeOS> profile);
+
+ void SetProfileDelegate(const device::BluetoothUUID& uuid,
const dbus::ObjectPath& device_path,
BluetoothProfileServiceProvider::Delegate* delegate,
const ProfileRegisteredCallback& success_callback,
const ErrorCompletionCallback& error_callback);
void OnRegisterProfileError(const device::BluetoothUUID& uuid,
- const ErrorCompletionCallback& error_callback,
const std::string& error_name,
const std::string& error_message);
+ // Called by BluetoothAdapterProfileChromeOS when no users of a profile
+ // remain.
+ void RemoveProfile(const device::BluetoothUUID& uuid);
+
// Processes the queued discovery requests. For each DiscoveryCallbackPair in
// the queue, this method will try to add a new discovery session. This method
// is called whenever a pending D-Bus call to start or stop discovery has
@@ -340,6 +342,14 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS
// The profiles we have registered with the bluetooth daemon.
std::map<device::BluetoothUUID, BluetoothAdapterProfileChromeOS*> profiles_;
+ // Callback pair for the profile registration queue.
+ typedef std::pair<base::Closure, ErrorCompletionCallback>
+ RegisterProfileCompletionPair;
+
+ // Queue of delegates waiting for a profile to register.
+ std::map<device::BluetoothUUID, std::vector<RegisterProfileCompletionPair>*>
+ profile_queues_;
+
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.
base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_;
« no previous file with comments | « chromeos/dbus/fake_bluetooth_profile_manager_client.cc ('k') | device/bluetooth/bluetooth_adapter_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698