summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 19:16:07 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 19:16:07 +0000
commit4b580bf3020b1e0eaf5b7efad50896b4c62474c5 (patch)
tree94f893bf3422dccda5e4bc05e4f8b8cca0d62638
parente669998f4edaa156aafbe2fb93b3e3dae1ebd06c (diff)
downloadchromium_src-4b580bf3020b1e0eaf5b7efad50896b4c62474c5.zip
chromium_src-4b580bf3020b1e0eaf5b7efad50896b4c62474c5.tar.gz
chromium_src-4b580bf3020b1e0eaf5b7efad50896b4c62474c5.tar.bz2
Add a base class for objects that want to filter messages on the IO thread. I'll switch the filters to it in future separate changes.
I've also taken out the special case for an initial filter from the IPC classes. The reason it existed was that there was a race condition of some messages not being filtered if a filter is added after construction but before launching the peer process. Taking it out allows us to add more than one filter and makes things a little cleaner. Review URL: http://codereview.chromium.org/5513001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68043 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/automation_provider.cc2
-rw-r--r--chrome/browser/browser_io_message_filter.cc36
-rw-r--r--chrome/browser/browser_io_message_filter.h37
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.cc36
-rw-r--r--chrome/browser/renderer_host/browser_render_process_host.h3
-rw-r--r--chrome/browser/service/service_process_control.cc2
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--chrome/common/child_thread.cc2
-rw-r--r--chrome/gpu/gpu_channel.cc2
-rw-r--r--chrome/plugin/plugin_channel_base.cc2
-rw-r--r--chrome/renderer/gpu_channel_host.cc2
-rw-r--r--chrome/service/service_ipc_server.cc2
-rw-r--r--chrome/test/automation/automation_proxy.cc2
-rw-r--r--ipc/ipc_channel_proxy.cc61
-rw-r--r--ipc/ipc_channel_proxy.h32
-rw-r--r--ipc/ipc_sync_channel.cc13
-rw-r--r--ipc/ipc_sync_channel.h9
-rw-r--r--ipc/ipc_sync_channel_unittest.cc2
-rw-r--r--ipc/ipc_tests.cc2
-rw-r--r--ppapi/proxy/dispatcher.cc2
20 files changed, 186 insertions, 65 deletions
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 3d5d214..f76a1f7 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -176,9 +176,9 @@ bool AutomationProvider::InitializeChannel(const std::string& channel_id) {
use_named_interface ? IPC::Channel::MODE_NAMED_SERVER
: IPC::Channel::MODE_CLIENT,
this,
- automation_resource_message_filter_,
g_browser_process->io_thread()->message_loop(),
true, g_browser_process->shutdown_event()));
+ channel_->AddFilter(automation_resource_message_filter_);
TRACE_EVENT_END("AutomationProvider::InitializeChannel", 0, "");
diff --git a/chrome/browser/browser_io_message_filter.cc b/chrome/browser/browser_io_message_filter.cc
new file mode 100644
index 0000000..1137dfe
--- /dev/null
+++ b/chrome/browser/browser_io_message_filter.cc
@@ -0,0 +1,36 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/browser_io_message_filter.h"
+
+#include "base/logging.h"
+#include "base/process_util.h"
+
+BrowserIOMessageFilter::BrowserIOMessageFilter() : channel_(NULL) {
+}
+
+BrowserIOMessageFilter::~BrowserIOMessageFilter() {
+}
+
+void BrowserIOMessageFilter::OnFilterAdded(IPC::Channel* channel) {
+ channel_ = channel;
+}
+
+void BrowserIOMessageFilter::OnChannelClosing() {
+ channel_ = NULL;
+}
+
+void BrowserIOMessageFilter::OnChannelConnected(int32 peer_pid) {
+ if (!base::OpenProcessHandle(peer_pid, &peer_handle_)) {
+ NOTREACHED();
+ }
+}
+
+bool BrowserIOMessageFilter::Send(IPC::Message* msg) {
+ if (channel_)
+ return channel_->Send(msg);
+
+ delete msg;
+ return false;
+}
diff --git a/chrome/browser/browser_io_message_filter.h b/chrome/browser/browser_io_message_filter.h
new file mode 100644
index 0000000..8063fa9
--- /dev/null
+++ b/chrome/browser/browser_io_message_filter.h
@@ -0,0 +1,37 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_BROWSER_IO_MESSAGE_FILTER_H_
+#define CHROME_BROWSER_BROWSER_IO_MESSAGE_FILTER_H_
+#pragma once
+
+#include "base/process.h"
+#include "ipc/ipc_channel_proxy.h"
+
+// Base class for message filters in the browser process that reside on the IO
+// thread.
+class BrowserIOMessageFilter : public IPC::ChannelProxy::MessageFilter,
+ public IPC::Message::Sender {
+ public:
+ BrowserIOMessageFilter();
+ virtual ~BrowserIOMessageFilter();
+
+ // IPC::ChannelProxy::MessageFilter methods. If you override them, make sure
+ // to call them as well.
+ virtual void OnFilterAdded(IPC::Channel* channel);
+ virtual void OnChannelClosing();
+ virtual void OnChannelConnected(int32 peer_pid);
+
+ // IPC::Message::Sender implementation:
+ virtual bool Send(IPC::Message* msg);
+
+ protected:
+ base::ProcessHandle peer_handle() { return peer_handle_; }
+
+ private:
+ IPC::Channel* channel_;
+ base::ProcessHandle peer_handle_;
+};
+
+#endif // CHROME_BROWSER_BROWSER_IO_MESSAGE_FILTER_H_
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index 7ac5429..e9c77a9 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -296,18 +296,6 @@ bool BrowserRenderProcessHost::Init(
// run the IPC channel on the shared IO thread.
base::Thread* io_thread = g_browser_process->io_thread();
- // Construct the AudioRendererHost with the IO thread.
- audio_renderer_host_ = new AudioRendererHost();
-
- scoped_refptr<ResourceMessageFilter> resource_message_filter(
- new ResourceMessageFilter(g_browser_process->resource_dispatcher_host(),
- id(),
- audio_renderer_host_.get(),
- PluginService::GetInstance(),
- g_browser_process->print_job_manager(),
- profile(),
- widget_helper_));
-
CommandLine::StringType renderer_prefix;
#if defined(OS_POSIX)
// A command prefix is something prepended to the command line of the spawned
@@ -329,7 +317,6 @@ bool BrowserRenderProcessHost::Init(
ChildProcessInfo::GenerateRandomChannelID(this);
channel_.reset(
new IPC::SyncChannel(channel_id, IPC::Channel::MODE_SERVER, this,
- resource_message_filter,
io_thread->message_loop(), true,
g_browser_process->shutdown_event()));
// As a preventive mesure, we DCHECK if someone sends a synchronous message
@@ -337,9 +324,7 @@ bool BrowserRenderProcessHost::Init(
// be doing.
channel_->set_sync_messages_with_no_timeout_allowed(false);
- scoped_refptr<PepperFileMessageFilter> pepper_file_message_filter(
- new PepperFileMessageFilter(id(), profile()));
- channel_->AddFilter(pepper_file_message_filter);
+ CreateMessageFilters();
if (run_renderer_in_process()) {
// Crank up a thread and run the initialization there. With the way that
@@ -391,6 +376,25 @@ bool BrowserRenderProcessHost::Init(
return true;
}
+void BrowserRenderProcessHost::CreateMessageFilters() {
+ // Construct the AudioRendererHost with the IO thread.
+ audio_renderer_host_ = new AudioRendererHost();
+
+ scoped_refptr<ResourceMessageFilter> resource_message_filter(
+ new ResourceMessageFilter(g_browser_process->resource_dispatcher_host(),
+ id(),
+ audio_renderer_host_.get(),
+ PluginService::GetInstance(),
+ g_browser_process->print_job_manager(),
+ profile(),
+ widget_helper_));
+ channel_->AddFilter(resource_message_filter);
+
+ scoped_refptr<PepperFileMessageFilter> pepper_file_message_filter(
+ new PepperFileMessageFilter(id(), profile()));
+ channel_->AddFilter(pepper_file_message_filter);
+}
+
int BrowserRenderProcessHost::GetNextRoutingID() {
return widget_helper_->GetNextRoutingID();
}
diff --git a/chrome/browser/renderer_host/browser_render_process_host.h b/chrome/browser/renderer_host/browser_render_process_host.h
index 2ca02e7..4852141 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.h
+++ b/chrome/browser/renderer_host/browser_render_process_host.h
@@ -105,6 +105,9 @@ class BrowserRenderProcessHost : public RenderProcessHost,
private:
friend class VisitRelayingRenderProcessHost;
+ // Creates and adds the IO thread message filters.
+ void CreateMessageFilters();
+
// Control message handlers.
void OnUpdatedCacheStats(const WebKit::WebCache::UsageStats& stats);
void SuddenTerminationChanged(bool enabled);
diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc
index 74efc36..fdeea6d 100644
--- a/chrome/browser/service/service_process_control.cc
+++ b/chrome/browser/service/service_process_control.cc
@@ -122,7 +122,7 @@ void ServiceProcessControl::ConnectInternal() {
// TODO(hclam): Handle error connecting to channel.
const std::string channel_id = GetServiceProcessChannelName();
channel_.reset(
- new IPC::SyncChannel(channel_id, IPC::Channel::MODE_CLIENT, this, NULL,
+ new IPC::SyncChannel(channel_id, IPC::Channel::MODE_CLIENT, this,
io_thread->message_loop(), true,
g_browser_process->shutdown_event()));
channel_->set_sync_messages_with_no_timeout_allowed(false);
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 6bfd17a..36cf2ce 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -302,6 +302,8 @@
'browser/browser_about_handler.h',
'browser/browser_child_process_host.cc',
'browser/browser_child_process_host.h',
+ 'browser/browser_io_message_filter.cc',
+ 'browser/browser_io_message_filter.h',
'browser/browser_main.cc',
'browser/browser_main_gtk.cc',
'browser/browser_main_gtk.h',
diff --git a/chrome/common/child_thread.cc b/chrome/common/child_thread.cc
index 8e6fbce..b59a559 100644
--- a/chrome/common/child_thread.cc
+++ b/chrome/common/child_thread.cc
@@ -43,7 +43,7 @@ void ChildThread::Init() {
}
channel_.reset(new IPC::SyncChannel(channel_name_,
- IPC::Channel::MODE_CLIENT, this, NULL,
+ IPC::Channel::MODE_CLIENT, this,
ChildProcess::current()->io_message_loop(), true,
ChildProcess::current()->GetShutDownEvent()));
#ifdef IPC_MESSAGE_LOG_ENABLED
diff --git a/chrome/gpu/gpu_channel.cc b/chrome/gpu/gpu_channel.cc
index 6d97a3d..0805316 100644
--- a/chrome/gpu/gpu_channel.cc
+++ b/chrome/gpu/gpu_channel.cc
@@ -255,7 +255,7 @@ bool GpuChannel::Init() {
IPC::AddChannelSocket(channel_name, gpu_fd);
#endif
channel_.reset(new IPC::SyncChannel(
- channel_name, IPC::Channel::MODE_SERVER, this, NULL,
+ channel_name, IPC::Channel::MODE_SERVER, this,
ChildProcess::current()->io_message_loop(), false,
ChildProcess::current()->GetShutDownEvent()));
diff --git a/chrome/plugin/plugin_channel_base.cc b/chrome/plugin/plugin_channel_base.cc
index dd1beb7..6494afb 100644
--- a/chrome/plugin/plugin_channel_base.cc
+++ b/chrome/plugin/plugin_channel_base.cc
@@ -115,7 +115,7 @@ NPObjectBase* PluginChannelBase::GetNPObjectListenerForRoute(int route_id) {
bool PluginChannelBase::Init(MessageLoop* ipc_message_loop,
bool create_pipe_now) {
channel_.reset(new IPC::SyncChannel(
- channel_name_, mode_, this, NULL, ipc_message_loop, create_pipe_now,
+ channel_name_, mode_, this, ipc_message_loop, create_pipe_now,
ChildProcess::current()->GetShutDownEvent()));
channel_valid_ = true;
return true;
diff --git a/chrome/renderer/gpu_channel_host.cc b/chrome/renderer/gpu_channel_host.cc
index 6ce8d7d..3d7faaf 100644
--- a/chrome/renderer/gpu_channel_host.cc
+++ b/chrome/renderer/gpu_channel_host.cc
@@ -19,7 +19,7 @@ GpuChannelHost::~GpuChannelHost() {
void GpuChannelHost::Connect(const std::string& channel_name) {
// Open a channel to the GPU process.
channel_.reset(new IPC::SyncChannel(
- channel_name, IPC::Channel::MODE_CLIENT, this, NULL,
+ channel_name, IPC::Channel::MODE_CLIENT, this,
ChildProcess::current()->io_message_loop(), true,
ChildProcess::current()->GetShutDownEvent()));
diff --git a/chrome/service/service_ipc_server.cc b/chrome/service/service_ipc_server.cc
index ae80d42..260c5a4 100644
--- a/chrome/service/service_ipc_server.cc
+++ b/chrome/service/service_ipc_server.cc
@@ -25,7 +25,7 @@ bool ServiceIPCServer::Init() {
void ServiceIPCServer::CreateChannel() {
channel_.reset(new IPC::SyncChannel(channel_name_,
- IPC::Channel::MODE_SERVER, this, NULL,
+ IPC::Channel::MODE_SERVER, this,
g_service_process->io_thread()->message_loop(), true,
g_service_process->shutdown_event()));
DCHECK(sync_message_filter_.get());
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index a33f095..cd5d9af 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -157,10 +157,10 @@ void AutomationProxy::InitializeChannel(const std::string& channel_id,
use_named_interface ? IPC::Channel::MODE_NAMED_CLIENT
: IPC::Channel::MODE_SERVER,
this, // we are the listener
- new AutomationMessageFilter(this),
thread_->message_loop(),
true,
shutdown_event_.get()));
+ channel_->AddFilter(new AutomationMessageFilter(this));
}
void AutomationProxy::InitializeHandleTracker() {
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc
index f05ae485..8450c28 100644
--- a/ipc/ipc_channel_proxy.cc
+++ b/ipc/ipc_channel_proxy.cc
@@ -61,7 +61,6 @@ void ChannelProxy::MessageFilter::OnDestruct() const {
//------------------------------------------------------------------------------
ChannelProxy::Context::Context(Channel::Listener* listener,
- MessageFilter* filter,
MessageLoop* ipc_message_loop)
: listener_message_loop_(MessageLoop::current()),
listener_(listener),
@@ -69,8 +68,6 @@ ChannelProxy::Context::Context(Channel::Listener* listener,
channel_(NULL),
peer_pid_(0),
channel_connected_called_(false) {
- if (filter)
- filters_.push_back(make_scoped_refptr(filter));
}
void ChannelProxy::Context::CreateChannel(const std::string& id,
@@ -118,6 +115,12 @@ void ChannelProxy::Context::OnMessageReceivedNoFilter(const Message& message) {
// Called on the IPC::Channel thread
void ChannelProxy::Context::OnChannelConnected(int32 peer_pid) {
+ // Add any pending filters. This avoids a race condition where someone
+ // creates a ChannelProxy, calls AddFilter, and then right after starts the
+ // peer process. The IO thread could receive a message before the task to add
+ // the filter is run on the IO thread.
+ OnAddFilter();
+
peer_pid_ = peer_pid;
for (size_t i = 0; i < filters_.size(); ++i)
filters_[i]->OnChannelConnected(peer_pid);
@@ -189,13 +192,24 @@ void ChannelProxy::Context::OnSendMessage(Message* message) {
}
// Called on the IPC::Channel thread
-void ChannelProxy::Context::OnAddFilter(MessageFilter* filter) {
- filters_.push_back(make_scoped_refptr(filter));
+void ChannelProxy::Context::OnAddFilter() {
+ std::vector<scoped_refptr<MessageFilter> > filters;
+ {
+ AutoLock auto_lock(pending_filters_lock_);
+ filters.swap(pending_filters_);
+ }
+
+ for (size_t i = 0; i < filters.size(); ++i) {
+ filters_.push_back(filters[i]);
- // If the channel has already been created, then we need to send this message
- // so that the filter gets access to the Channel.
- if (channel_)
- filter->OnFilterAdded(channel_);
+ // If the channel has already been created, then we need to send this
+ // message so that the filter gets access to the Channel.
+ if (channel_)
+ filters[i]->OnFilterAdded(channel_);
+ // Ditto for the peer process id.
+ if (peer_pid_)
+ filters[i]->OnChannelConnected(peer_pid_);
+ }
}
// Called on the IPC::Channel thread
@@ -212,6 +226,15 @@ void ChannelProxy::Context::OnRemoveFilter(MessageFilter* filter) {
}
// Called on the listener's thread
+void ChannelProxy::Context::AddFilter(MessageFilter* filter) {
+ AutoLock auto_lock(pending_filters_lock_);
+ pending_filters_.push_back(make_scoped_refptr(filter));
+ ipc_message_loop_->PostTask(
+ FROM_HERE,
+ NewRunnableMethod(this, &Context::OnAddFilter));
+}
+
+// Called on the listener's thread
void ChannelProxy::Context::OnDispatchMessage(const Message& message) {
if (!listener_)
return;
@@ -255,15 +278,18 @@ void ChannelProxy::Context::OnDispatchError() {
//-----------------------------------------------------------------------------
-ChannelProxy::ChannelProxy(const std::string& channel_id, Channel::Mode mode,
- Channel::Listener* listener, MessageFilter* filter,
+ChannelProxy::ChannelProxy(const std::string& channel_id,
+ Channel::Mode mode,
+ Channel::Listener* listener,
MessageLoop* ipc_thread)
- : context_(new Context(listener, filter, ipc_thread)) {
+ : context_(new Context(listener, ipc_thread)) {
Init(channel_id, mode, ipc_thread, true);
}
-ChannelProxy::ChannelProxy(const std::string& channel_id, Channel::Mode mode,
- MessageLoop* ipc_thread, Context* context,
+ChannelProxy::ChannelProxy(const std::string& channel_id,
+ Channel::Mode mode,
+ MessageLoop* ipc_thread,
+ Context* context,
bool create_pipe_now)
: context_(context) {
Init(channel_id, mode, ipc_thread, create_pipe_now);
@@ -314,12 +340,7 @@ bool ChannelProxy::Send(Message* message) {
}
void ChannelProxy::AddFilter(MessageFilter* filter) {
- context_->ipc_message_loop()->PostTask(
- FROM_HERE,
- NewRunnableMethod(
- context_.get(),
- &Context::OnAddFilter,
- make_scoped_refptr(filter)));
+ context_->AddFilter(filter);
}
void ChannelProxy::RemoveFilter(MessageFilter* filter) {
diff --git a/ipc/ipc_channel_proxy.h b/ipc/ipc_channel_proxy.h
index 53a39b4..a85841d 100644
--- a/ipc/ipc_channel_proxy.h
+++ b/ipc/ipc_channel_proxy.h
@@ -8,6 +8,7 @@
#include <vector>
+#include "base/lock.h"
#include "base/ref_counted.h"
#include "ipc/ipc_channel.h"
@@ -104,8 +105,9 @@ class ChannelProxy : public Message::Sender {
// on the background thread. Any message not handled by the filter will be
// dispatched to the listener. The given message loop indicates where the
// IPC::Channel should be created.
- ChannelProxy(const std::string& channel_id, Channel::Mode mode,
- Channel::Listener* listener, MessageFilter* filter,
+ ChannelProxy(const std::string& channel_id,
+ Channel::Mode mode,
+ Channel::Listener* listener,
MessageLoop* ipc_thread_loop);
virtual ~ChannelProxy();
@@ -129,6 +131,10 @@ class ChannelProxy : public Message::Sender {
// Ordinarily, messages sent to the ChannelProxy are routed to the matching
// listener on the worker thread. This API allows code to intercept messages
// before they are sent to the worker thread.
+ // If you call this before the target process is launched, then you're
+ // guaranteed to not miss any messages. But if you call this anytime after,
+ // then some messages might be missed since the filter is added internally on
+ // the IO thread.
void AddFilter(MessageFilter* filter);
void RemoveFilter(MessageFilter* filter);
@@ -147,16 +153,17 @@ class ChannelProxy : public Message::Sender {
// A subclass uses this constructor if it needs to add more information
// to the internal state. If create_pipe_now is true, the pipe is created
// immediately. Otherwise it's created on the IO thread.
- ChannelProxy(const std::string& channel_id, Channel::Mode mode,
- MessageLoop* ipc_thread_loop, Context* context,
+ ChannelProxy(const std::string& channel_id,
+ Channel::Mode mode,
+ MessageLoop* ipc_thread_loop,
+ Context* context,
bool create_pipe_now);
// Used internally to hold state that is referenced on the IPC thread.
class Context : public base::RefCountedThreadSafe<Context>,
public Channel::Listener {
public:
- Context(Channel::Listener* listener, MessageFilter* filter,
- MessageLoop* ipc_thread);
+ Context(Channel::Listener* listener, MessageLoop* ipc_thread);
void ClearIPCMessageLoop() { ipc_message_loop_ = NULL; }
MessageLoop* ipc_message_loop() const { return ipc_message_loop_; }
const std::string& channel_id() const { return channel_id_; }
@@ -196,10 +203,13 @@ class ChannelProxy : public Message::Sender {
// Create the Channel
void CreateChannel(const std::string& id, const Channel::Mode& mode);
- // Methods called via InvokeLater:
+ // Methods called on the IO thread.
void OnSendMessage(Message* message_ptr);
- void OnAddFilter(MessageFilter* filter);
+ void OnAddFilter();
void OnRemoveFilter(MessageFilter* filter);
+
+ // Methods called on the listener thread.
+ void AddFilter(MessageFilter* filter);
void OnDispatchConnected();
void OnDispatchError();
@@ -213,6 +223,12 @@ class ChannelProxy : public Message::Sender {
std::string channel_id_;
int peer_pid_;
bool channel_connected_called_;
+
+ // Holds filters between the AddFilter call on the listerner thread and the
+ // IPC thread when they're added to filters_.
+ std::vector<scoped_refptr<MessageFilter> > pending_filters_;
+ // Lock for pending_filters_.
+ Lock pending_filters_lock_;
};
Context* context() { return context_; }
diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc
index 8598c9c..e77846c 100644
--- a/ipc/ipc_sync_channel.cc
+++ b/ipc/ipc_sync_channel.cc
@@ -200,10 +200,9 @@ base::LazyInstance<base::ThreadLocalPointer<SyncChannel::ReceivedSyncMsgQueue> >
SyncChannel::SyncContext::SyncContext(
Channel::Listener* listener,
- MessageFilter* filter,
MessageLoop* ipc_thread,
WaitableEvent* shutdown_event)
- : ChannelProxy::Context(listener, filter, ipc_thread),
+ : ChannelProxy::Context(listener, ipc_thread),
received_sync_msgs_(ReceivedSyncMsgQueue::AddContext()),
shutdown_event_(shutdown_event) {
}
@@ -356,13 +355,15 @@ void SyncChannel::SyncContext::OnWaitableEventSignaled(WaitableEvent* event) {
SyncChannel::SyncChannel(
- const std::string& channel_id, Channel::Mode mode,
- Channel::Listener* listener, MessageFilter* filter,
- MessageLoop* ipc_message_loop, bool create_pipe_now,
+ const std::string& channel_id,
+ Channel::Mode mode,
+ Channel::Listener* listener,
+ MessageLoop* ipc_message_loop,
+ bool create_pipe_now,
WaitableEvent* shutdown_event)
: ChannelProxy(
channel_id, mode, ipc_message_loop,
- new SyncContext(listener, filter, ipc_message_loop, shutdown_event),
+ new SyncContext(listener, ipc_message_loop, shutdown_event),
create_pipe_now),
sync_messages_with_no_timeout_allowed_(true) {
// Ideally we only want to watch this object when running a nested message
diff --git a/ipc/ipc_sync_channel.h b/ipc/ipc_sync_channel.h
index 713b868..3435042 100644
--- a/ipc/ipc_sync_channel.h
+++ b/ipc/ipc_sync_channel.h
@@ -34,9 +34,11 @@ class MessageReplyDeserializer;
class SyncChannel : public ChannelProxy,
public base::WaitableEventWatcher::Delegate {
public:
- SyncChannel(const std::string& channel_id, Channel::Mode mode,
- Channel::Listener* listener, MessageFilter* filter,
- MessageLoop* ipc_message_loop, bool create_pipe_now,
+ SyncChannel(const std::string& channel_id,
+ Channel::Mode mode,
+ Channel::Listener* listener,
+ MessageLoop* ipc_message_loop,
+ bool create_pipe_now,
base::WaitableEvent* shutdown_event);
virtual ~SyncChannel();
@@ -59,7 +61,6 @@ class SyncChannel : public ChannelProxy,
public base::WaitableEventWatcher::Delegate {
public:
SyncContext(Channel::Listener* listener,
- MessageFilter* filter,
MessageLoop* ipc_thread,
base::WaitableEvent* shutdown_event);
diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc
index 15d5a38..bf21917 100644
--- a/ipc/ipc_sync_channel_unittest.cc
+++ b/ipc/ipc_sync_channel_unittest.cc
@@ -170,7 +170,7 @@ class Worker : public Channel::Listener, public Message::Sender {
// Link ipc_thread_, listener_thread_ and channel_ altogether.
StartThread(&ipc_thread_, MessageLoop::TYPE_IO);
channel_.reset(new SyncChannel(
- channel_name_, mode_, this, NULL, ipc_thread_.message_loop(), true,
+ channel_name_, mode_, this, ipc_thread_.message_loop(), true,
&shutdown_event_));
channel_created_->Signal();
Run();
diff --git a/ipc/ipc_tests.cc b/ipc/ipc_tests.cc
index aa30182..aee01f5 100644
--- a/ipc/ipc_tests.cc
+++ b/ipc/ipc_tests.cc
@@ -250,7 +250,7 @@ TEST_F(IPCChannelTest, ChannelProxyTest) {
{
// setup IPC channel proxy
IPC::ChannelProxy chan(kTestClientChannel, IPC::Channel::MODE_SERVER,
- &channel_listener, NULL, thread.message_loop());
+ &channel_listener, thread.message_loop());
channel_listener.Init(&chan);
diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc
index df7383f..d27fbda 100644
--- a/ppapi/proxy/dispatcher.cc
+++ b/ppapi/proxy/dispatcher.cc
@@ -79,7 +79,7 @@ bool Dispatcher::InitWithChannel(MessageLoop* ipc_message_loop,
base::WaitableEvent* shutdown_event) {
IPC::Channel::Mode mode = is_client ? IPC::Channel::MODE_CLIENT
: IPC::Channel::MODE_SERVER;
- channel_.reset(new IPC::SyncChannel(channel_name, mode, this, NULL,
+ channel_.reset(new IPC::SyncChannel(channel_name, mode, this,
ipc_message_loop, false, shutdown_event));
return true;
}