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

Unified Diff: chrome/browser/memory/tab_manager_delegate_chromeos.h

Issue 2874543002: Refactor ARC OOM handler code (Closed)
Patch Set: address comments from Cheng-Yu Created 3 years, 7 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
Index: chrome/browser/memory/tab_manager_delegate_chromeos.h
diff --git a/chrome/browser/memory/tab_manager_delegate_chromeos.h b/chrome/browser/memory/tab_manager_delegate_chromeos.h
index 0c86a2658908dcb745c5765434bcfe261a9d0a99..025877c84e83a2d254aafd7f0deeafec94b425b4 100644
--- a/chrome/browser/memory/tab_manager_delegate_chromeos.h
+++ b/chrome/browser/memory/tab_manager_delegate_chromeos.h
@@ -41,7 +41,11 @@ enum class ProcessType {
FOCUSED_TAB = 1,
FOCUSED_APP = 2,
- VISIBLE_APP = 3,
+ // Important apps are protected in two ways: 1) Chrome never kills them, and
+ // 2) the kernel is still allowed to kill them, but their OOM adjustment
+ // scores are better than BACKGROUND_TABs and BACKGROUND_APPs.
+ IMPORTANT_APP = 3,
+
BACKGROUND_TAB = 4,
BACKGROUND_APP = 5,
UNKNOWN_TYPE = 6,
@@ -162,6 +166,12 @@ class TabManagerDelegate : public aura::client::ActivationChangeObserver,
int range_end,
ProcessScoreMap* new_map);
+ // Changes |candidates|' OOM scores to |score|. The new scores are set in
+ // |new_map|.
+ void SetOomScore(const std::vector<TabManagerDelegate::Candidate>& candidates,
+ int score,
+ ProcessScoreMap* new_map);
+
// Initiates an oom priority adjustment.
void ScheduleEarlyOomPrioritiesAdjustment();
@@ -173,6 +183,9 @@ class TabManagerDelegate : public aura::client::ActivationChangeObserver,
return base::TimeDelta::FromSeconds(60);
}
+ // The lowest OOM adjustment score that will make the process non-killable.
+ static const int kLowestOomScore;
+
// Holds a reference to the owning TabManager.
const base::WeakPtr<TabManager> tab_manager_;

Powered by Google App Engine
This is Rietveld 408576698