| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "chrome/browser/service_process/service_process_control.h" | 5 #include "chrome/browser/service_process/service_process_control.h" | 
| 6 | 6 | 
| 7 #include "base/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" | 
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" | 
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 44   if (channel_.get()) { | 44   if (channel_.get()) { | 
| 45     RunConnectDoneTasks(); | 45     RunConnectDoneTasks(); | 
| 46     return; | 46     return; | 
| 47   } | 47   } | 
| 48 | 48 | 
| 49   // Actually going to connect. | 49   // Actually going to connect. | 
| 50   VLOG(1) << "Connecting to Service Process IPC Server"; | 50   VLOG(1) << "Connecting to Service Process IPC Server"; | 
| 51 | 51 | 
| 52   // TODO(hclam): Handle error connecting to channel. | 52   // TODO(hclam): Handle error connecting to channel. | 
| 53   const IPC::ChannelHandle channel_id = GetServiceProcessChannel(); | 53   const IPC::ChannelHandle channel_id = GetServiceProcessChannel(); | 
| 54   SetChannel(new IPC::ChannelProxy( | 54   SetChannel(IPC::ChannelProxy::Create( | 
| 55       channel_id, | 55       channel_id, | 
| 56       IPC::Channel::MODE_NAMED_CLIENT, | 56       IPC::Channel::MODE_NAMED_CLIENT, | 
| 57       this, | 57       this, | 
| 58       BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get())); | 58       BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get())); | 
| 59 } | 59 } | 
| 60 | 60 | 
| 61 void ServiceProcessControl::SetChannel(IPC::ChannelProxy* channel) { | 61 void ServiceProcessControl::SetChannel(scoped_ptr<IPC::ChannelProxy> channel) { | 
| 62   channel_.reset(channel); | 62   channel_ = channel.Pass(); | 
| 63 } | 63 } | 
| 64 | 64 | 
| 65 void ServiceProcessControl::RunConnectDoneTasks() { | 65 void ServiceProcessControl::RunConnectDoneTasks() { | 
| 66   // The tasks executed here may add more tasks to the vector. So copy | 66   // The tasks executed here may add more tasks to the vector. So copy | 
| 67   // them to the stack before executing them. This way recursion is | 67   // them to the stack before executing them. This way recursion is | 
| 68   // avoided. | 68   // avoided. | 
| 69   TaskList tasks; | 69   TaskList tasks; | 
| 70 | 70 | 
| 71   if (IsConnected()) { | 71   if (IsConnected()) { | 
| 72     tasks.swap(connect_success_tasks_); | 72     tasks.swap(connect_success_tasks_); | 
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 428   if (base::LaunchProcess(*cmd_line_, options, &process_handle_)) { | 428   if (base::LaunchProcess(*cmd_line_, options, &process_handle_)) { | 
| 429     BrowserThread::PostTask( | 429     BrowserThread::PostTask( | 
| 430         BrowserThread::IO, FROM_HERE, | 430         BrowserThread::IO, FROM_HERE, | 
| 431         base::Bind(&Launcher::DoDetectLaunched, this)); | 431         base::Bind(&Launcher::DoDetectLaunched, this)); | 
| 432   } else { | 432   } else { | 
| 433     BrowserThread::PostTask( | 433     BrowserThread::PostTask( | 
| 434         BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this)); | 434         BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this)); | 
| 435   } | 435   } | 
| 436 } | 436 } | 
| 437 #endif  // !OS_MACOSX | 437 #endif  // !OS_MACOSX | 
| OLD | NEW | 
|---|