summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_channel_proxy.cc
diff options
context:
space:
mode:
authorkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-16 01:06:46 +0000
committerkkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-16 01:06:46 +0000
commit952394afc0a0dc5e3e6a1f3c2e1c0fa99b7b681f (patch)
tree85d8246efdada076c5dda1b0a561d6c3322f37d1 /ipc/ipc_channel_proxy.cc
parent8bbba87862f0ce45234380cebf60e3ded5d88147 (diff)
downloadchromium_src-952394afc0a0dc5e3e6a1f3c2e1c0fa99b7b681f.zip
chromium_src-952394afc0a0dc5e3e6a1f3c2e1c0fa99b7b681f.tar.gz
chromium_src-952394afc0a0dc5e3e6a1f3c2e1c0fa99b7b681f.tar.bz2
Allow proxy channels to be created without initializing the underlying channel.
This fixes a bug where a client needed to guarantee a message filter was in place before any messages were received. It also follows the style of not having constructors that do complex initialization. BUG=102894 TEST=none Review URL: http://codereview.chromium.org/8417054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110229 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_proxy.cc')
-rw-r--r--ipc/ipc_channel_proxy.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc
index 26d285a..fb365d6 100644
--- a/ipc/ipc_channel_proxy.cc
+++ b/ipc/ipc_channel_proxy.cc
@@ -285,18 +285,15 @@ ChannelProxy::ChannelProxy(const IPC::ChannelHandle& channel_handle,
Channel::Listener* listener,
base::MessageLoopProxy* ipc_thread)
: context_(new Context(listener, ipc_thread)),
- outgoing_message_filter_(NULL) {
- Init(channel_handle, mode, ipc_thread, true);
+ outgoing_message_filter_(NULL),
+ did_init_(false) {
+ Init(channel_handle, mode, true);
}
-ChannelProxy::ChannelProxy(const IPC::ChannelHandle& channel_handle,
- Channel::Mode mode,
- base::MessageLoopProxy* ipc_thread,
- Context* context,
- bool create_pipe_now)
+ChannelProxy::ChannelProxy(Context* context)
: context_(context),
- outgoing_message_filter_(NULL) {
- Init(channel_handle, mode, ipc_thread, create_pipe_now);
+ outgoing_message_filter_(NULL),
+ did_init_(false) {
}
ChannelProxy::~ChannelProxy() {
@@ -305,8 +302,8 @@ ChannelProxy::~ChannelProxy() {
void ChannelProxy::Init(const IPC::ChannelHandle& channel_handle,
Channel::Mode mode,
- base::MessageLoopProxy* ipc_thread_loop,
bool create_pipe_now) {
+ DCHECK(!did_init_);
#if defined(OS_POSIX)
// When we are creating a server on POSIX, we need its file descriptor
// to be created immediately so that it can be accessed and passed
@@ -332,6 +329,8 @@ void ChannelProxy::Init(const IPC::ChannelHandle& channel_handle,
// complete initialization on the background thread
context_->ipc_message_loop()->PostTask(
FROM_HERE, base::Bind(&Context::OnChannelOpened, context_.get()));
+
+ did_init_ = true;
}
void ChannelProxy::Close() {
@@ -347,6 +346,7 @@ void ChannelProxy::Close() {
}
bool ChannelProxy::Send(Message* message) {
+ DCHECK(did_init_);
if (outgoing_message_filter())
message = outgoing_message_filter()->Rewrite(message);