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

Side by Side Diff: ui/events/ozone/device/udev/device_manager_udev.cc

Issue 2422073002: Reduce FOR_EACH_OBSERVER usage in ui/ (Closed)
Patch Set: remove space 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 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 "ui/events/ozone/device/udev/device_manager_udev.h" 5 #include "ui/events/ozone/device/udev/device_manager_udev.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 // to handle broken connections here. 141 // to handle broken connections here.
142 TRACE_EVENT1("evdev", "UdevDeviceChange", "socket", fd); 142 TRACE_EVENT1("evdev", "UdevDeviceChange", "socket", fd);
143 143
144 device::ScopedUdevDevicePtr device( 144 device::ScopedUdevDevicePtr device(
145 device::udev_monitor_receive_device(monitor_.get())); 145 device::udev_monitor_receive_device(monitor_.get()));
146 if (!device) 146 if (!device)
147 return; 147 return;
148 148
149 std::unique_ptr<DeviceEvent> event = ProcessMessage(device.get()); 149 std::unique_ptr<DeviceEvent> event = ProcessMessage(device.get());
150 if (event) 150 if (event)
151 FOR_EACH_OBSERVER( 151 for (DeviceEventObserver& observer : observers_)
152 DeviceEventObserver, observers_, OnDeviceEvent(*event.get())); 152 observer.OnDeviceEvent(*event.get());
153 } 153 }
154 154
155 void DeviceManagerUdev::OnFileCanWriteWithoutBlocking(int fd) { 155 void DeviceManagerUdev::OnFileCanWriteWithoutBlocking(int fd) {
156 NOTREACHED(); 156 NOTREACHED();
157 } 157 }
158 158
159 std::unique_ptr<DeviceEvent> DeviceManagerUdev::ProcessMessage( 159 std::unique_ptr<DeviceEvent> DeviceManagerUdev::ProcessMessage(
160 udev_device* device) { 160 udev_device* device) {
161 const char* path = device::udev_device_get_devnode(device); 161 const char* path = device::udev_device_get_devnode(device);
162 const char* action = device::udev_device_get_action(device); 162 const char* action = device::udev_device_get_action(device);
(...skipping 22 matching lines...) Expand all
185 else if (!strcmp(action, "change")) 185 else if (!strcmp(action, "change"))
186 action_type = DeviceEvent::CHANGE; 186 action_type = DeviceEvent::CHANGE;
187 else 187 else
188 return nullptr; 188 return nullptr;
189 189
190 return base::MakeUnique<DeviceEvent>(device_type, action_type, 190 return base::MakeUnique<DeviceEvent>(device_type, action_type,
191 base::FilePath(path)); 191 base::FilePath(path));
192 } 192 }
193 193
194 } // namespace ui 194 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/ozone/device/device_manager_manual.cc ('k') | ui/events/platform/platform_event_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698