Chromium Code Reviews| Index: base/files/file_path_watcher_fsevents.h |
| diff --git a/base/files/file_path_watcher_fsevents.h b/base/files/file_path_watcher_fsevents.h |
| index 800c5b43f6879aa0d5d66eb1164f2f69edb3d5a8..b7339245c0098d2d77cb1011b6ff24eb4dc9c508 100644 |
| --- a/base/files/file_path_watcher_fsevents.h |
| +++ b/base/files/file_path_watcher_fsevents.h |
| @@ -24,9 +24,35 @@ class FilePathWatcherFSEvents : public FilePathWatcher::PlatformDelegate { |
| public: |
| FilePathWatcherFSEvents(); |
| - // Called from the FSEvents callback whenever there is a change to the paths. |
| + // FilePathWatcher::PlatformDelegate overrides. |
| + bool Watch(const FilePath& path, |
| + bool recursive, |
| + const FilePathWatcher::Callback& callback) override; |
| + void Cancel() override; |
| + |
| + private: |
| + static void FSEventsCallback(ConstFSEventStreamRef stream, |
| + void* event_watcher, |
| + size_t num_events, |
| + void* event_paths, |
| + const FSEventStreamEventFlags flags[], |
| + const FSEventStreamEventId event_ids[]); |
| + |
| + ~FilePathWatcherFSEvents() override; |
| + |
| + // Called from FSEventsCallback whenever there is a change to the paths. |
| void OnFilePathsChanged(const std::vector<FilePath>& paths); |
| + // Called on the message_loop() thread to dispatch path events. Can't access |
| + // target_ and resolved_target_ directly as those are modified on the |
| + // libdispatch thread. |
| + void DispatchEvents(const std::vector<FilePath>& paths, |
| + const FilePath& target, |
| + const FilePath& resolved_target); |
| + |
| + // Cleans up and stops the event stream. |
| + void CancelOnMessageLoopThread() override; |
| + |
| // (Re-)Initialize the event stream to start reporting events from |
| // |start_event|. |
| void UpdateEventStream(FSEventStreamEventId start_event); |
| @@ -35,23 +61,11 @@ class FilePathWatcherFSEvents : public FilePathWatcher::PlatformDelegate { |
| // last time it was done. |
| bool ResolveTargetPath(); |
| - // FilePathWatcher::PlatformDelegate overrides. |
| - bool Watch(const FilePath& path, |
| - bool recursive, |
| - const FilePathWatcher::Callback& callback) override; |
| - void Cancel() override; |
| - |
| - private: |
| - ~FilePathWatcherFSEvents() override; |
| - |
| // Destroy the event stream. |
| void DestroyEventStream(); |
| // Start watching the FSEventStream. |
| - void StartEventStream(FSEventStreamEventId start_event); |
| - |
| - // Cleans up and stops the event stream. |
| - void CancelOnMessageLoopThread() override; |
| + void StartEventStream(FSEventStreamEventId start_event, const FilePath& path); |
|
Mattias Nissler (ping if slow)
2015/04/07 11:36:21
Would still be good to add comments here to indica
|
| // Callback to notify upon changes. |
| FilePathWatcher::Callback callback_; |