Index: chrome/browser/service/service_process_control.cc |
diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc |
index 13a8a3e493a44cf3105e98532eaa4c79ac0afede..09bc1adfb736d65b36a8d462cd413e5e9e5c9817 100644 |
--- a/chrome/browser/service/service_process_control.cc |
+++ b/chrome/browser/service/service_process_control.cc |
@@ -122,20 +122,9 @@ 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, |
+ new IPC::SyncChannel(channel_id, IPC::Channel::MODE_NAMED_CLIENT, this, |
io_thread->message_loop(), true, |
g_browser_process->shutdown_event())); |
- channel_->set_sync_messages_with_no_timeout_allowed(false); |
- |
- // We just established a channel with the service process. Notify it if an |
- // upgrade is available. |
- if (UpgradeDetector::GetInstance()->notify_upgrade()) { |
- Send(new ServiceMsg_UpdateAvailable); |
- } else { |
- if (registrar_.IsEmpty()) |
- registrar_.Add(this, NotificationType::UPGRADE_RECOMMENDED, |
- NotificationService::AllSources()); |
- } |
} |
void ServiceProcessControl::RunConnectDoneTasks() { |
@@ -179,14 +168,14 @@ void ServiceProcessControl::Launch(Task* success_task, Task* failure_task) { |
if (failure_task) |
connect_failure_tasks_.push_back(failure_task); |
- // If the service process is already running then connects to it. |
- if (CheckServiceProcessReady()) { |
- ConnectInternal(); |
+ // If we already in the process of launching, then we are done. |
+ if (launcher_) { |
return; |
} |
- // If we already in the process of launching, then we are done. |
- if (launcher_) { |
+ // If the service process is already running then connects to it. |
+ if (CheckServiceProcessReady()) { |
+ ConnectInternal(); |
return; |
} |
@@ -255,6 +244,17 @@ bool ServiceProcessControl::OnMessageReceived(const IPC::Message& message) { |
void ServiceProcessControl::OnChannelConnected(int32 peer_pid) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ channel_->set_sync_messages_with_no_timeout_allowed(false); |
+ |
+ // We just established a channel with the service process. Notify it if an |
+ // upgrade is available. |
+ if (UpgradeDetector::GetInstance()->notify_upgrade()) { |
+ Send(new ServiceMsg_UpdateAvailable); |
+ } else { |
+ if (registrar_.IsEmpty()) |
+ registrar_.Add(this, NotificationType::UPGRADE_RECOMMENDED, |
+ NotificationService::AllSources()); |
+ } |
RunConnectDoneTasks(); |
} |