Chromium Code Reviews| 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..e15cba7d34151f10816e17f08bbff09b55a5dd61 100644 |
| --- a/base/files/file_path_watcher_kqueue.cc |
| +++ b/base/files/file_path_watcher_kqueue.cc |
| @@ -11,6 +11,7 @@ |
| #include "base/files/file_util.h" |
| #include "base/logging.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 +328,7 @@ bool FilePathWatcherKQueue::Watch(const FilePath& path, |
| target_ = path; |
| MessageLoop::current()->AddDestructionObserver(this); |
| - io_message_loop_ = base::MessageLoopProxy::current(); |
| + io_task_runner_ = ThreadTaskRunnerHandle::Get(); |
|
danakj
2015/04/21 20:16:30
remind me.. is the destruction of the TaskRunnerHa
Sami
2015/04/23 17:48:24
Yes, both MLP and TTRH are cleared in the same pla
|
| kqueue_ = kqueue(); |
| if (kqueue_ == -1) { |
| @@ -356,14 +357,14 @@ bool FilePathWatcherKQueue::Watch(const FilePath& path, |
| } |
| void FilePathWatcherKQueue::Cancel() { |
| - base::MessageLoopProxy* proxy = io_message_loop_.get(); |
| - if (!proxy) { |
| + SingleThreadTaskRunner* 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->BelongsToCurrentThread()) { |
| + task_runner->PostTask(FROM_HERE, |
| + base::Bind(&FilePathWatcherKQueue::Cancel, this)); |
| return; |
| } |
| CancelOnMessageLoopThread(); |
| @@ -380,7 +381,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(); |
| } |