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

Unified Diff: base/files/file_path_watcher_win.cc

Issue 369703003: Reduce usage of MessageLoopProxy in base/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 2 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_linux.cc ('k') | base/files/important_file_writer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « base/files/file_path_watcher_linux.cc ('k') | base/files/important_file_writer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698