Skip to content

Commit

Permalink
Update cloud_print and chrome/service to use the new version of Launc…
Browse files Browse the repository at this point in the history
…hProcess.

BUG=417532

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

Cr-Commit-Position: refs/heads/master@{#308206}
  • Loading branch information
rvargas authored and Commit bot committed Dec 13, 2014
1 parent ac3c4b6 commit d7a1017
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,17 @@ IN_PROC_BROWSER_TEST_F(CloudPrintPolicyTest, NormalPassedFlag) {
chrome::NOTIFICATION_TAB_ADDED,
content::NotificationService::AllSources());

base::ProcessHandle handle;
bool launched =
base::LaunchProcess(new_command_line, base::LaunchOptionsForTest(),
&handle);
EXPECT_TRUE(launched);
base::Process process =
base::LaunchProcess(new_command_line, base::LaunchOptionsForTest());
EXPECT_TRUE(process.IsValid());

observer.Wait();

int exit_code = -100;
bool exited =
base::WaitForExitCodeWithTimeout(handle, &exit_code,
TestTimeouts::action_timeout());

bool exited = process.WaitForExitWithTimeout(TestTimeouts::action_timeout(),
&exit_code);
EXPECT_TRUE(exited);
EXPECT_EQ(chrome::RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED, exit_code);
base::CloseProcessHandle(handle);
}

// Disabled due to http://crbug.com/144393.
Expand All @@ -74,20 +69,15 @@ IN_PROC_BROWSER_TEST_F(CloudPrintPolicyTest, DISABLED_CloudPrintPolicyFlag) {
switches::kSpeculativeResourcePrefetching,
switches::kSpeculativeResourcePrefetchingDisabled);

base::ProcessHandle handle;
bool launched =
base::LaunchProcess(new_command_line, base::LaunchOptionsForTest(),
&handle);
EXPECT_TRUE(launched);
base::Process process =
base::LaunchProcess(new_command_line, base::LaunchOptionsForTest());
EXPECT_TRUE(process.IsValid());

int exit_code = -100;
bool exited =
base::WaitForExitCodeWithTimeout(handle, &exit_code,
TestTimeouts::action_timeout());

bool exited = process.WaitForExitWithTimeout(TestTimeouts::action_timeout(),
&exit_code);
EXPECT_TRUE(exited);
EXPECT_EQ(content::RESULT_CODE_NORMAL_EXIT, exit_code);
base::CloseProcessHandle(handle);
}

} // namespace
2 changes: 1 addition & 1 deletion chrome/service/cloud_print/cloud_print_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void LaunchBrowserProcessWithSwitch(const std::string& switch_string) {
#if defined(OS_WIN)
launch_options.force_breakaway_from_job_ = true;
#endif // OS_WIN
base::LaunchProcess(cmd_line, launch_options, NULL);
base::LaunchProcess(cmd_line, launch_options);
#endif
}

Expand Down
4 changes: 1 addition & 3 deletions chrome/service/service_utility_process_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,7 @@ bool ServiceUtilityProcessHost::Launch(base::CommandLine* cmd_line,
bool no_sandbox) {
if (no_sandbox) {
cmd_line->AppendSwitch(switches::kNoSandbox);
base::ProcessHandle handle;
if (base::LaunchProcess(*cmd_line, base::LaunchOptions(), &handle))
process_ = base::Process(handle);
process_ = base::LaunchProcess(*cmd_line, base::LaunchOptions());
} else {
ServiceSandboxedProcessLauncherDelegate delegate;
process_ = content::StartSandboxedProcess(&delegate, cmd_line);
Expand Down
3 changes: 1 addition & 2 deletions cloud_print/common/win/install_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,7 @@ void DeleteProgramDir(const std::string& delete_switch) {
base::CommandLine command_line(temp_path);
command_line.AppendSwitchPath(delete_switch, installer_source.DirName());
base::LaunchOptions options;
base::ProcessHandle process_handle;
if (!base::LaunchProcess(command_line, options, &process_handle)) {
if (!base::LaunchProcess(command_line, options).IsValid()) {
LOG(ERROR) << "Unable to launch child uninstall.";
}
}
Expand Down
2 changes: 1 addition & 1 deletion cloud_print/virtual_driver/win/install/setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void SpoolerServiceCommand(const char* command) {
options.wait = true;
options.start_hidden = true;
VLOG(0) << command_line.GetCommandLineString();
base::LaunchProcess(command_line, options, NULL);
base::LaunchProcess(command_line, options);
}

HRESULT RegisterPortMonitor(bool install, const base::FilePath& install_path) {
Expand Down
4 changes: 2 additions & 2 deletions cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ bool LaunchPrintDialog(const base::FilePath& xps_path,
command_line.AppendSwitchNative(switches::kCloudPrintJobTitle, job_title);
base::LaunchOptions options;
options.as_user = primary_token_scoped.Get();
base::LaunchProcess(command_line, options, NULL);
base::LaunchProcess(command_line, options);
return true;
}

Expand All @@ -255,7 +255,7 @@ void LaunchChromeDownloadPage() {

base::LaunchOptions options;
options.as_user = token_scoped.Get();
base::LaunchProcess(command_line, options, NULL);
base::LaunchProcess(command_line, options);
}

// Returns false if the print job is being run in a context
Expand Down

0 comments on commit d7a1017

Please sign in to comment.