| 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 MessageLoop of TYPE_IO. | 8 // UdevLinux must be created on a MessageLoop of TYPE_IO. |
| 9 // UdevLinux is not thread-safe. | 9 // UdevLinux is not thread-safe. |
| 10 // | 10 // |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // base::Bind(&Foo::Notify, this))); | 21 // base::Bind(&Foo::Notify, this))); |
| 22 // } | 22 // } |
| 23 // | 23 // |
| 24 // // Called when a "block" device attaches/detaches. | 24 // // Called when a "block" device attaches/detaches. |
| 25 // // To hold on to |device|, call udev_device_ref(device). | 25 // // To hold on to |device|, call udev_device_ref(device). |
| 26 // void Notify(udev_device* device) { | 26 // void Notify(udev_device* device) { |
| 27 // // Do something with |device|. | 27 // // Do something with |device|. |
| 28 // } | 28 // } |
| 29 // | 29 // |
| 30 // private: | 30 // private: |
| 31 // scoped_ptr<UdevLinux> udev_; | 31 // std::unique_ptr<UdevLinux> udev_; |
| 32 // | 32 // |
| 33 // DISALLOW_COPY_AND_ASSIGN(Foo); | 33 // DISALLOW_COPY_AND_ASSIGN(Foo); |
| 34 // }; | 34 // }; |
| 35 | 35 |
| 36 #ifndef DEVICE_UDEV_LINUX_UDEV_LINUX_H_ | 36 #ifndef DEVICE_UDEV_LINUX_UDEV_LINUX_H_ |
| 37 #define DEVICE_UDEV_LINUX_UDEV_LINUX_H_ | 37 #define DEVICE_UDEV_LINUX_UDEV_LINUX_H_ |
| 38 | 38 |
| 39 #include <vector> | 39 #include <vector> |
| 40 | 40 |
| 41 #include "base/callback.h" | 41 #include "base/callback.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 int monitor_fd_; | 86 int monitor_fd_; |
| 87 base::MessagePumpLibevent::FileDescriptorWatcher monitor_watcher_; | 87 base::MessagePumpLibevent::FileDescriptorWatcher monitor_watcher_; |
| 88 const UdevNotificationCallback callback_; | 88 const UdevNotificationCallback callback_; |
| 89 | 89 |
| 90 DISALLOW_COPY_AND_ASSIGN(UdevLinux); | 90 DISALLOW_COPY_AND_ASSIGN(UdevLinux); |
| 91 }; | 91 }; |
| 92 | 92 |
| 93 } // namespace device | 93 } // namespace device |
| 94 | 94 |
| 95 #endif // DEVICE_UDEV_LINUX_UDEV_LINUX_H_ | 95 #endif // DEVICE_UDEV_LINUX_UDEV_LINUX_H_ |
| OLD | NEW |