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::CreateNamedClient( |
55 channel_id, | 55 channel_id, |
56 IPC::Channel::MODE_NAMED_CLIENT, | |
57 this, | 56 this, |
58 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get())); | 57 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get())); |
59 } | 58 } |
60 | 59 |
61 void ServiceProcessControl::SetChannel(IPC::ChannelProxy* channel) { | 60 void ServiceProcessControl::SetChannel(scoped_ptr<IPC::ChannelProxy> channel) { |
62 channel_.reset(channel); | 61 channel_ = channel.Pass(); |
63 } | 62 } |
64 | 63 |
65 void ServiceProcessControl::RunConnectDoneTasks() { | 64 void ServiceProcessControl::RunConnectDoneTasks() { |
66 // The tasks executed here may add more tasks to the vector. So copy | 65 // 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 | 66 // them to the stack before executing them. This way recursion is |
68 // avoided. | 67 // avoided. |
69 TaskList tasks; | 68 TaskList tasks; |
70 | 69 |
71 if (IsConnected()) { | 70 if (IsConnected()) { |
72 tasks.swap(connect_success_tasks_); | 71 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_)) { | 427 if (base::LaunchProcess(*cmd_line_, options, &process_handle_)) { |
429 BrowserThread::PostTask( | 428 BrowserThread::PostTask( |
430 BrowserThread::IO, FROM_HERE, | 429 BrowserThread::IO, FROM_HERE, |
431 base::Bind(&Launcher::DoDetectLaunched, this)); | 430 base::Bind(&Launcher::DoDetectLaunched, this)); |
432 } else { | 431 } else { |
433 BrowserThread::PostTask( | 432 BrowserThread::PostTask( |
434 BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this)); | 433 BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this)); |
435 } | 434 } |
436 } | 435 } |
437 #endif // !OS_MACOSX | 436 #endif // !OS_MACOSX |
OLD | NEW |