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

Side by Side Diff: device/usb/usb_service_impl.cc

Issue 536623003: Fixups in components/ for scoped_refptr operator T* removal. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « device/usb/usb_device_handle_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/usb/usb_service.h" 5 #include "device/usb/usb_service.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 ++next_unique_id_); 138 ++next_unique_id_);
139 devices_[platform_devices[i]] = new_device; 139 devices_[platform_devices[i]] = new_device;
140 connected_devices.insert(new_device); 140 connected_devices.insert(new_device);
141 } else { 141 } else {
142 connected_devices.insert(devices_[platform_devices[i]].get()); 142 connected_devices.insert(devices_[platform_devices[i]].get());
143 } 143 }
144 } 144 }
145 145
146 // Find disconnected devices. 146 // Find disconnected devices.
147 for (DeviceMap::iterator it = devices_.begin(); it != devices_.end(); ++it) { 147 for (DeviceMap::iterator it = devices_.begin(); it != devices_.end(); ++it) {
148 if (!ContainsKey(connected_devices, it->second)) { 148 if (!ContainsKey(connected_devices, it->second.get())) {
149 disconnected_devices.push_back(it->first); 149 disconnected_devices.push_back(it->first);
150 } 150 }
151 } 151 }
152 152
153 // Remove disconnected devices from devices_. 153 // Remove disconnected devices from devices_.
154 for (size_t i = 0; i < disconnected_devices.size(); ++i) { 154 for (size_t i = 0; i < disconnected_devices.size(); ++i) {
155 // UsbDevice will be destroyed after this. The corresponding 155 // UsbDevice will be destroyed after this. The corresponding
156 // PlatformUsbDevice will be unref'ed during this process. 156 // PlatformUsbDevice will be unref'ed during this process.
157 devices_.erase(disconnected_devices[i]); 157 devices_.erase(disconnected_devices[i]);
158 } 158 }
(...skipping 22 matching lines...) Expand all
181 } 181 }
182 return instance; 182 return instance;
183 } 183 }
184 184
185 // static 185 // static
186 void UsbService::SetInstanceForTest(UsbService* instance) { 186 void UsbService::SetInstanceForTest(UsbService* instance) {
187 g_usb_service_instance.Get().reset(instance); 187 g_usb_service_instance.Get().reset(instance);
188 } 188 }
189 189
190 } // namespace device 190 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/usb_device_handle_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698