Bug 816879 - Treat all memory pressure events when Fennec is in the foreground as low-pressure. r=snorp
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 30 Jan 2013 13:52:49 -0500
changeset 120392 2f0cf6930eec31774769057a8c28490f8db498f5
parent 120391 abfd67b9c024364947c585e1c52ebc5c8302bbd1
child 120393 2d6e2f861e19223eec179d045c95375615ade49e
push id24251
push userryanvm@gmail.com
push dateThu, 31 Jan 2013 20:56:22 +0000
treeherdermozilla-central@683b08dc1afd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs816879
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 816879 - Treat all memory pressure events when Fennec is in the foreground as low-pressure. r=snorp
mobile/android/base/MemoryMonitor.java
--- a/mobile/android/base/MemoryMonitor.java
+++ b/mobile/android/base/MemoryMonitor.java
@@ -84,27 +84,20 @@ class MemoryMonitor extends BroadcastRec
         if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE) {
             increaseMemoryPressure(MEMORY_PRESSURE_HIGH);
         } else if (level >= ComponentCallbacks2.TRIM_MEMORY_MODERATE) {
             increaseMemoryPressure(MEMORY_PRESSURE_MEDIUM);
         } else if (level >= ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN) {
             // includes TRIM_MEMORY_BACKGROUND
             increaseMemoryPressure(MEMORY_PRESSURE_CLEANUP);
         } else {
-            if (Build.VERSION.SDK_INT < 16) {
-                // in SDK 14 and 15 we don't have these extra fine-grained levels so
-                // just default to low (we already know it's < TRIM_MEMORY_UI_HIDDEN)
-                increaseMemoryPressure(MEMORY_PRESSURE_LOW);
-            } else if (level >= ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL) {
-                increaseMemoryPressure(MEMORY_PRESSURE_HIGH);
-            } else if (level >= ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW) {
-                increaseMemoryPressure(MEMORY_PRESSURE_MEDIUM);
-            } else {
-                increaseMemoryPressure(MEMORY_PRESSURE_LOW);
-            }
+            // levels down here mean gecko is the foreground process so we
+            // should be less aggressive with wiping memory as it may impact
+            // user experience.
+            increaseMemoryPressure(MEMORY_PRESSURE_LOW);
         }
     }
 
     @Override
     public void onReceive(Context context, Intent intent) {
         if (Intent.ACTION_DEVICE_STORAGE_LOW.equals(intent.getAction())) {
             Log.d(LOGTAG, "Device storage is low");
             mStoragePressure = true;