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

Unified Diff: device/bluetooth/bluetooth_adapter.cc

Issue 188473002: device/bluetooth: Remove BluetoothAdapter::Start|StopDiscovering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed BluetoothAdapterWinTest compile errors. Created 6 years, 9 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
« no previous file with comments | « device/bluetooth/bluetooth_adapter.h ('k') | device/bluetooth/bluetooth_adapter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_adapter.cc
diff --git a/device/bluetooth/bluetooth_adapter.cc b/device/bluetooth/bluetooth_adapter.cc
index 286815970dc7ec753539de13b45a8e3472a33369..ffa27ef8d4daf887a5fbf8becf74d9a2b145ed56 100644
--- a/device/bluetooth/bluetooth_adapter.cc
+++ b/device/bluetooth/bluetooth_adapter.cc
@@ -29,16 +29,6 @@ void BluetoothAdapter::StartDiscoverySession(
error_callback);
}
-void BluetoothAdapter::StartDiscovering(const base::Closure& callback,
- const ErrorCallback& error_callback) {
- AddDiscoverySession(callback, error_callback);
-}
-
-void BluetoothAdapter::StopDiscovering(const base::Closure& callback,
- const ErrorCallback& error_callback) {
- RemoveDiscoverySession(callback, error_callback);
-}
-
BluetoothAdapter::DeviceList BluetoothAdapter::GetDevices() {
ConstDeviceList const_devices =
const_cast<const BluetoothAdapter *>(this)->GetDevices();
@@ -119,15 +109,21 @@ void BluetoothAdapter::OnStartDiscoverySession(
}
void BluetoothAdapter::MarkDiscoverySessionsAsInactive() {
+ // As sessions are marked as inactive they will notify the adapter that they
+ // have become inactive, upon which the adapter will remove them from
+ // |discovery_sessions_|. To avoid invalidating the iterator, make a copy
+ // here.
+ std::set<BluetoothDiscoverySession*> temp(discovery_sessions_);
for (std::set<BluetoothDiscoverySession*>::iterator
- iter = discovery_sessions_.begin();
- iter != discovery_sessions_.end(); ++iter) {
+ iter = temp.begin();
+ iter != temp.end(); ++iter) {
(*iter)->MarkAsInactive();
}
}
-void BluetoothAdapter::DiscoverySessionDestroyed(
+void BluetoothAdapter::DiscoverySessionBecameInactive(
BluetoothDiscoverySession* discovery_session) {
+ DCHECK(!discovery_session->IsActive());
discovery_sessions_.erase(discovery_session);
}
« no previous file with comments | « device/bluetooth/bluetooth_adapter.h ('k') | device/bluetooth/bluetooth_adapter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698