| 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());
|
|
|