Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/bluetooth/bluetooth_adapter.h" | 5 #include "device/bluetooth/bluetooth_adapter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "device/bluetooth/bluetooth_device.h" | 10 #include "device/bluetooth/bluetooth_device.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 (*iter)->MarkAsInactive(); | 193 (*iter)->MarkAsInactive(); |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 | 196 |
| 197 void BluetoothAdapter::DiscoverySessionBecameInactive( | 197 void BluetoothAdapter::DiscoverySessionBecameInactive( |
| 198 BluetoothDiscoverySession* discovery_session) { | 198 BluetoothDiscoverySession* discovery_session) { |
| 199 DCHECK(!discovery_session->IsActive()); | 199 DCHECK(!discovery_session->IsActive()); |
| 200 discovery_sessions_.erase(discovery_session); | 200 discovery_sessions_.erase(discovery_session); |
| 201 } | 201 } |
| 202 | 202 |
| 203 void BluetoothAdapter::DeleteDeviceForTesting(const std::string& address) { | |
| 204 std::map<const std::string, BluetoothDevice*>::iterator device = | |
| 205 devices_.find(address); | |
| 206 devices_.erase(device); | |
| 207 delete device->second; | |
|
Jeffrey Yasskin
2015/09/16 01:40:49
Erasing device invalidates it, so you need to copy
scheib
2015/09/16 21:55:17
Done.
| |
| 208 } | |
| 209 | |
| 203 scoped_ptr<BluetoothDiscoveryFilter> | 210 scoped_ptr<BluetoothDiscoveryFilter> |
| 204 BluetoothAdapter::GetMergedDiscoveryFilterHelper( | 211 BluetoothAdapter::GetMergedDiscoveryFilterHelper( |
| 205 const BluetoothDiscoveryFilter* masked_filter, | 212 const BluetoothDiscoveryFilter* masked_filter, |
| 206 bool omit) const { | 213 bool omit) const { |
| 207 scoped_ptr<BluetoothDiscoveryFilter> result; | 214 scoped_ptr<BluetoothDiscoveryFilter> result; |
| 208 bool first_merge = true; | 215 bool first_merge = true; |
| 209 | 216 |
| 210 std::set<BluetoothDiscoverySession*> temp(discovery_sessions_); | 217 std::set<BluetoothDiscoverySession*> temp(discovery_sessions_); |
| 211 for (const auto& iter : temp) { | 218 for (const auto& iter : temp) { |
| 212 const BluetoothDiscoveryFilter* curr_filter = iter->GetDiscoveryFilter(); | 219 const BluetoothDiscoveryFilter* curr_filter = iter->GetDiscoveryFilter(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 | 255 |
| 249 // static | 256 // static |
| 250 void BluetoothAdapter::RecordBluetoothDiscoverySessionStopOutcome( | 257 void BluetoothAdapter::RecordBluetoothDiscoverySessionStopOutcome( |
| 251 UMABluetoothDiscoverySessionOutcome outcome) { | 258 UMABluetoothDiscoverySessionOutcome outcome) { |
| 252 UMA_HISTOGRAM_ENUMERATION( | 259 UMA_HISTOGRAM_ENUMERATION( |
| 253 "Bluetooth.DiscoverySession.Stop.Outcome", static_cast<int>(outcome), | 260 "Bluetooth.DiscoverySession.Stop.Outcome", static_cast<int>(outcome), |
| 254 static_cast<int>(UMABluetoothDiscoverySessionOutcome::COUNT)); | 261 static_cast<int>(UMABluetoothDiscoverySessionOutcome::COUNT)); |
| 255 } | 262 } |
| 256 | 263 |
| 257 } // namespace device | 264 } // namespace device |
| OLD | NEW |