Index: base/files/file_path_watcher_win.cc |
diff --git a/base/files/file_path_watcher_win.cc b/base/files/file_path_watcher_win.cc |
index 98169ab56b79b1f27fd50f8cf06e243d5d64fae8..e4ed10fea9ae2405b6aed8bd5d07d81b228be9cf 100644 |
--- a/base/files/file_path_watcher_win.cc |
+++ b/base/files/file_path_watcher_win.cc |
@@ -12,6 +12,7 @@ |
#include "base/memory/ref_counted.h" |
#include "base/message_loop/message_loop_proxy.h" |
#include "base/profiler/scoped_profile.h" |
+#include "base/thread_task_runner_handle.h" |
#include "base/time/time.h" |
#include "base/win/object_watcher.h" |
@@ -92,7 +93,7 @@ bool FilePathWatcherImpl::Watch(const FilePath& path, |
const FilePathWatcher::Callback& callback) { |
DCHECK(target_.value().empty()); // Can only watch one path. |
- set_message_loop(MessageLoopProxy::current()); |
+ set_task_runner(ThreadTaskRunnerHandle::Get()); |
callback_ = callback; |
target_ = path; |
recursive_watch_ = recursive; |
@@ -120,17 +121,17 @@ void FilePathWatcherImpl::Cancel() { |
} |
// Switch to the file thread if necessary so we can stop |watcher_|. |
- if (!message_loop()->BelongsToCurrentThread()) { |
- message_loop()->PostTask(FROM_HERE, |
- Bind(&FilePathWatcher::CancelWatch, |
- make_scoped_refptr(this))); |
+ if (!task_runner()->RunsTasksOnCurrentThread()) { |
+ task_runner()->PostTask( |
+ FROM_HERE, |
+ Bind(&FilePathWatcher::CancelWatch, make_scoped_refptr(this))); |
} else { |
CancelOnMessageLoopThread(); |
} |
} |
void FilePathWatcherImpl::CancelOnMessageLoopThread() { |
- DCHECK(message_loop()->BelongsToCurrentThread()); |
+ DCHECK(task_runner()->RunsTasksOnCurrentThread()); |
set_cancelled(); |
if (handle_ != INVALID_HANDLE_VALUE) |