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

Unified Diff: chrome/app/chrome_main_delegate.cc

Issue 2744783002: Cleanup Linux OOM adjustment code. (Closed)
Patch Set: comment Created 3 years, 9 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 | « no previous file | content/browser/zygote_host/zygote_host_impl_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/chrome_main_delegate.cc
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc
index 8991b14d5cbf291900e990f1363da33bdc56d2f9..8a4e8f2e458d3cf2c5a48a43e3512b083dd95fab 100644
--- a/chrome/app/chrome_main_delegate.cc
+++ b/chrome/app/chrome_main_delegate.cc
@@ -62,12 +62,13 @@
#if defined(OS_WIN)
#include <atlbase.h>
#include <malloc.h>
+
#include <algorithm>
+
#include "base/debug/close_handle_hook_win.h"
#include "chrome/browser/downgrade/user_data_downgrade.h"
#include "chrome/child/v8_breakpad_support_win.h"
#include "chrome/common/child_process_logging.h"
-#include "components/crash/content/app/crashpad.h"
#include "sandbox/win/src/sandbox.h"
#include "ui/base/resource/resource_bundle_win.h"
#endif
@@ -78,7 +79,6 @@
#include "chrome/browser/mac/relauncher.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/common/mac/cfbundle_blocker.h"
-#include "components/crash/content/app/crashpad.h"
#include "components/crash/core/common/objc_zombie.h"
#include "ui/base/l10n/l10n_util_mac.h"
#endif
@@ -127,6 +127,7 @@
#if defined(OS_MACOSX) || defined(OS_WIN)
#include "chrome/browser/policy/policy_path_parser.h"
+#include "components/crash/content/app/crashpad.h"
#endif
#if defined(OS_CHROMEOS)
@@ -222,7 +223,7 @@ bool UseHooks() {
#endif // defined(OS_WIN)
#if defined(OS_LINUX)
-static void AdjustLinuxOOMScore(const std::string& process_type) {
+void AdjustLinuxOOMScore(const std::string& process_type) {
// Browsers and zygotes should still be killable, but killed last.
const int kZygoteScore = 0;
// The minimum amount to bump a score by. This is large enough that
@@ -271,6 +272,9 @@ static void AdjustLinuxOOMScore(const std::string& process_type) {
} else {
NOTREACHED() << "Unknown process type";
}
+ // In the case of a 0 score, still try to adjust it. Most likely the score is
+ // 0 already, but it may not be if this process inherited a higher score from
+ // its parent process.
if (score > -1)
base::AdjustOOMScore(base::GetCurrentProcId(), score);
}
« no previous file with comments | « no previous file | content/browser/zygote_host/zygote_host_impl_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698