Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2822)

Unified Diff: base/files/file_path_watcher_kqueue.h

Issue 2353103002: Use FileDescriptorWatcher in FilePathWatcherKQueue. (Closed)
Patch Set: fix windows build error Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/files/file_path_watcher_kqueue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « no previous file | base/files/file_path_watcher_kqueue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698