Bug 784040 - Add an intent to simulate an increase in memory pressure. r=mfinkle

This commit is contained in:
Kartikaya Gupta 2012-09-27 12:29:47 -04:00
parent d67b48a3bd
commit b6587a159f

View File

@ -34,6 +34,7 @@ import android.util.Log;
class MemoryMonitor extends BroadcastReceiver {
private static final String LOGTAG = "GeckoMemoryMonitor";
private static final String ACTION_MEMORY_DUMP = "org.mozilla.gecko.MEMORY_DUMP";
private static final String ACTION_FORCE_PRESSURE = "org.mozilla.gecko.FORCE_MEMORY_PRESSURE";
private static final int MEMORY_PRESSURE_NONE = 0;
private static final int MEMORY_PRESSURE_CLEANUP = 1;
@ -62,6 +63,7 @@ class MemoryMonitor extends BroadcastReceiver {
filter.addAction(Intent.ACTION_DEVICE_STORAGE_LOW);
filter.addAction(Intent.ACTION_DEVICE_STORAGE_OK);
filter.addAction(ACTION_MEMORY_DUMP);
filter.addAction(ACTION_FORCE_PRESSURE);
context.getApplicationContext().registerReceiver(this, filter);
}
@ -115,6 +117,8 @@ class MemoryMonitor extends BroadcastReceiver {
label = "default";
}
GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("Memory:Dump", label));
} else if (ACTION_FORCE_PRESSURE.equals(intent.getAction())) {
increaseMemoryPressure(MEMORY_PRESSURE_HIGH);
}
}