Index: chrome/app/chrome_main.cc |
diff --git a/chrome/app/chrome_main.cc b/chrome/app/chrome_main.cc |
index 98c86799018bb343562f72fa47aef1bbf72797c8..cd58495172bd24a4d92c5866937766e06d8f1eb9 100644 |
--- a/chrome/app/chrome_main.cc |
+++ b/chrome/app/chrome_main.cc |
@@ -173,22 +173,24 @@ bool HasDeprecatedArguments(const std::wstring& command_line) { |
#if defined(OS_LINUX) |
static void AdjustLinuxOOMScore(const std::string& process_type) { |
- const int kMiscScore = 7; |
-#if defined(OS_CHROMEOS) |
- // On ChromeOS, we want plugins to die after the renderers. If this |
- // works well for ChromeOS, we may do it for Linux as well. |
- const int kPluginScore = 4; |
-#else |
- const int kPluginScore = 10; |
-#endif |
+ // Browsers and zygotes should still be killable, but killed last. |
+ const int kZygoteScore = 0; |
+ // This is the lowest score that renderers and extensions start with |
+ // in the OomPriorityManager. |
+ const int kRendererScore = 300; |
+ // We want plugins to die after the renderers. |
+ const int kPluginScore = 100; |
+ // For "miscellaneous" things, we want them after renderers, |
+ // but before plugins. |
+ const int kMiscScore = (kPluginScore + kRendererScore) / 2; |
stevenjb
2011/08/18 00:20:07
While this is logical, it might be more readable i
|
int score = -1; |
if (process_type == switches::kPluginProcess || |
process_type == switches::kPpapiPluginProcess) { |
score = kPluginScore; |
} else if (process_type == switches::kPpapiBrokerProcess) { |
- // Kill the broker before the plugin. |
- score = kPluginScore + 1; |
+ // The broker should be killed before the PPAPI plugin. |
+ score = kPluginScore + 100; |
stevenjb
2011/08/18 00:20:07
nit: const for 100
|
} else if (process_type == switches::kUtilityProcess || |
process_type == switches::kWorkerProcess || |
process_type == switches::kGpuProcess || |
@@ -196,19 +198,25 @@ static void AdjustLinuxOOMScore(const std::string& process_type) { |
score = kMiscScore; |
} else if (process_type == switches::kProfileImportProcess) { |
NOTIMPLEMENTED(); |
+ score = kZygoteScore; |
#ifndef DISABLE_NACL |
} else if (process_type == switches::kNaClLoaderProcess) { |
score = kPluginScore; |
#endif |
} else if (process_type == switches::kZygoteProcess || |
process_type.empty()) { |
- // Pass - browser / zygote process stays at 0. |
+ // For zygotes and unlabeled process types, we want to still make |
+ // them killable by the OOM killer. |
+ score = kZygoteScore; |
} else if (process_type == switches::kExtensionProcess || |
process_type == switches::kRendererProcess) { |
LOG(WARNING) << "process type '" << process_type << "' " |
- << "should go through the zygote."; |
- // When debugging, these process types can end up being run directly. |
- return; |
+ << "should be created through the zygote."; |
+ // When debugging, these process types can end up being run |
+ // directly, but this isn't the typical path for assigning the OOM |
+ // score for them. Still, we want to assign a score that is |
+ // somewhat representative for debugging. |
+ score = kRendererScore; |
} else { |
NOTREACHED() << "Unknown process type"; |
} |