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

Unified Diff: base/files/file_path_watcher_linux.cc

Issue 2372513005: Remove FilePathWatcher::PlatformDelegate::CancelOnMessageLoopThread(). (Closed)
Patch Set: self-review 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 | « base/files/file_path_watcher_kqueue.h ('k') | base/files/file_path_watcher_mac.cc » ('j') | 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 9d501698b692c3c9bf2f152567720526395c4fe8..958e60cb9d6857cf3f6ff2b09237960d720fe2a3 100644
--- a/base/files/file_path_watcher_linux.cc
+++ b/base/files/file_path_watcher_linux.cc
@@ -120,7 +120,6 @@ class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate {
// Cancel the watch. This unregisters the instance with InotifyReader.
void Cancel() override;
- void CancelOnMessageLoopThread() override;
void CancelOnMessageLoopThreadOrInDestructor();
// Inotify watches are installed for all directory components of |target_|.
@@ -329,8 +328,8 @@ void FilePathWatcherImpl::OnFilePathChanged(InotifyReader::Watch fired_watch,
return;
}
- // Check to see if CancelOnMessageLoopThread() has already been called.
- // May happen when code flow reaches here from the PostTask() above.
+ // Check to see if CancelOnMessageLoopThreadOrInDestructor() has already been
+ // called. May happen when code flow reaches here from the PostTask() above.
if (watches_.empty()) {
DCHECK(target_.empty());
return;
@@ -445,19 +444,17 @@ void FilePathWatcherImpl::Cancel() {
return;
}
- // Switch to the message_loop() if necessary so we can access |watches_|.
+ // Switch to the task_runner() if necessary so we can access |watches_|.
if (!task_runner()->BelongsToCurrentThread()) {
- task_runner()->PostTask(FROM_HERE, Bind(&FilePathWatcher::CancelWatch,
- make_scoped_refptr(this)));
+ task_runner()->PostTask(
+ FROM_HERE,
+ Bind(&FilePathWatcherImpl::CancelOnMessageLoopThreadOrInDestructor,
+ this));
} else {
- CancelOnMessageLoopThread();
+ CancelOnMessageLoopThreadOrInDestructor();
}
}
-void FilePathWatcherImpl::CancelOnMessageLoopThread() {
- CancelOnMessageLoopThreadOrInDestructor();
-}
-
void FilePathWatcherImpl::CancelOnMessageLoopThreadOrInDestructor() {
DCHECK(in_destructor_ || task_runner()->BelongsToCurrentThread());
@@ -479,7 +476,7 @@ void FilePathWatcherImpl::CancelOnMessageLoopThreadOrInDestructor() {
}
void FilePathWatcherImpl::UpdateWatches() {
- // Ensure this runs on the message_loop() exclusively in order to avoid
+ // Ensure this runs on the task_runner() exclusively in order to avoid
// concurrency issues.
DCHECK(task_runner()->BelongsToCurrentThread());
DCHECK(HasValidWatchVector());
« no previous file with comments | « base/files/file_path_watcher_kqueue.h ('k') | base/files/file_path_watcher_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698