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

Unified Diff: chrome/test/automation/automation_proxy.cc

Issue 8417054: Allow proxy channels to be created without initializing the underlying channel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 1 month 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 | « no previous file | ipc/ipc_channel_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/automation/automation_proxy.cc
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index ddcc267bd20da5f284d2f7be311fbc9406399e34..9788c29bc07a73c841b6cd70b5185c6828acbae9 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() {
« no previous file with comments | « no previous file | ipc/ipc_channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698