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

Unified Diff: content/browser/zygote_host/zygote_host_impl_linux.cc

Issue 846753002: Update EnsureProcessGetsReaped to receive a pid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/service/cloud_print/cloud_print_proxy.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/zygote_host/zygote_host_impl_linux.cc
diff --git a/content/browser/zygote_host/zygote_host_impl_linux.cc b/content/browser/zygote_host/zygote_host_impl_linux.cc
index f7774e550a9a464710ea58060c15ea1fa680a9ea..2a2339bf03bd314b7bd50562d60629c17230a201 100644
--- a/content/browser/zygote_host/zygote_host_impl_linux.cc
+++ b/content/browser/zygote_host/zygote_host_impl_linux.cc
@@ -158,10 +158,9 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) {
sandbox_client->SetupLaunchEnvironment();
}
- base::ProcessHandle process = -1;
options.fds_to_remap = &fds_to_map;
- base::LaunchProcess(cmd_line.argv(), options, &process);
- CHECK(process != -1) << "Failed to launch zygote process";
+ base::Process process = base::LaunchProcess(cmd_line.argv(), options);
+ CHECK(process.IsValid()) << "Failed to launch zygote process";
dummy_fd.reset();
if (using_suid_sandbox_) {
@@ -188,13 +187,15 @@ void ZygoteHostImpl::Init(const std::string& sandbox_cmd) {
fds[0], kZygoteHelloMessage, sizeof(kZygoteHelloMessage), &pid_));
CHECK_GT(pid_, 1);
- if (process != pid_) {
+ if (process.pid() != pid_) {
// Reap the sandbox.
- base::EnsureProcessGetsReaped(process);
+ base::EnsureProcessGetsReaped(process.pid());
}
} else {
// Not using the SUID sandbox.
- pid_ = process;
+ // Note that ~base::Process() will reset the internal value, but there's no
jln (very slow on Chromium) 2015/01/13 19:19:23 Feel free to keep, but this confused me a little.
rvargas (doing something else) 2015/01/13 19:37:04 The pattern { ScopedFoo foo = Bar(); foo_ =
+ // real "handle" on POSIX so that is safe.
+ pid_ = process.pid();
}
close(fds[1]);
@@ -471,16 +472,16 @@ void ZygoteHostImpl::AdjustRendererOOMScore(base::ProcessHandle pid,
adj_oom_score_cmdline.push_back(base::Int64ToString(pid));
adj_oom_score_cmdline.push_back(base::IntToString(score));
- base::ProcessHandle sandbox_helper_process;
+ base::Process sandbox_helper_process;
base::LaunchOptions options;
// sandbox_helper_process is a setuid binary.
options.allow_new_privs = true;
- if (base::LaunchProcess(adj_oom_score_cmdline, options,
- &sandbox_helper_process)) {
- base::EnsureProcessGetsReaped(sandbox_helper_process);
- }
+ sandbox_helper_process =
+ base::LaunchProcess(adj_oom_score_cmdline, options);
+ if (sandbox_helper_process.IsValid())
+ base::EnsureProcessGetsReaped(sandbox_helper_process.pid());
} else if (!using_suid_sandbox_) {
if (!base::AdjustOOMScore(pid, score))
PLOG(ERROR) << "Failed to adjust OOM score of renderer with pid " << pid;
« no previous file with comments | « chrome/service/cloud_print/cloud_print_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698