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

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

Issue 2423793002: Remove usage of FOR_EACH_OBSERVER macro in device/ (Closed)
Patch Set: rebase Created 4 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_device.h" 5 #include "device/usb/usb_device.h"
6 6
7 #include "base/guid.h" 7 #include "base/guid.h"
8 #include "device/usb/usb_device_handle.h" 8 #include "device/usb/usb_device_handle.h"
9 #include "device/usb/webusb_descriptors.h" 9 #include "device/usb/webusb_descriptors.h"
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 void UsbDevice::ActiveConfigurationChanged(int configuration_value) { 66 void UsbDevice::ActiveConfigurationChanged(int configuration_value) {
67 for (const auto& config : configurations_) { 67 for (const auto& config : configurations_) {
68 if (config.configuration_value == configuration_value) { 68 if (config.configuration_value == configuration_value) {
69 active_configuration_ = &config; 69 active_configuration_ = &config;
70 return; 70 return;
71 } 71 }
72 } 72 }
73 } 73 }
74 74
75 void UsbDevice::NotifyDeviceRemoved() { 75 void UsbDevice::NotifyDeviceRemoved() {
76 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceRemoved(this)); 76 for (auto& observer : observer_list_)
77 observer.OnDeviceRemoved(this);
77 } 78 }
78 79
79 void UsbDevice::OnDisconnect() { 80 void UsbDevice::OnDisconnect() {
80 // Swap out the handle list as HandleClosed() will try to modify it. 81 // Swap out the handle list as HandleClosed() will try to modify it.
81 std::list<UsbDeviceHandle*> handles; 82 std::list<UsbDeviceHandle*> handles;
82 handles.swap(handles_); 83 handles.swap(handles_);
83 for (auto* handle : handles_) 84 for (auto* handle : handles_)
84 handle->Close(); 85 handle->Close();
85 } 86 }
86 87
87 void UsbDevice::HandleClosed(UsbDeviceHandle* handle) { 88 void UsbDevice::HandleClosed(UsbDeviceHandle* handle) {
88 handles_.remove(handle); 89 handles_.remove(handle);
89 } 90 }
90 91
91 } // namespace device 92 } // namespace device
OLDNEW
« no previous file with comments | « device/media_transfer_protocol/media_transfer_protocol_manager.cc ('k') | device/usb/usb_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698