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

Unified Diff: ipc/ipc_sync_message_filter.cc

Issue 1127153003: ipc: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 7 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 | « ipc/ipc_sync_message_filter.h ('k') | ipc/ipc_test_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_sync_message_filter.cc
diff --git a/ipc/ipc_sync_message_filter.cc b/ipc/ipc_sync_message_filter.cc
index e2ea1bfb1ee51394f9d40c7ed79ea93e062c5d63..6a408ec12cf3b044f2426da46f659d640bec9e6d 100644
--- a/ipc/ipc_sync_message_filter.cc
+++ b/ipc/ipc_sync_message_filter.cc
@@ -7,33 +7,33 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
+#include "base/thread_task_runner_handle.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_sync_message.h"
-using base::MessageLoopProxy;
-
namespace IPC {
SyncMessageFilter::SyncMessageFilter(base::WaitableEvent* shutdown_event)
: sender_(NULL),
- listener_loop_(MessageLoopProxy::current()),
+ listener_task_runner_(base::ThreadTaskRunnerHandle::Get()),
shutdown_event_(shutdown_event) {
}
bool SyncMessageFilter::Send(Message* message) {
{
base::AutoLock auto_lock(lock_);
- if (!io_loop_.get()) {
+ if (!io_task_runner_.get()) {
delete message;
return false;
}
}
if (!message->is_sync()) {
- io_loop_->PostTask(
- FROM_HERE, base::Bind(&SyncMessageFilter::SendOnIOThread, this, message));
+ io_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&SyncMessageFilter::SendOnIOThread, this, message));
return true;
}
@@ -47,12 +47,14 @@ bool SyncMessageFilter::Send(Message* message) {
base::AutoLock auto_lock(lock_);
// Can't use this class on the main thread or else it can lead to deadlocks.
// Also by definition, can't use this on IO thread since we're blocking it.
- DCHECK(MessageLoopProxy::current().get() != listener_loop_.get());
- DCHECK(MessageLoopProxy::current().get() != io_loop_.get());
+ if (base::ThreadTaskRunnerHandle::IsSet()) {
+ DCHECK(base::ThreadTaskRunnerHandle::Get() != listener_task_runner_);
+ DCHECK(base::ThreadTaskRunnerHandle::Get() != io_task_runner_);
+ }
pending_sync_messages_.insert(&pending_message);
}
- io_loop_->PostTask(
+ io_task_runner_->PostTask(
FROM_HERE, base::Bind(&SyncMessageFilter::SendOnIOThread, this, message));
base::WaitableEvent* events[2] = { shutdown_event_, &done_event };
@@ -70,7 +72,7 @@ bool SyncMessageFilter::Send(Message* message) {
void SyncMessageFilter::OnFilterAdded(Sender* sender) {
sender_ = sender;
base::AutoLock auto_lock(lock_);
- io_loop_ = MessageLoopProxy::current();
+ io_task_runner_ = base::ThreadTaskRunnerHandle::Get();
}
void SyncMessageFilter::OnChannelError() {
« no previous file with comments | « ipc/ipc_sync_message_filter.h ('k') | ipc/ipc_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698