diff options
author | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-16 01:06:46 +0000 |
---|---|---|
committer | kkania@chromium.org <kkania@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-16 01:06:46 +0000 |
commit | 952394afc0a0dc5e3e6a1f3c2e1c0fa99b7b681f (patch) | |
tree | 85d8246efdada076c5dda1b0a561d6c3322f37d1 /chrome | |
parent | 8bbba87862f0ce45234380cebf60e3ded5d88147 (diff) | |
download | chromium_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 'chrome')
-rw-r--r-- | chrome/test/automation/automation_proxy.cc | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc index ddcc267..9788c29 100644 --- a/chrome/test/automation/automation_proxy.cc +++ b/chrome/test/automation/automation_proxy.cc @@ -161,22 +161,21 @@ void AutomationProxy::InitializeChannel(const std::string& channel_id, // The shutdown event could be global on the same lines as the automation // provider, where we use the shutdown event provided by the chrome browser // process. - IPC::Channel::Mode mode = - use_named_interface ? IPC::Channel::MODE_NAMED_CLIENT - : IPC::Channel::MODE_SERVER; - // Create the pipe immediately if we are serving, so that Chrome doesn't try - // to connect an unready server. Create it asynchronously if we are the - // client, otherwise the filter may not be in place before Chrome sends - // the first automation Hello message. - bool create_pipe_now = mode & IPC::Channel::MODE_SERVER_FLAG; channel_.reset(new IPC::SyncChannel( - channel_id, - mode, - this, // we are the listener - thread_->message_loop_proxy(), - create_pipe_now, - shutdown_event_.get())); + this, // we are the listener + thread_->message_loop_proxy(), + shutdown_event_.get())); channel_->AddFilter(new AutomationMessageFilter(this)); + + // Create the pipe synchronously so that Chrome doesn't try to connect to an + // unready server. Note this is done after adding a message filter to + // guarantee that it doesn't miss any messages when we are the client. + // See crbug.com/102894. + channel_->Init( + channel_id, + use_named_interface ? IPC::Channel::MODE_NAMED_CLIENT + : IPC::Channel::MODE_SERVER, + true /* create_pipe_now */); } void AutomationProxy::InitializeHandleTracker() { |