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

Unified Diff: base/files/file_path_watcher_fsevents.cc

Issue 1100773004: base: Remove most uses of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added some missing includes. Created 5 years, 8 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.h ('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 ef4e6ee32eb412f3c51d70112a9d0d1824045aa0..da01c431bfe75e5323d2ce82531dc904ba3d0c95 100644
--- a/base/files/file_path_watcher_fsevents.cc
+++ b/base/files/file_path_watcher_fsevents.cc
@@ -13,6 +13,7 @@
#include "base/mac/libdispatch_task_runner.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/message_loop/message_loop.h"
+#include "base/thread_task_runner_handle.h"
namespace base {
@@ -92,7 +93,7 @@ bool FilePathWatcherFSEvents::Watch(const FilePath& path,
if (!recursive)
return false;
- set_message_loop(MessageLoopProxy::current());
+ set_task_runner(ThreadTaskRunnerHandle::Get());
callback_ = callback;
FSEventStreamEventId start_event = FSEventsGetCurrentEventId();
@@ -152,7 +153,7 @@ void FilePathWatcherFSEvents::FSEventsCallback(
}
FilePathWatcherFSEvents::~FilePathWatcherFSEvents() {
- // This method may be called on either the libdispatch or message_loop()
+ // This method may be called on either the libdispatch or task_runner()
// thread. Checking callback_ on the libdispatch thread here is safe because
// it is executing in a task posted by Cancel() which first reset callback_.
// PostTask forms a sufficient memory barrier to ensure that the value is
@@ -165,7 +166,7 @@ void FilePathWatcherFSEvents::OnFilePathsChanged(
const std::vector<FilePath>& paths) {
DCHECK(g_task_runner.Get().RunsTasksOnCurrentThread());
DCHECK(!resolved_target_.empty());
- message_loop()->PostTask(
+ task_runner()->PostTask(
FROM_HERE, Bind(&FilePathWatcherFSEvents::DispatchEvents, this, paths,
target_, resolved_target_));
}
@@ -173,7 +174,7 @@ void FilePathWatcherFSEvents::OnFilePathsChanged(
void FilePathWatcherFSEvents::DispatchEvents(const std::vector<FilePath>& paths,
const FilePath& target,
const FilePath& resolved_target) {
- DCHECK(message_loop()->RunsTasksOnCurrentThread());
+ DCHECK(task_runner()->RunsTasksOnCurrentThread());
// Don't issue callbacks after Cancel() has been called.
if (is_cancelled() || callback_.is_null()) {
@@ -190,7 +191,7 @@ void FilePathWatcherFSEvents::DispatchEvents(const std::vector<FilePath>& paths,
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 Dispatch Queue thread.
DCHECK(g_task_runner.Get().RunsTasksOnCurrentThread());
@@ -239,7 +240,7 @@ void FilePathWatcherFSEvents::UpdateEventStream(
g_task_runner.Get().GetDispatchQueue());
if (!FSEventStreamStart(fsevent_stream_)) {
- message_loop()->PostTask(
+ task_runner()->PostTask(
FROM_HERE, Bind(&FilePathWatcherFSEvents::ReportError, this, target_));
}
}
@@ -250,14 +251,14 @@ bool FilePathWatcherFSEvents::ResolveTargetPath() {
bool changed = resolved != resolved_target_;
resolved_target_ = resolved;
if (resolved_target_.empty()) {
- message_loop()->PostTask(
+ task_runner()->PostTask(
FROM_HERE, Bind(&FilePathWatcherFSEvents::ReportError, this, target_));
}
return changed;
}
void FilePathWatcherFSEvents::ReportError(const FilePath& target) {
- DCHECK(message_loop()->RunsTasksOnCurrentThread());
+ DCHECK(task_runner()->RunsTasksOnCurrentThread());
if (!callback_.is_null()) {
callback_.Run(target, true);
}
« no previous file with comments | « base/files/file_path_watcher.h ('k') | base/files/file_path_watcher_kqueue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698