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

Unified Diff: device/bluetooth/bluetooth_adapter_profile_chromeos.cc

Issue 935383003: Fix BluetoothAdapterProfileChromeOS lifecycle management (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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_profile_chromeos.cc
diff --git a/device/bluetooth/bluetooth_adapter_profile_chromeos.cc b/device/bluetooth/bluetooth_adapter_profile_chromeos.cc
index 2feff37aed352abdbf8c54b8f42ecd096f465639..a34e1236ea373860f382f3df1d93738b0e2a10be 100644
--- a/device/bluetooth/bluetooth_adapter_profile_chromeos.cc
+++ b/device/bluetooth/bluetooth_adapter_profile_chromeos.cc
@@ -20,7 +20,7 @@ namespace chromeos {
// static
BluetoothAdapterProfileChromeOS* BluetoothAdapterProfileChromeOS::Register(
- BluetoothAdapterChromeOS* adapter,
+ base::WeakPtr<BluetoothAdapterChromeOS> adapter,
const device::BluetoothUUID& uuid,
const BluetoothProfileManagerClient::Options& options,
const base::Closure& success_callback,
@@ -39,7 +39,7 @@ BluetoothAdapterProfileChromeOS* BluetoothAdapterProfileChromeOS::Register(
}
BluetoothAdapterProfileChromeOS::BluetoothAdapterProfileChromeOS(
- BluetoothAdapterChromeOS* adapter,
+ base::WeakPtr<BluetoothAdapterChromeOS> adapter,
const device::BluetoothUUID& uuid)
: uuid_(uuid), adapter_(adapter), weak_ptr_factory_(this) {
std::string uuid_path;
@@ -54,6 +54,7 @@ BluetoothAdapterProfileChromeOS::BluetoothAdapterProfileChromeOS(
}
BluetoothAdapterProfileChromeOS::~BluetoothAdapterProfileChromeOS() {
+ adapter_->RemoveProfile(uuid_);
Ilya Sherman 2015/02/19 20:37:58 Using a weak pointer doesn't prevent this line fro
profile_.reset();
Ilya Sherman 2015/02/19 20:37:58 This line should not be necessary in the destructo
Marie Janssen 2015/02/20 22:53:46 After refactoring the ownership, these aren't need
}

Powered by Google App Engine
This is Rietveld 408576698