| 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 // UdevLinux listens for device change notifications from udev and runs | 5 // UdevLinux listens for device change notifications from udev and runs |
| 6 // callbacks when notifications occur. | 6 // callbacks when notifications occur. |
| 7 // | 7 // |
| 8 // UdevLinux must be created on a thread that has instantiated a | 8 // UdevLinux must be created on a thread that has instantiated a |
| 9 // FileDescriptorWatcher. UdevLinux is not thread-safe. | 9 // FileDescriptorWatcher. UdevLinux is not thread-safe. |
| 10 // | 10 // |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 #include "base/callback.h" | 42 #include "base/callback.h" |
| 43 #include "base/compiler_specific.h" | 43 #include "base/compiler_specific.h" |
| 44 #include "base/files/file_descriptor_watcher_posix.h" | 44 #include "base/files/file_descriptor_watcher_posix.h" |
| 45 #include "base/macros.h" | 45 #include "base/macros.h" |
| 46 #include "device/udev_linux/scoped_udev.h" | 46 #include "device/udev_linux/scoped_udev.h" |
| 47 | 47 |
| 48 extern "C" { | 48 extern "C" { |
| 49 struct udev; | 49 struct udev; |
| 50 struct udev_device; | 50 struct udev_device; |
| 51 struct udev_monitor; | |
| 52 } | 51 } |
| 53 | 52 |
| 54 namespace device { | 53 namespace device { |
| 55 | 54 |
| 56 class UdevLinux { | 55 class UdevLinux { |
| 57 public: | 56 public: |
| 58 typedef base::Callback<void(udev_device*)> UdevNotificationCallback; | 57 typedef base::Callback<void(udev_device*)> UdevNotificationCallback; |
| 59 | 58 |
| 60 // subsystem and devtype parameter for | 59 // subsystem and devtype parameter for |
| 61 // udev_monitor_filter_add_match_subsystem_devtype(). | 60 // udev_monitor_filter_add_match_subsystem_devtype(). |
| (...skipping 25 matching lines...) Expand all Loading... |
| 87 std::unique_ptr<base::FileDescriptorWatcher::Controller> | 86 std::unique_ptr<base::FileDescriptorWatcher::Controller> |
| 88 monitor_watch_controller_; | 87 monitor_watch_controller_; |
| 89 const UdevNotificationCallback callback_; | 88 const UdevNotificationCallback callback_; |
| 90 | 89 |
| 91 DISALLOW_COPY_AND_ASSIGN(UdevLinux); | 90 DISALLOW_COPY_AND_ASSIGN(UdevLinux); |
| 92 }; | 91 }; |
| 93 | 92 |
| 94 } // namespace device | 93 } // namespace device |
| 95 | 94 |
| 96 #endif // DEVICE_UDEV_LINUX_UDEV_LINUX_H_ | 95 #endif // DEVICE_UDEV_LINUX_UDEV_LINUX_H_ |
| OLD | NEW |