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

Unified Diff: base/files/file_path_watcher_linux.cc

Issue 2308413002: Only update watches when directories change. (Closed)
Patch Set: 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..cabb034d6145e27702aebdba92c15ffbddd12b09 100644
--- a/base/files/file_path_watcher_linux.cc
+++ b/base/files/file_path_watcher_linux.cc
@@ -10,6 +10,7 @@
#include <sys/inotify.h>
#include <sys/ioctl.h>
#include <sys/select.h>
+#include <sys/stat.h>
#include <unistd.h>
#include <algorithm>
@@ -34,6 +35,7 @@
#include "base/synchronization/lock.h"
#include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h"
+#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
namespace base {
@@ -403,7 +405,10 @@ void FilePathWatcherImpl::OnFilePathChanged(InotifyReader::Watch fired_watch,
if (target_changed ||
(change_on_target_path && deleted) ||
(change_on_target_path && created && PathExists(target_))) {
- if (!did_update) {
+ struct stat child_stat;
+ stat(target_.Append(watch_entry.subdir).Append(child).value().c_str(),
+ &child_stat);
+ if (!did_update && S_ISDIR(child_stat.st_mode)) {
UpdateRecursiveWatches(fired_watch, is_dir);
did_update = true;
}
« 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