Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: chrome/browser/service/service_process_control.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 launched_ = CheckServiceProcessReady(); 283 launched_ = CheckServiceProcessReady();
284 if (launched_ || (retry_count_ >= kMaxLaunchDetectRetries)) { 284 if (launched_ || (retry_count_ >= kMaxLaunchDetectRetries)) {
285 BrowserThread::PostTask( 285 BrowserThread::PostTask(
286 BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this)); 286 BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this));
287 return; 287 return;
288 } 288 }
289 retry_count_++; 289 retry_count_++;
290 290
291 // If the service process is not launched yet then check again in 2 seconds. 291 // If the service process is not launched yet then check again in 2 seconds.
292 const base::TimeDelta kDetectLaunchRetry = base::TimeDelta::FromSeconds(2); 292 const base::TimeDelta kDetectLaunchRetry = base::TimeDelta::FromSeconds(2);
293 MessageLoop::current()->PostDelayedTask( 293 base::MessageLoop::current()->PostDelayedTask(
294 FROM_HERE, base::Bind(&Launcher::DoDetectLaunched, this), 294 FROM_HERE, base::Bind(&Launcher::DoDetectLaunched, this),
295 kDetectLaunchRetry); 295 kDetectLaunchRetry);
296 } 296 }
297 297
298 void ServiceProcessControl::Launcher::DoRun() { 298 void ServiceProcessControl::Launcher::DoRun() {
299 DCHECK_EQ(false, notify_task_.is_null()); 299 DCHECK_EQ(false, notify_task_.is_null());
300 300
301 base::LaunchOptions options; 301 base::LaunchOptions options;
302 #if defined(OS_WIN) 302 #if defined(OS_WIN)
303 options.start_hidden = true; 303 options.start_hidden = true;
304 #endif 304 #endif
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698