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

Unified Diff: content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java

Issue 17108012: Android: adds test intents for memory pressure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments Created 7 years, 6 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 | « chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/android/shell_apk/src/org/chromium/content_shell_apk/ContentShellActivity.java
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 93147632a19ea2a93b179fd100bfbd4217cc5923..a3d4053574b1fe73e4a6155286b0a17cabfbc91b 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();
« no previous file with comments | « chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698