OLD | NEW |
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/hid/device_monitor_linux.h" | 5 #include "device/hid/device_monitor_linux.h" |
6 | 6 |
7 #include <libudev.h> | |
8 | |
9 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 8 #include "base/logging.h" |
11 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
| 10 #include "device/udev_linux/udev.h" |
12 | 11 |
13 namespace device { | 12 namespace device { |
14 | 13 |
15 namespace { | 14 namespace { |
16 | 15 |
17 const char kUdevName[] = "udev"; | 16 const char kUdevName[] = "udev"; |
18 const char kUdevActionAdd[] = "add"; | 17 const char kUdevActionAdd[] = "add"; |
19 const char kUdevActionRemove[] = "remove"; | 18 const char kUdevActionRemove[] = "remove"; |
20 | 19 |
21 // The instance will be reset when message loop destroys. | 20 // The instance will be reset when message loop destroys. |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 void DeviceMonitorLinux::OnFileCanWriteWithoutBlocking(int fd) {} | 140 void DeviceMonitorLinux::OnFileCanWriteWithoutBlocking(int fd) {} |
142 | 141 |
143 DeviceMonitorLinux::~DeviceMonitorLinux() { | 142 DeviceMonitorLinux::~DeviceMonitorLinux() { |
144 DCHECK(thread_checker_.CalledOnValidThread()); | 143 DCHECK(thread_checker_.CalledOnValidThread()); |
145 base::MessageLoop::current()->RemoveDestructionObserver(this); | 144 base::MessageLoop::current()->RemoveDestructionObserver(this); |
146 monitor_watcher_.StopWatchingFileDescriptor(); | 145 monitor_watcher_.StopWatchingFileDescriptor(); |
147 close(monitor_fd_); | 146 close(monitor_fd_); |
148 } | 147 } |
149 | 148 |
150 } // namespace device | 149 } // namespace device |
OLD | NEW |