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

Unified Diff: content/browser/memory/memory_monitor_android.cc

Issue 2832753002: memory_coordinator: Use TimeTicks to suppress memory condition update (Closed)
Patch Set: Remove unused const Created 3 years, 8 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 | « content/browser/memory/memory_coordinator_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/memory/memory_monitor_android.cc
diff --git a/content/browser/memory/memory_monitor_android.cc b/content/browser/memory/memory_monitor_android.cc
index a86d6cd7c9b0240502c86f1080e3efa6c588b417..d351c9a9e85dd10875649f572ef8950f335a0509 100644
--- a/content/browser/memory/memory_monitor_android.cc
+++ b/content/browser/memory/memory_monitor_android.cc
@@ -65,7 +65,6 @@ static void GetMemoryInfoCallback(
// The maximum level of onTrimMemory (TRIM_MEMORY_COMPLETE).
const int kTrimMemoryLevelMax = 80;
-const int kTrimMemoryRunningLow = 10;
const int kTrimMemoryRunningCritical = 15;
// Called by JNI.
@@ -74,14 +73,14 @@ static void OnTrimMemory(JNIEnv* env,
jint level) {
DCHECK(level >= 0 && level <= kTrimMemoryLevelMax);
auto* coordinator = MemoryCoordinatorImpl::GetInstance();
-
- if (level >= kTrimMemoryRunningCritical) {
- coordinator->ForceSetMemoryCondition(MemoryCondition::CRITICAL,
- base::TimeDelta::FromMinutes(1));
- } else if (level >= kTrimMemoryRunningLow) {
- coordinator->ForceSetMemoryCondition(MemoryCondition::WARNING,
- base::TimeDelta::FromMinutes(1));
- }
+ DCHECK(coordinator);
+
+ MemoryCondition condition = MemoryCondition::WARNING;
+ if (level >= kTrimMemoryRunningCritical ||
+ coordinator->GetMemoryCondition() == MemoryCondition::CRITICAL)
+ condition = MemoryCondition::CRITICAL;
+ coordinator->ForceSetMemoryCondition(condition,
+ base::TimeDelta::FromMinutes(1));
}
// static
« no previous file with comments | « content/browser/memory/memory_coordinator_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698