summaryrefslogtreecommitdiffstats
path: root/content/shell
diff options
context:
space:
mode:
authorbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 23:50:10 +0000
committerbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 23:50:10 +0000
commit049fabf24efa487b889b8a6901ecba17088ed5b0 (patch)
tree3598891cbd44f4434aa84ecc650d5d8f0085459b /content/shell
parent407b5a1441a8c9a4bff5e8bba82d53d340a55d60 (diff)
downloadchromium_src-049fabf24efa487b889b8a6901ecba17088ed5b0.zip
chromium_src-049fabf24efa487b889b8a6901ecba17088ed5b0.tar.gz
chromium_src-049fabf24efa487b889b8a6901ecba17088ed5b0.tar.bz2
Android: adds test intents for memory pressure.
Allows using: adb shell am start -a org.chromium.content_shell.action.ACTION_LOW_MEMORY \ -n org.chromium.content_shell_apk/.ContentShellActivity to simulate memory pressure signals. BUG= Review URL: https://chromiumcodereview.appspot.com/17108012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207960 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell')
-rw-r--r--content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
index 9314763..a3d4053 100644
--- a/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
+++ b/content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
@@ -14,6 +14,7 @@ import android.util.Log;
import android.view.KeyEvent;
import org.chromium.base.ChromiumActivity;
+import org.chromium.base.MemoryPressureListener;
import org.chromium.content.app.LibraryLoader;
import org.chromium.content.browser.ActivityContentVideoViewClient;
import org.chromium.content.browser.AndroidBrowserProcess;
@@ -44,6 +45,21 @@ public class ContentShellActivity extends ChromiumActivity {
"org.chromium.content_shell.action.PROFILE_STOP";
public static final String COMMAND_LINE_ARGS_KEY = "commandLineArgs";
+ /**
+ * Sending an intent with this action will simulate a memory pressure signal
+ * at a critical level.
+ */
+ private static final String ACTION_LOW_MEMORY =
+ "org.chromium.content_shell.action.ACTION_LOW_MEMORY";
+
+ /**
+ * Sending an intent with this action will simulate a memory pressure signal
+ * at a moderate level.
+ */
+ private static final String ACTION_TRIM_MEMORY_MODERATE =
+ "org.chromium.content_shell.action.ACTION_TRIM_MEMORY_MODERATE";
+
+
private ShellManager mShellManager;
private WindowAndroid mWindowAndroid;
private BroadcastReceiver mReceiver;
@@ -134,6 +150,14 @@ public class ContentShellActivity extends ChromiumActivity {
Log.i(TAG, "Ignoring command line params: can only be set when creating the activity.");
}
+ if (ACTION_LOW_MEMORY.equals(intent.getAction())) {
+ MemoryPressureListener.simulateMemoryPressureSignal(TRIM_MEMORY_COMPLETE);
+ return;
+ } else if (ACTION_TRIM_MEMORY_MODERATE.equals(intent.getAction())) {
+ MemoryPressureListener.simulateMemoryPressureSignal(TRIM_MEMORY_MODERATE);
+ return;
+ }
+
String url = getUrlFromIntent(intent);
if (!TextUtils.isEmpty(url)) {
Shell activeView = getActiveShell();