Lines Matching refs:watch
44 typedef int Watch; // Watch descriptor used by AddWatch and RemoveWatch.
45 static const Watch kInvalidWatch = -1;
47 // Watch directory |path| for changes. |watcher| will be notified on each
49 Watch AddWatch(const FilePath& path, FilePathWatcherImpl* watcher);
51 // Remove |watch|. Returns true on success.
52 bool RemoveWatch(Watch watch, FilePathWatcherImpl* watcher);
66 base::hash_map<Watch, WatcherSet> watchers_;
91 // Called for each event coming from the watch. |fired_watch| identifies the
92 // watch that fired, |child| indicates what has changed, and is relative to
96 void OnFilePathChanged(InotifyReader::Watch fired_watch,
102 // Returns true if watch for |path| has been added successfully.
103 virtual bool Watch(const FilePath& path,
106 // Cancel the watch. This unregisters the instance with InotifyReader.
121 // WatchEntry instance holds the watch descriptor for a component and the
124 WatchEntry(InotifyReader::Watch watch, const FilePath::StringType& subdir)
125 : watch_(watch),
128 InotifyReader::Watch watch_;
133 // Reconfigure to watch for the most specific parent directory of |target_|
140 // The file or directory we're supposed to watch.
144 // starting at the root directory. The last entry corresponds to the watch for
250 InotifyReader::Watch InotifyReader::AddWatch(
257 Watch watch = inotify_add_watch(inotify_fd_, path.value().c_str(),
262 if (watch == kInvalidWatch)
265 watchers_[watch].insert(watcher);
267 return watch;
270 bool InotifyReader::RemoveWatch(Watch watch,
277 watchers_[watch].erase(watcher);
279 if (watchers_[watch].empty()) {
280 watchers_.erase(watch);
281 return (inotify_rm_watch(inotify_fd_, watch) == 0);
309 InotifyReader::Watch fired_watch,
335 // If this notification is from a previous generation of watches or the watch
368 bool FilePathWatcherImpl::Watch(const FilePath& path,
392 // Watch was never called, or the |message_loop_| thread is already gone.
436 InotifyReader::Watch old_watch = watch_entry->watch_;