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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 25082006: [Android WebView] OnMemoryPressure to drop tile memory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: real working code Created 7 years, 2 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
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index f0f286ffb8adcaf325ccd72bb5cb971b6c1d55ae..ab8700ae06a0b844851b85c355aef5cd173ca82d 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -4,6 +4,8 @@
package org.chromium.android_webview;
+import android.content.ComponentCallbacks2;
+import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
@@ -523,6 +525,23 @@ public class AwContents {
onVisibilityChanged(mContainerView, mContainerView.getVisibility());
onWindowVisibilityChanged(mContainerView.getWindowVisibility());
+
+ containerView.getContext().registerComponentCallbacks(
joth 2013/10/02 10:47:01 could you move this up to line 520? onVisibilityCh
boliu 2013/10/02 14:09:55 This moved to attach/detach since we need to expli
+ new ComponentCallbacks2() {
+ @Override
+ public void onTrimMemory(int level) {
+ if (mNativeAwContents == 0) return;
+ nativeTrimMemory(mNativeAwContents, level);
+ }
+
+ @Override
+ public void onLowMemory() {
+ }
+
+ @Override
+ public void onConfigurationChanged(Configuration configuration) {
+ }
+ });
}
/**
@@ -1967,4 +1986,6 @@ public class AwContents {
int nativeAwContents, boolean value, String requestingFrame);
private native void nativeSetJsOnlineProperty(int nativeAwContents, boolean networkUp);
+
+ private native void nativeTrimMemory(int nativeAwContents, int level);
}

Powered by Google App Engine
This is Rietveld 408576698