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

Unified Diff: device/bluetooth/bluetooth_adapter_chromeos.cc

Issue 935383003: Fix BluetoothAdapterProfileChromeOS lifecycle management (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: further fix ownership, address comments Created 5 years, 10 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.cc
diff --git a/device/bluetooth/bluetooth_adapter_chromeos.cc b/device/bluetooth/bluetooth_adapter_chromeos.cc
index e6c628322d349b629b507b17f753d8d541b35955..8f4d90769ae1fc17552b814af1ebcc2a93521981 100644
--- a/device/bluetooth/bluetooth_adapter_chromeos.cc
+++ b/device/bluetooth/bluetooth_adapter_chromeos.cc
@@ -964,14 +964,22 @@ void BluetoothAdapterChromeOS::UseProfile(
}
profiles_[uuid] = BluetoothAdapterProfileChromeOS::Register(
- this, uuid, options,
+ uuid, options,
base::Bind(&BluetoothAdapterChromeOS::OnRegisterProfile, this, uuid,
device_path, delegate, success_callback, error_callback),
base::Bind(&BluetoothAdapterChromeOS::OnRegisterProfileError, this, uuid,
error_callback));
}
-void BluetoothAdapterChromeOS::ReleaseProfile(const BluetoothUUID& uuid) {
+void BluetoothAdapterChromeOS::ReleaseProfile(
+ const dbus::ObjectPath& device_path,
+ BluetoothAdapterProfileChromeOS* profile) {
+ profile->RemoveDelegate(
+ device_path, base::Bind(&BluetoothAdapterChromeOS::RemoveProfile,
+ weak_ptr_factory_.GetWeakPtr(), profile->uuid()));
Ilya Sherman 2015/02/21 01:22:10 nit: Is this what git cl format produces? The for
Marie Janssen 2015/02/23 17:49:09 This is in fact what cl format produced. It looks
+}
+
+void BluetoothAdapterChromeOS::RemoveProfile(const BluetoothUUID& uuid) {
if (profiles_.find(uuid) != profiles_.end()) {
delete profiles_[uuid];
profiles_.erase(uuid);
@@ -1011,8 +1019,8 @@ void BluetoothAdapterChromeOS::OnRegisterProfileError(
LOG(WARNING) << object_path_.value()
<< ": Failed to register profile: " << error_name << ": "
<< error_message;
+ delete profiles_[uuid];
error_callback.Run(error_message);
- ReleaseProfile(uuid);
}
void BluetoothAdapterChromeOS::OnSetDiscoverable(

Powered by Google App Engine
This is Rietveld 408576698