Index: base/android/java/src/org/chromium/base/MemoryPressureListener.java |
diff --git a/base/android/java/src/org/chromium/base/MemoryPressureListener.java b/base/android/java/src/org/chromium/base/MemoryPressureListener.java |
index 311b0f6ff49a68102dec6ae273ae3cd929267a81..5d2598a7f2abe8d8b185066625721ceccbdd4a1f 100644 |
--- a/base/android/java/src/org/chromium/base/MemoryPressureListener.java |
+++ b/base/android/java/src/org/chromium/base/MemoryPressureListener.java |
@@ -12,7 +12,7 @@ import android.content.res.Configuration; |
/** |
* This is an internal implementation of the C++ counterpart. |
* It registers a ComponentCallbacks2 with the system, and dispatches into |
- * native. |
+ * native for levels that are considered actionable. |
*/ |
public class MemoryPressureListener { |
@CalledByNative |
@@ -43,10 +43,12 @@ public class MemoryPressureListener { |
} |
private static void maybeNotifyMemoryPresure(int level) { |
- if (level == ComponentCallbacks2.TRIM_MEMORY_COMPLETE) { |
+ if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE) { |
nativeOnMemoryPressure(MemoryPressureLevelList.MEMORY_PRESSURE_CRITICAL); |
} else if (level >= ComponentCallbacks2.TRIM_MEMORY_BACKGROUND || |
level == ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL) { |
+ // Don't notifiy on TRIM_MEMORY_UI_HIDDEN, since this class only |
+ // dispatches actionable memory pressure signals to native. |
nativeOnMemoryPressure(MemoryPressureLevelList.MEMORY_PRESSURE_MODERATE); |
} |
} |