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

Unified Diff: content/browser/utility_process_host_impl.cc

Issue 2585963002: Clarifying the parameters ownership of BrowserChildProcessHost::Launch() (Closed)
Patch Set: Fixed crasher on Windows. Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/utility_process_host_impl.cc
diff --git a/content/browser/utility_process_host_impl.cc b/content/browser/utility_process_host_impl.cc
index 70bb8c0c5bccf5dd88a3c5c53d71a86aad9de503..4d5042179f917ae87cccacdee9879a232dcf9024 100644
--- a/content/browser/utility_process_host_impl.cc
+++ b/content/browser/utility_process_host_impl.cc
@@ -274,8 +274,8 @@ bool UtilityProcessHostImpl::StartProcess() {
// readlink("/prof/self/exe") sometimes fails on Android at startup.
// As a workaround skip calling it here, since the executable name is
// not needed on Android anyway. See crbug.com/500854.
- base::CommandLine* cmd_line =
- new base::CommandLine(base::CommandLine::NO_PROGRAM);
+ std::unique_ptr<base::CommandLine> cmd_line =
+ base::MakeUnique<base::CommandLine>(base::CommandLine::NO_PROGRAM);
#else
int child_flags = child_flags_;
@@ -293,7 +293,8 @@ bool UtilityProcessHostImpl::StartProcess() {
return false;
}
- base::CommandLine* cmd_line = new base::CommandLine(exe_path);
+ std::unique_ptr<base::CommandLine> cmd_line =
+ base::MakeUnique<base::CommandLine>(exe_path);
#endif
cmd_line->AppendSwitchASCII(switches::kProcessType,
@@ -337,9 +338,9 @@ bool UtilityProcessHostImpl::StartProcess() {
cmd_line->AppendSwitch(switches::kUtilityProcessRunningElevated);
#endif
- process_->Launch(new UtilitySandboxedProcessLauncherDelegate(
+ process_->Launch(base::MakeUnique<UtilitySandboxedProcessLauncherDelegate>(
exposed_dir_, run_elevated_, no_sandbox_, env_),
- cmd_line, true);
+ std::move(cmd_line), true);
}
return true;
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | content/public/browser/browser_child_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698