summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2011-09-07 11:33:07 -0700
committerJohn Reck <jreck@google.com>2011-09-07 11:40:39 -0700
commit52f5c337d737fdbaa361fc46b3e0aff2bb27cbae (patch)
tree07f30ab96fd2794d6c69d0e482417a9f7f94bfb1 /Source
parent666a074f73aab3617c866ebe204ce841978ba270 (diff)
downloadexternal_webkit-52f5c337d737fdbaa361fc46b3e0aff2bb27cbae.zip
external_webkit-52f5c337d737fdbaa361fc46b3e0aff2bb27cbae.tar.gz
external_webkit-52f5c337d737fdbaa361fc46b3e0aff2bb27cbae.tar.bz2
OnTrimMemory plumbing
Bug: 5269460 Change-Id: Iad6513787b6737d45f1537973e08469005ed4dac
Diffstat (limited to 'Source')
-rw-r--r--Source/WebKit/android/nav/WebView.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index 5cf9953..ebbbc1a 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -75,6 +75,15 @@
#include <wtf/text/AtomicString.h>
#include <wtf/text/CString.h>
+// Free as much as we possible can
+#define TRIM_MEMORY_COMPLETE 80
+// Free a lot (all textures gone)
+#define TRIM_MEMORY_MODERATE 60
+// More moderate free (keep bare minimum to restore quickly-ish - possibly clear all textures)
+#define TRIM_MEMORY_BACKGROUND 40
+// Moderate free (clear cached tiles, keep visible ones)
+#define TRIM_MEMORY_UI_HIDDEN 20
+
namespace android {
static jfieldID gWebViewField;
@@ -2562,6 +2571,10 @@ static jstring nativeGetProperty(JNIEnv *env, jobject obj, jstring key)
return 0;
}
+static void nativeOnTrimMemory(JNIEnv *env, jobject obj, jint level)
+{
+}
+
static void nativeDumpDisplayTree(JNIEnv* env, jobject jwebview, jstring jurl)
{
#ifdef ANDROID_DUMP_DISPLAY_TREE
@@ -2865,6 +2878,8 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeSetProperty },
{ "nativeGetProperty", "(Ljava/lang/String;)Ljava/lang/String;",
(void*) nativeGetProperty },
+ { "nativeOnTrimMemory", "(I)V",
+ (void*) nativeOnTrimMemory },
};
int registerWebView(JNIEnv* env)