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

Side by Side Diff: base/files/file_path_watcher_fsevents.h

Issue 2123333003: Remove base::mac::LibDispatchTaskRunner and migrate its sole client to plain libdispatch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak comments Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef BASE_FILES_FILE_PATH_WATCHER_FSEVENTS_H_ 5 #ifndef BASE_FILES_FILE_PATH_WATCHER_FSEVENTS_H_
6 #define BASE_FILES_FILE_PATH_WATCHER_FSEVENTS_H_ 6 #define BASE_FILES_FILE_PATH_WATCHER_FSEVENTS_H_
7 7
8 #include <CoreServices/CoreServices.h> 8 #include <CoreServices/CoreServices.h>
9 #include <stddef.h> 9 #include <stddef.h>
10 10
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/file_path_watcher.h" 14 #include "base/files/file_path_watcher.h"
15 #include "base/mac/scoped_dispatch_object.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 17
17 namespace base { 18 namespace base {
18 19
19 // Mac-specific file watcher implementation based on FSEvents. 20 // Mac-specific file watcher implementation based on FSEvents.
20 // There are trade-offs between the FSEvents implementation and a kqueue 21 // There are trade-offs between the FSEvents implementation and a kqueue
21 // implementation. The biggest issues are that FSEvents on 10.6 sometimes drops 22 // implementation. The biggest issues are that FSEvents on 10.6 sometimes drops
22 // events and kqueue does not trigger for modifications to a file in a watched 23 // events and kqueue does not trigger for modifications to a file in a watched
23 // directory. See file_path_watcher_mac.cc for the code that decides when to 24 // directory. See file_path_watcher_mac.cc for the code that decides when to
24 // use which one. 25 // use which one.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // Destroy the event stream. 70 // Destroy the event stream.
70 void DestroyEventStream(); 71 void DestroyEventStream();
71 72
72 // Start watching the FSEventStream. 73 // Start watching the FSEventStream.
73 void StartEventStream(FSEventStreamEventId start_event, const FilePath& path); 74 void StartEventStream(FSEventStreamEventId start_event, const FilePath& path);
74 75
75 // Callback to notify upon changes. 76 // Callback to notify upon changes.
76 // (Only accessed from the message_loop() thread.) 77 // (Only accessed from the message_loop() thread.)
77 FilePathWatcher::Callback callback_; 78 FilePathWatcher::Callback callback_;
78 79
80 // The dispatch queue on which the the event stream is scheduled.
81 ScopedDispatchObject<dispatch_queue_t> queue_;
82
79 // Target path to watch (passed to callback). 83 // Target path to watch (passed to callback).
80 // (Only accessed from the libdispatch thread.) 84 // (Only accessed from the libdispatch queue.)
81 FilePath target_; 85 FilePath target_;
82 86
83 // Target path with all symbolic links resolved. 87 // Target path with all symbolic links resolved.
84 // (Only accessed from the libdispatch thread.) 88 // (Only accessed from the libdispatch queue.)
85 FilePath resolved_target_; 89 FilePath resolved_target_;
86 90
87 // Backend stream we receive event callbacks from (strong reference). 91 // Backend stream we receive event callbacks from (strong reference).
88 // (Only accessed from the libdispatch thread.) 92 // (Only accessed from the libdispatch queue.)
89 FSEventStreamRef fsevent_stream_; 93 FSEventStreamRef fsevent_stream_;
90 94
91 DISALLOW_COPY_AND_ASSIGN(FilePathWatcherFSEvents); 95 DISALLOW_COPY_AND_ASSIGN(FilePathWatcherFSEvents);
92 }; 96 };
93 97
94 } // namespace base 98 } // namespace base
95 99
96 #endif // BASE_FILES_FILE_PATH_WATCHER_FSEVENTS_H_ 100 #endif // BASE_FILES_FILE_PATH_WATCHER_FSEVENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698