| 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 "chrome/browser/extensions/api/dial/dial_registry.h" | 5 #include "chrome/browser/extensions/api/dial/dial_registry.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 repeating_timer_.Stop(); | 150 repeating_timer_.Stop(); |
| 151 dial_->RemoveObserver(this); | 151 dial_->RemoveObserver(this); |
| 152 ClearDialService(); | 152 ClearDialService(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 bool DialRegistry::PruneExpiredDevices() { | 155 bool DialRegistry::PruneExpiredDevices() { |
| 156 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 156 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 157 bool pruned_device = false; | 157 bool pruned_device = false; |
| 158 DeviceByLabelMap::iterator it = device_by_label_map_.begin(); | 158 DeviceByLabelMap::iterator it = device_by_label_map_.begin(); |
| 159 while (it != device_by_label_map_.end()) { | 159 while (it != device_by_label_map_.end()) { |
| 160 const auto& device = it->second; | 160 auto* device = it->second; |
| 161 if (IsDeviceExpired(*device)) { | 161 if (IsDeviceExpired(*device)) { |
| 162 VLOG(2) << "Device " << device->label() << " expired, removing"; | 162 VLOG(2) << "Device " << device->label() << " expired, removing"; |
| 163 const size_t num_erased_by_id = | 163 const size_t num_erased_by_id = |
| 164 device_by_id_map_.erase(device->device_id()); | 164 device_by_id_map_.erase(device->device_id()); |
| 165 DCHECK_EQ(1U, num_erased_by_id); | 165 DCHECK_EQ(1U, num_erased_by_id); |
| 166 device_by_label_map_.erase(it++); | 166 device_by_label_map_.erase(it++); |
| 167 pruned_device = true; | 167 pruned_device = true; |
| 168 } else { | 168 } else { |
| 169 ++it; | 169 ++it; |
| 170 } | 170 } |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 case NetworkChangeNotifier::CONNECTION_BLUETOOTH: | 325 case NetworkChangeNotifier::CONNECTION_BLUETOOTH: |
| 326 if (!dial_) { | 326 if (!dial_) { |
| 327 VLOG(2) << "Connection detected, restarting discovery."; | 327 VLOG(2) << "Connection detected, restarting discovery."; |
| 328 StartPeriodicDiscovery(); | 328 StartPeriodicDiscovery(); |
| 329 } | 329 } |
| 330 break; | 330 break; |
| 331 } | 331 } |
| 332 } | 332 } |
| 333 | 333 |
| 334 } // namespace extensions | 334 } // namespace extensions |
| OLD | NEW |