Index: device/bluetooth/bluetooth_discovery_session.cc |
diff --git a/device/bluetooth/bluetooth_discovery_session.cc b/device/bluetooth/bluetooth_discovery_session.cc |
index afeacff7d48a2b640eaf767c925b44e49366b09d..7885e8697f2bc407a4087b763398779d8a2f90d6 100644 |
--- a/device/bluetooth/bluetooth_discovery_session.cc |
+++ b/device/bluetooth/bluetooth_discovery_session.cc |
@@ -9,7 +9,8 @@ |
namespace device { |
-BluetoothDiscoverySession::BluetoothDiscoverySession(BluetoothAdapter* adapter) |
+BluetoothDiscoverySession::BluetoothDiscoverySession( |
+ scoped_refptr<BluetoothAdapter> adapter) |
: active_(true), |
adapter_(adapter), |
weak_ptr_factory_(this) { |
@@ -17,6 +18,7 @@ BluetoothDiscoverySession::BluetoothDiscoverySession(BluetoothAdapter* adapter) |
BluetoothDiscoverySession::~BluetoothDiscoverySession() { |
Stop(base::Bind(&base::DoNothing), base::Bind(&base::DoNothing)); |
+ DCHECK(adapter_.get()); |
adapter_->DiscoverySessionDestroyed(this); |
} |
@@ -24,11 +26,12 @@ void BluetoothDiscoverySession::Stop( |
const base::Closure& callback, |
const ErrorCallback& error_callback) { |
if (!active_) { |
- LOG(ERROR) << "Discovery session not active. Cannot stop."; |
+ LOG(WARNING) << "Discovery session not active. Cannot stop."; |
error_callback.Run(); |
return; |
} |
VLOG(1) << "Stopping device discovery session."; |
+ DCHECK(adapter_.get()); |
adapter_->RemoveDiscoverySession( |
base::Bind(&BluetoothDiscoverySession::OnStop, |
weak_ptr_factory_.GetWeakPtr(), |