summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_main.cc
diff options
context:
space:
mode:
authorgspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-23 22:57:55 +0000
committergspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-23 22:57:55 +0000
commitcfa25bde323a4c21b8814cbc1df61ccbfa9d9314 (patch)
tree3e6797427d89e2fbc70401da278c7e3e7c3a3a0a /chrome/browser/browser_main.cc
parent47a68cff12f3b60e16a585b90643f493a7732337 (diff)
downloadchromium_src-cfa25bde323a4c21b8814cbc1df61ccbfa9d9314.zip
chromium_src-cfa25bde323a4c21b8814cbc1df61ccbfa9d9314.tar.gz
chromium_src-cfa25bde323a4c21b8814cbc1df61ccbfa9d9314.tar.bz2
This change implements OOM priority management for ChromeOS
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 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67175 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_main.cc')
-rw-r--r--chrome/browser/browser_main.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index e7afaff..3986163 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -113,6 +113,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/boot_times_loader.h"
+#include "chrome/browser/oom_priority_manager.h"
#endif
// TODO(port): several win-only methods have been pulled out of this, but
@@ -1557,9 +1558,9 @@ int BrowserMain(const MainFunctionParams& parameters) {
bool record_search_engine = is_first_run && !profile->IsOffTheRecord();
#endif
- // ChildProcess:: is a misnomer unless you consider context. Use
- // of --wait-for-debugger only makes sense when Chrome itself is a
- // child process (e.g. when launched by PyAuto).
+ // ChildProcess:: is a misnomer unless you consider context. Use
+ // of --wait-for-debugger only makes sense when Chrome itself is a
+ // child process (e.g. when launched by PyAuto).
if (parsed_command_line.HasSwitch(switches::kWaitForDebugger)) {
ChildProcess::WaitForDebugger(L"Browser");
}
@@ -1577,6 +1578,17 @@ int BrowserMain(const MainFunctionParams& parameters) {
}
}
+#if defined(OS_CHROMEOS)
+ // Run the Out of Memory priority manager while in this scope. Wait
+ // until here to start so that we give the most amount of time for
+ // the other services to start up before we start adjusting the oom
+ // priority. In reality, it doesn't matter much where in this scope
+ // this is started, but it must be started in this scope so it will
+ // also be terminated when this scope exits.
+ scoped_ptr<browser::OomPriorityManager> oom_priority_manager(
+ new browser::OomPriorityManager);
+#endif
+
// Create the instance of the cloud print proxy service so that it can launch
// the service process if needed. This is needed because the service process
// might have shutdown because an update was available.