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

Unified Diff: base/files/file_path_watcher_kqueue.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_kqueue.h ('k') | base/files/file_path_watcher_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/file_path_watcher_kqueue.cc
diff --git a/base/files/file_path_watcher_kqueue.cc b/base/files/file_path_watcher_kqueue.cc
index 8941d2e419f9a143ec20f4ff3c2a067b8dc0c72e..baba092474a33467fff20a5c3a5140fe45faa251 100644
--- a/base/files/file_path_watcher_kqueue.cc
+++ b/base/files/file_path_watcher_kqueue.cc
@@ -10,7 +10,9 @@
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/logging.h"
+#include "base/sequenced_task_runner.h"
#include "base/strings/stringprintf.h"
+#include "base/thread_task_runner_handle.h"
// On some platforms these are not defined.
#if !defined(EV_RECEIPT)
@@ -327,7 +329,7 @@ bool FilePathWatcherKQueue::Watch(const FilePath& path,
target_ = path;
MessageLoop::current()->AddDestructionObserver(this);
- io_message_loop_ = base::MessageLoopProxy::current();
+ io_task_runner_ = base::ThreadTaskRunnerHandle::Get();
kqueue_ = kqueue();
if (kqueue_ == -1) {
@@ -356,14 +358,14 @@ bool FilePathWatcherKQueue::Watch(const FilePath& path,
}
void FilePathWatcherKQueue::Cancel() {
- base::MessageLoopProxy* proxy = io_message_loop_.get();
- if (!proxy) {
+ base::SequencedTaskRunner* task_runner = io_task_runner_.get();
+ if (!task_runner) {
set_cancelled();
return;
}
- if (!proxy->BelongsToCurrentThread()) {
- proxy->PostTask(FROM_HERE,
- base::Bind(&FilePathWatcherKQueue::Cancel, this));
+ if (!task_runner->RunsTasksOnCurrentThread()) {
+ task_runner->PostTask(FROM_HERE,
+ base::Bind(&FilePathWatcherKQueue::Cancel, this));
return;
}
CancelOnMessageLoopThread();
@@ -380,7 +382,7 @@ void FilePathWatcherKQueue::CancelOnMessageLoopThread() {
kqueue_ = -1;
std::for_each(events_.begin(), events_.end(), ReleaseEvent);
events_.clear();
- io_message_loop_ = NULL;
+ io_task_runner_ = NULL;
MessageLoop::current()->RemoveDestructionObserver(this);
callback_.Reset();
}
« no previous file with comments | « base/files/file_path_watcher_kqueue.h ('k') | base/files/file_path_watcher_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698