Index: base/files/file_path_watcher_kqueue.h |
diff --git a/base/files/file_path_watcher_kqueue.h b/base/files/file_path_watcher_kqueue.h |
index 365cac538b10a6843013db80cf7ac749fce4e9df..53205dd7ea5ab9332047645c0ed289df11ba55b1 100644 |
--- a/base/files/file_path_watcher_kqueue.h |
+++ b/base/files/file_path_watcher_kqueue.h |
@@ -6,8 +6,11 @@ |
#define BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_ |
#include <sys/event.h> |
+ |
+#include <memory> |
#include <vector> |
+#include "base/files/file_descriptor_watcher_posix.h" |
#include "base/files/file_path.h" |
#include "base/files/file_path_watcher.h" |
#include "base/macros.h" |
@@ -28,15 +31,10 @@ namespace base { |
// files. It does however detect the attribute changes that the FSEvents impl |
// would miss. |
class FilePathWatcherKQueue : public FilePathWatcher::PlatformDelegate, |
- public MessageLoopForIO::Watcher, |
public MessageLoop::DestructionObserver { |
public: |
FilePathWatcherKQueue(); |
- // MessageLoopForIO::Watcher overrides. |
- void OnFileCanReadWithoutBlocking(int fd) override; |
- void OnFileCanWriteWithoutBlocking(int fd) override; |
- |
// MessageLoop::DestructionObserver overrides. |
void WillDestroyCurrentMessageLoop() override; |
@@ -60,6 +58,9 @@ class FilePathWatcherKQueue : public FilePathWatcher::PlatformDelegate, |
typedef std::vector<struct kevent> EventVector; |
+ // Called when data is available in |kqueue_|. |
+ void OnKQueueReadable(); |
+ |
// Can only be called on |io_task_runner_|'s thread. |
void CancelOnMessageLoopThread(); |
@@ -119,12 +120,14 @@ class FilePathWatcherKQueue : public FilePathWatcher::PlatformDelegate, |
} |
EventVector events_; |
- scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
- MessageLoopForIO::FileDescriptorWatcher kqueue_watcher_; |
FilePathWatcher::Callback callback_; |
FilePath target_; |
int kqueue_; |
+ // Throughout the lifetime of this, OnKQueueReadable() will be called when |
+ // data is available in |kqueue_|. |
+ std::unique_ptr<FileDescriptorWatcher::Controller> kqueue_watch_controller_; |
+ |
DISALLOW_COPY_AND_ASSIGN(FilePathWatcherKQueue); |
}; |