| 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/service_process_control.h" | 5 #include "chrome/browser/service/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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 93 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 94 | 94 |
| 95 base::Closure failure = failure_task; | 95 base::Closure failure = failure_task; |
| 96 if (!success_task.is_null()) | 96 if (!success_task.is_null()) |
| 97 connect_success_tasks_.push_back(success_task); | 97 connect_success_tasks_.push_back(success_task); |
| 98 | 98 |
| 99 if (!failure.is_null()) | 99 if (!failure.is_null()) |
| 100 connect_failure_tasks_.push_back(failure); | 100 connect_failure_tasks_.push_back(failure); |
| 101 | 101 |
| 102 // If we already in the process of launching, then we are done. | 102 // If we already in the process of launching, then we are done. |
| 103 if (launcher_) | 103 if (launcher_.get()) |
| 104 return; | 104 return; |
| 105 | 105 |
| 106 // If the service process is already running then connects to it. | 106 // If the service process is already running then connects to it. |
| 107 if (CheckServiceProcessReady()) { | 107 if (CheckServiceProcessReady()) { |
| 108 ConnectInternal(); | 108 ConnectInternal(); |
| 109 return; | 109 return; |
| 110 } | 110 } |
| 111 | 111 |
| 112 // A service process should have a different mechanism for starting, but now | 112 // A service process should have a different mechanism for starting, but now |
| 113 // we start it as if it is a child process. | 113 // we start it as if it is a child process. |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 if (base::LaunchProcess(*cmd_line_, options, NULL)) { | 305 if (base::LaunchProcess(*cmd_line_, options, NULL)) { |
| 306 BrowserThread::PostTask( | 306 BrowserThread::PostTask( |
| 307 BrowserThread::IO, FROM_HERE, | 307 BrowserThread::IO, FROM_HERE, |
| 308 base::Bind(&Launcher::DoDetectLaunched, this)); | 308 base::Bind(&Launcher::DoDetectLaunched, this)); |
| 309 } else { | 309 } else { |
| 310 BrowserThread::PostTask( | 310 BrowserThread::PostTask( |
| 311 BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this)); | 311 BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this)); |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 #endif // !OS_MACOSX | 314 #endif // !OS_MACOSX |
| OLD | NEW |