| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 launched_ = CheckServiceProcessReady(); | 279 launched_ = CheckServiceProcessReady(); |
| 280 if (launched_ || (retry_count_ >= kMaxLaunchDetectRetries)) { | 280 if (launched_ || (retry_count_ >= kMaxLaunchDetectRetries)) { |
| 281 BrowserThread::PostTask( | 281 BrowserThread::PostTask( |
| 282 BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this)); | 282 BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this)); |
| 283 return; | 283 return; |
| 284 } | 284 } |
| 285 retry_count_++; | 285 retry_count_++; |
| 286 | 286 |
| 287 // If the service process is not launched yet then check again in 2 seconds. | 287 // If the service process is not launched yet then check again in 2 seconds. |
| 288 const base::TimeDelta kDetectLaunchRetry = base::TimeDelta::FromSeconds(2); | 288 const base::TimeDelta kDetectLaunchRetry = base::TimeDelta::FromSeconds(2); |
| 289 MessageLoop::current()->PostDelayedTask( | 289 base::MessageLoop::current()->PostDelayedTask( |
| 290 FROM_HERE, base::Bind(&Launcher::DoDetectLaunched, this), | 290 FROM_HERE, |
| 291 base::Bind(&Launcher::DoDetectLaunched, this), |
| 291 kDetectLaunchRetry); | 292 kDetectLaunchRetry); |
| 292 } | 293 } |
| 293 | 294 |
| 294 void ServiceProcessControl::Launcher::DoRun() { | 295 void ServiceProcessControl::Launcher::DoRun() { |
| 295 DCHECK_EQ(false, notify_task_.is_null()); | 296 DCHECK_EQ(false, notify_task_.is_null()); |
| 296 | 297 |
| 297 base::LaunchOptions options; | 298 base::LaunchOptions options; |
| 298 #if defined(OS_WIN) | 299 #if defined(OS_WIN) |
| 299 options.start_hidden = true; | 300 options.start_hidden = true; |
| 300 #endif | 301 #endif |
| 301 if (base::LaunchProcess(*cmd_line_, options, NULL)) { | 302 if (base::LaunchProcess(*cmd_line_, options, NULL)) { |
| 302 BrowserThread::PostTask( | 303 BrowserThread::PostTask( |
| 303 BrowserThread::IO, FROM_HERE, | 304 BrowserThread::IO, FROM_HERE, |
| 304 base::Bind(&Launcher::DoDetectLaunched, this)); | 305 base::Bind(&Launcher::DoDetectLaunched, this)); |
| 305 } else { | 306 } else { |
| 306 BrowserThread::PostTask( | 307 BrowserThread::PostTask( |
| 307 BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this)); | 308 BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this)); |
| 308 } | 309 } |
| 309 } | 310 } |
| 310 #endif // !OS_MACOSX | 311 #endif // !OS_MACOSX |
| OLD | NEW |