Commit 19d2ebf9 authored by rvargas's avatar rvargas Committed by Commit bot

Update browser/service_process to use the new version of LaunchProcess.

BUG=417532

Review URL: https://codereview.chromium.org/785363002

Cr-Commit-Position: refs/heads/master@{#308203}
parent 75e8102f
......@@ -320,11 +320,10 @@ ServiceProcessControl* ServiceProcessControl::GetInstance() {
ServiceProcessControl::Launcher::Launcher(
ServiceProcessControl* process,
scoped_ptr<base::CommandLine> cmd_line)
: process_(process),
: process_control_(process),
cmd_line_(cmd_line.Pass()),
launched_(false),
retry_count_(0),
process_handle_(base::kNullProcessHandle) {
retry_count_(0) {
}
// Execute the command line to start the process asynchronously.
......@@ -338,7 +337,6 @@ void ServiceProcessControl::Launcher::Run(const base::Closure& task) {
}
ServiceProcessControl::Launcher::~Launcher() {
CloseProcessHandle();
}
......@@ -348,13 +346,6 @@ void ServiceProcessControl::Launcher::Notify() {
notify_task_.Reset();
}
void ServiceProcessControl::Launcher::CloseProcessHandle() {
if (process_handle_ != base::kNullProcessHandle) {
base::CloseProcessHandle(process_handle_);
process_handle_ = base::kNullProcessHandle;
}
}
#if !defined(OS_MACOSX)
void ServiceProcessControl::Launcher::DoDetectLaunched() {
DCHECK(!notify_task_.is_null());
......@@ -364,9 +355,8 @@ void ServiceProcessControl::Launcher::DoDetectLaunched() {
int exit_code = 0;
if (launched_ || (retry_count_ >= kMaxLaunchDetectRetries) ||
base::WaitForExitCodeWithTimeout(process_handle_, &exit_code,
base::TimeDelta())) {
CloseProcessHandle();
process_.WaitForExitWithTimeout(base::TimeDelta(), &exit_code)) {
process_.Close();
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, base::Bind(&Launcher::Notify, this));
return;
......@@ -387,7 +377,8 @@ void ServiceProcessControl::Launcher::DoRun() {
#if defined(OS_WIN)
options.start_hidden = true;
#endif
if (base::LaunchProcess(*cmd_line_, options, &process_handle_)) {
process_ = base::LaunchProcess(*cmd_line_, options);
if (process_.IsValid()) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(&Launcher::DoDetectLaunched, this));
......
......@@ -164,13 +164,12 @@ class ServiceProcessControl : public IPC::Sender,
void DoRun();
void Notify();
void CloseProcessHandle();
ServiceProcessControl* process_;
ServiceProcessControl* process_control_;
scoped_ptr<base::CommandLine> cmd_line_;
base::Closure notify_task_;
bool launched_;
uint32 retry_count_;
base::ProcessHandle process_handle_;
base::Process process_;
};
friend class MockServiceProcessControl;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment