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

Unified Diff: chrome/browser/browser_main.cc

Issue 3235007: This adds periodic OOM score adjustment, based on the last access time (Closed)
Patch Set: Final review changes Created 10 years, 4 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 | « base/task.h ('k') | chrome/browser/oom_priority_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/browser_main.cc
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index b1ef3960040b00b54276b27f2251de777ceafc61..9927502ca31c3199ea2f97941ffef7321c53191f 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -105,6 +105,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
@@ -1401,9 +1402,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");
}
@@ -1421,6 +1422,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
+
int result_code = ResultCodes::NORMAL_EXIT;
if (parameters.ui_task) {
// We are in test mode. Run one task and enter the main message loop.
« no previous file with comments | « base/task.h ('k') | chrome/browser/oom_priority_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698