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

Unified Diff: base/files/file_path_watcher_linux.cc

Issue 2308413002: Only update watches when directories change. (Closed)
Patch Set: rebase 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_path_watcher_linux.cc
diff --git a/base/files/file_path_watcher_linux.cc b/base/files/file_path_watcher_linux.cc
index 2444b4453db2ce76c3745c1ec686efd991f29397..90164c3374f59dada2402f7e2d0f954718894400 100644
--- a/base/files/file_path_watcher_linux.cc
+++ b/base/files/file_path_watcher_linux.cc
@@ -521,6 +521,10 @@ void FilePathWatcherImpl::UpdateRecursiveWatches(
return;
}
+ // Underneath |target_|, only directory changes trigger watch updates.
+ if (!is_dir && fired_watch != InotifyReader::kInvalidWatch)
+ return;
+
// Check to see if this is a forced update or if some component of |target_|
// has changed. For these cases, redo the watches for |target_| and below.
if (!ContainsKey(recursive_paths_by_watch_, fired_watch)) {
Shuhei Takahashi 2016/09/08 05:10:52 Hmm, reordering the checks is fragile and I'm afra
dspaid 2016/09/09 02:00:55 Done.
@@ -528,10 +532,6 @@ void FilePathWatcherImpl::UpdateRecursiveWatches(
return;
}
- // Underneath |target_|, only directory changes trigger watch updates.
- if (!is_dir)
- return;
-
const FilePath& changed_dir = recursive_paths_by_watch_[fired_watch];
std::map<FilePath, InotifyReader::Watch>::iterator start_it =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698