Index: device/bluetooth/bluetooth_discovery_session.cc |
diff --git a/device/bluetooth/bluetooth_discovery_session.cc b/device/bluetooth/bluetooth_discovery_session.cc |
index 6818a3c6a4fc4a335efeda3bd53329c0c3fe6b8b..a105ee2eeecba0da3eb5c629df3af6d29bba1903 100644 |
--- a/device/bluetooth/bluetooth_discovery_session.cc |
+++ b/device/bluetooth/bluetooth_discovery_session.cc |
@@ -25,7 +25,8 @@ BluetoothDiscoverySession::~BluetoothDiscoverySession() { |
return; |
} |
Stop(base::Bind(&base::DoNothing), base::Bind(&base::DoNothing)); |
- adapter_->DiscoverySessionDestroyed(this); |
+ if (active_) |
+ adapter_->DiscoverySessionBecameInactive(this); |
} |
bool BluetoothDiscoverySession::IsActive() const { |
@@ -50,12 +51,14 @@ void BluetoothDiscoverySession::Stop( |
} |
void BluetoothDiscoverySession::OnStop(const base::Closure& callback) { |
- active_ = false; |
+ MarkAsInactive(); |
callback.Run(); |
} |
void BluetoothDiscoverySession::MarkAsInactive() { |
active_ = false; |
+ DCHECK(adapter_.get()); |
+ adapter_->DiscoverySessionBecameInactive(this); |
} |
} // namespace device |