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

Unified Diff: device/bluetooth/bluetooth_adapter_profile_chromeos.h

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.h
diff --git a/device/bluetooth/bluetooth_adapter_profile_chromeos.h b/device/bluetooth/bluetooth_adapter_profile_chromeos.h
index 5f1edc2ead5e57aa892079cac232e8b71460515c..a23c9e345f46601b5f0bfb0dc3bd9e17830c5297 100644
--- a/device/bluetooth/bluetooth_adapter_profile_chromeos.h
+++ b/device/bluetooth/bluetooth_adapter_profile_chromeos.h
@@ -28,7 +28,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS
// options |options|. Returns a newly allocated pointer, or nullptr
// if there was a problem.
static BluetoothAdapterProfileChromeOS* Register(
- BluetoothAdapterChromeOS* adapter,
+ base::WeakPtr<BluetoothAdapterChromeOS> adapter,
const device::BluetoothUUID& uuid,
const BluetoothProfileManagerClient::Options& options,
const base::Closure& success_callback,
@@ -55,8 +55,9 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS
size_t DelegateCount() const { return delegates_.size(); }
private:
- BluetoothAdapterProfileChromeOS(BluetoothAdapterChromeOS* adapter,
- const device::BluetoothUUID& uuid);
+ BluetoothAdapterProfileChromeOS(
+ base::WeakPtr<BluetoothAdapterChromeOS> adapter,
+ const device::BluetoothUUID& uuid);
// BluetoothProfileServiceProvider::Delegate:
void Released() override;
@@ -87,7 +88,7 @@ class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterProfileChromeOS
scoped_ptr<BluetoothProfileServiceProvider> profile_;
// Adapter that owns this profile.
- BluetoothAdapterChromeOS* adapter_;
+ base::WeakPtr<BluetoothAdapterChromeOS> adapter_;
// Note: This should remain the last member so it'll be destroyed and
// invalidate its weak pointers before any other members are destroyed.

Powered by Google App Engine
This is Rietveld 408576698