| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/service_process_control.h" | 5 #include "chrome/browser/service/service_process_control.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "base/thread.h" | 10 #include "base/thread.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 128 |
| 129 void ServiceProcessControl::Launch(Task* task) { | 129 void ServiceProcessControl::Launch(Task* task) { |
| 130 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 130 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 131 | 131 |
| 132 // If the service process is already running then connects to it. | 132 // If the service process is already running then connects to it. |
| 133 if (CheckServiceProcessRunning()) { | 133 if (CheckServiceProcessRunning()) { |
| 134 ConnectInternal(task); | 134 ConnectInternal(task); |
| 135 return; | 135 return; |
| 136 } | 136 } |
| 137 | 137 |
| 138 // Prevent quick calls to Launch in succession from causing a crash. |
| 139 // TODO(scottbyer) - ServiceProcessControl launch task callback code needs to |
| 140 // be enhanced to deal with this properly. See |
| 141 // http://code.google.com/p/chromium/issues/detail?id=58802 |
| 142 if (launcher_) { |
| 143 return; |
| 144 } |
| 145 |
| 138 // A service process should have a different mechanism for starting, but now | 146 // A service process should have a different mechanism for starting, but now |
| 139 // we start it as if it is a child process. | 147 // we start it as if it is a child process. |
| 140 FilePath exe_path = ChildProcessHost::GetChildPath(true); | 148 FilePath exe_path = ChildProcessHost::GetChildPath(true); |
| 141 if (exe_path.empty()) { | 149 if (exe_path.empty()) { |
| 142 NOTREACHED() << "Unable to get service process binary name."; | 150 NOTREACHED() << "Unable to get service process binary name."; |
| 143 } | 151 } |
| 144 | 152 |
| 145 CommandLine* cmd_line = new CommandLine(exe_path); | 153 CommandLine* cmd_line = new CommandLine(exe_path); |
| 146 cmd_line->AppendSwitchASCII(switches::kProcessType, | 154 cmd_line->AppendSwitchASCII(switches::kProcessType, |
| 147 switches::kServiceProcess); | 155 switches::kServiceProcess); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } | 270 } |
| 263 | 271 |
| 264 bool ServiceProcessControl::GetCloudPrintProxyStatus( | 272 bool ServiceProcessControl::GetCloudPrintProxyStatus( |
| 265 Callback2<bool, std::string>::Type* cloud_print_status_callback) { | 273 Callback2<bool, std::string>::Type* cloud_print_status_callback) { |
| 266 DCHECK(cloud_print_status_callback); | 274 DCHECK(cloud_print_status_callback); |
| 267 cloud_print_status_callback_.reset(cloud_print_status_callback); | 275 cloud_print_status_callback_.reset(cloud_print_status_callback); |
| 268 return Send(new ServiceMsg_IsCloudPrintProxyEnabled); | 276 return Send(new ServiceMsg_IsCloudPrintProxyEnabled); |
| 269 } | 277 } |
| 270 | 278 |
| 271 DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcessControl); | 279 DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcessControl); |
| OLD | NEW |