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 "content/browser/udev_linux.h" | 5 #include "content/browser/udev_linux.h" |
6 | 6 |
7 #include <libudev.h> | 7 #include <libudev.h> |
8 | 8 |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 int ret = udev_monitor_filter_add_match_subsystem_devtype( | 25 int ret = udev_monitor_filter_add_match_subsystem_devtype( |
26 monitor_, filters[i].subsystem, filters[i].devtype); | 26 monitor_, filters[i].subsystem, filters[i].devtype); |
27 CHECK_EQ(0, ret); | 27 CHECK_EQ(0, ret); |
28 } | 28 } |
29 | 29 |
30 int ret = udev_monitor_enable_receiving(monitor_); | 30 int ret = udev_monitor_enable_receiving(monitor_); |
31 CHECK_EQ(0, ret); | 31 CHECK_EQ(0, ret); |
32 monitor_fd_ = udev_monitor_get_fd(monitor_); | 32 monitor_fd_ = udev_monitor_get_fd(monitor_); |
33 CHECK_GE(monitor_fd_, 0); | 33 CHECK_GE(monitor_fd_, 0); |
34 | 34 |
35 bool success = MessageLoopForIO::current()->WatchFileDescriptor(monitor_fd_, | 35 bool success = base::MessageLoopForIO::current()->WatchFileDescriptor( |
36 true, MessageLoopForIO::WATCH_READ, &monitor_watcher_, this); | 36 monitor_fd_, |
| 37 true, |
| 38 base::MessageLoopForIO::WATCH_READ, |
| 39 &monitor_watcher_, |
| 40 this); |
37 CHECK(success); | 41 CHECK(success); |
38 } | 42 } |
39 | 43 |
40 UdevLinux::~UdevLinux() { | 44 UdevLinux::~UdevLinux() { |
41 monitor_watcher_.StopWatchingFileDescriptor(); | 45 monitor_watcher_.StopWatchingFileDescriptor(); |
42 udev_monitor_unref(monitor_); | 46 udev_monitor_unref(monitor_); |
43 udev_unref(udev_); | 47 udev_unref(udev_); |
44 } | 48 } |
45 | 49 |
46 udev* UdevLinux::udev_handle() { | 50 udev* UdevLinux::udev_handle() { |
(...skipping 10 matching lines...) Expand all Loading... |
57 return; | 61 return; |
58 | 62 |
59 callback_.Run(dev); | 63 callback_.Run(dev); |
60 udev_device_unref(dev); | 64 udev_device_unref(dev); |
61 } | 65 } |
62 | 66 |
63 void UdevLinux::OnFileCanWriteWithoutBlocking(int fd) { | 67 void UdevLinux::OnFileCanWriteWithoutBlocking(int fd) { |
64 } | 68 } |
65 | 69 |
66 } // namespace content | 70 } // namespace content |
OLD | NEW |