summaryrefslogtreecommitdiffstats
path: root/chrome/browser/zygote_host_linux.cc
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-23 23:53:08 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-23 23:53:08 +0000
commit96af6d4d2ea59c487a866ba6fc844c801f4c80f9 (patch)
tree431c8caabdf7a314e0fb058c851e2e8280d21b1d /chrome/browser/zygote_host_linux.cc
parent4a6ed0d466e886bb9cedf38aa5081342c1489679 (diff)
downloadchromium_src-96af6d4d2ea59c487a866ba6fc844c801f4c80f9.zip
chromium_src-96af6d4d2ea59c487a866ba6fc844c801f4c80f9.tar.gz
chromium_src-96af6d4d2ea59c487a866ba6fc844c801f4c80f9.tar.bz2
Revert 67175 - This change implements OOM priority management for ChromeOS
(Build failure, probably debug/release warning difference.) This adds periodic OOM score adjustment, based on the last access time of the tab, whether or not it is pinned, and (of course) how much memory it is using. BUG=http://crosbug.com/8990 TEST=Ran some ui_tests, ran on device. Review URL: http://codereview.chromium.org/4498001 TBR=gspencer@chromium.org Review URL: http://codereview.chromium.org/5284003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/zygote_host_linux.cc')
-rw-r--r--chrome/browser/zygote_host_linux.cc19
1 files changed, 8 insertions, 11 deletions
diff --git a/chrome/browser/zygote_host_linux.cc b/chrome/browser/zygote_host_linux.cc
index b6115f1..5536eaf 100644
--- a/chrome/browser/zygote_host_linux.cc
+++ b/chrome/browser/zygote_host_linux.cc
@@ -242,13 +242,6 @@ pid_t ZygoteHost::ForkRenderer(
return base::kNullProcessHandle;
}
- const int kRendererScore = 5;
- AdjustRendererOOMScore(pid, kRendererScore);
-
- return pid;
-}
-
-void ZygoteHost::AdjustRendererOOMScore(base::ProcessHandle pid, int score) {
// 1) You can't change the oom_adj of a non-dumpable process (EPERM) unless
// you're root. Because of this, we can't set the oom_adj from the browser
// process.
@@ -281,23 +274,27 @@ void ZygoteHost::AdjustRendererOOMScore(base::ProcessHandle pid, int score) {
selinux_valid = true;
}
+ const int kRendererScore = 5;
if (using_suid_sandbox_ && !selinux) {
base::ProcessHandle sandbox_helper_process;
+ base::file_handle_mapping_vector dummy_map;
std::vector<std::string> adj_oom_score_cmdline;
adj_oom_score_cmdline.push_back(sandbox_binary_);
adj_oom_score_cmdline.push_back(base::kAdjustOOMScoreSwitch);
adj_oom_score_cmdline.push_back(base::Int64ToString(pid));
- adj_oom_score_cmdline.push_back(base::IntToString(score));
+ adj_oom_score_cmdline.push_back(base::IntToString(kRendererScore));
CommandLine adj_oom_score_cmd(adj_oom_score_cmdline);
- if (base::LaunchApp(adj_oom_score_cmd, false, true,
+ if (base::LaunchApp(adj_oom_score_cmdline, dummy_map, false,
&sandbox_helper_process)) {
ProcessWatcher::EnsureProcessGetsReaped(sandbox_helper_process);
}
} else if (!using_suid_sandbox_) {
- if (!base::AdjustOOMScore(pid, score))
- PLOG(ERROR) << "Failed to adjust OOM score of renderer with pid " << pid;
+ if (!base::AdjustOOMScore(pid, kRendererScore))
+ LOG(ERROR) << "Failed to adjust OOM score of renderer";
}
+
+ return pid;
}
void ZygoteHost::EnsureProcessTerminated(pid_t process) {