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

Unified Diff: base/files/file_path_watcher_fsevents.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_browsertest.cc ('k') | base/files/file_path_watcher_kqueue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_path_watcher_fsevents.cc
diff --git a/base/files/file_path_watcher_fsevents.cc b/base/files/file_path_watcher_fsevents.cc
index f658efe742b43e325c441402cdc6931bfac41e2f..7385a8ba891d8d1bd5d2a2620cba6da88ec4274d 100644
--- a/base/files/file_path_watcher_fsevents.cc
+++ b/base/files/file_path_watcher_fsevents.cc
@@ -13,6 +13,8 @@
#include "base/mac/libdispatch_task_runner.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/message_loop/message_loop.h"
+#include "base/sequenced_task_runner.h"
+#include "base/thread_task_runner_handle.h"
namespace base {
@@ -118,14 +120,14 @@ FilePathWatcherFSEvents::FilePathWatcherFSEvents() : fsevent_stream_(NULL) {
void FilePathWatcherFSEvents::OnFilePathsChanged(
const std::vector<FilePath>& paths) {
- if (!message_loop()->BelongsToCurrentThread()) {
- message_loop()->PostTask(
+ if (!task_runner()->RunsTasksOnCurrentThread()) {
+ task_runner()->PostTask(
FROM_HERE,
Bind(&FilePathWatcherFSEvents::OnFilePathsChanged, this, paths));
return;
}
- DCHECK(message_loop()->BelongsToCurrentThread());
+ DCHECK(task_runner()->RunsTasksOnCurrentThread());
if (resolved_target_.empty())
return;
@@ -149,7 +151,7 @@ bool FilePathWatcherFSEvents::Watch(const FilePath& path,
if (!recursive)
return false;
- set_message_loop(MessageLoopProxy::current());
+ set_task_runner(ThreadTaskRunnerHandle::Get());
callback_ = callback;
target_ = path;
@@ -180,7 +182,7 @@ void FilePathWatcherFSEvents::Cancel() {
void FilePathWatcherFSEvents::CancelOnMessageLoopThread() {
// For all other implementations, the "message loop thread" is the IO thread,
- // as returned by message_loop(). This implementation, however, needs to
+ // as returned by task_runner(). This implementation, however, needs to
// cancel pending work on the Dipatch Queue thread.
DCHECK(g_task_runner.Get().RunsTasksOnCurrentThread());
@@ -231,7 +233,7 @@ void FilePathWatcherFSEvents::UpdateEventStream(
g_task_runner.Get().GetDispatchQueue());
if (!FSEventStreamStart(fsevent_stream_))
- message_loop()->PostTask(FROM_HERE, Bind(callback_, target_, true));
+ task_runner()->PostTask(FROM_HERE, Bind(callback_, target_, true));
}
bool FilePathWatcherFSEvents::ResolveTargetPath() {
@@ -240,7 +242,7 @@ bool FilePathWatcherFSEvents::ResolveTargetPath() {
bool changed = resolved != resolved_target_;
resolved_target_ = resolved;
if (resolved_target_.empty())
- message_loop()->PostTask(FROM_HERE, Bind(callback_, target_, true));
+ task_runner()->PostTask(FROM_HERE, Bind(callback_, target_, true));
return changed;
}
« no previous file with comments | « base/files/file_path_watcher_browsertest.cc ('k') | base/files/file_path_watcher_kqueue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698