Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.android_webview; | 5 package org.chromium.android_webview; |
| 6 | 6 |
| 7 import android.content.ComponentCallbacks2; | |
| 7 import android.content.pm.PackageManager; | 8 import android.content.pm.PackageManager; |
| 8 import android.content.res.Configuration; | 9 import android.content.res.Configuration; |
| 9 import android.graphics.Bitmap; | 10 import android.graphics.Bitmap; |
| 10 import android.graphics.Canvas; | 11 import android.graphics.Canvas; |
| 11 import android.graphics.Color; | 12 import android.graphics.Color; |
| 12 import android.graphics.Picture; | 13 import android.graphics.Picture; |
| 13 import android.graphics.Rect; | 14 import android.graphics.Rect; |
| 14 import android.graphics.drawable.Drawable; | 15 import android.graphics.drawable.Drawable; |
| 15 import android.net.http.SslCertificate; | 16 import android.net.http.SslCertificate; |
| 16 import android.os.AsyncTask; | 17 import android.os.AsyncTask; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 31 import android.view.inputmethod.EditorInfo; | 32 import android.view.inputmethod.EditorInfo; |
| 32 import android.view.inputmethod.InputConnection; | 33 import android.view.inputmethod.InputConnection; |
| 33 import android.webkit.GeolocationPermissions; | 34 import android.webkit.GeolocationPermissions; |
| 34 import android.webkit.ValueCallback; | 35 import android.webkit.ValueCallback; |
| 35 import android.widget.OverScroller; | 36 import android.widget.OverScroller; |
| 36 | 37 |
| 37 import com.google.common.annotations.VisibleForTesting; | 38 import com.google.common.annotations.VisibleForTesting; |
| 38 | 39 |
| 39 import org.chromium.base.CalledByNative; | 40 import org.chromium.base.CalledByNative; |
| 40 import org.chromium.base.JNINamespace; | 41 import org.chromium.base.JNINamespace; |
| 42 import org.chromium.base.MemoryPressureListener; | |
| 41 import org.chromium.base.ThreadUtils; | 43 import org.chromium.base.ThreadUtils; |
| 42 import org.chromium.content.browser.ContentSettings; | 44 import org.chromium.content.browser.ContentSettings; |
| 43 import org.chromium.content.browser.ContentVideoView; | 45 import org.chromium.content.browser.ContentVideoView; |
| 44 import org.chromium.content.browser.ContentViewClient; | 46 import org.chromium.content.browser.ContentViewClient; |
| 45 import org.chromium.content.browser.ContentViewCore; | 47 import org.chromium.content.browser.ContentViewCore; |
| 46 import org.chromium.content.browser.ContentViewStatics; | 48 import org.chromium.content.browser.ContentViewStatics; |
| 47 import org.chromium.content.browser.LoadUrlParams; | 49 import org.chromium.content.browser.LoadUrlParams; |
| 48 import org.chromium.content.browser.NavigationHistory; | 50 import org.chromium.content.browser.NavigationHistory; |
| 49 import org.chromium.content.browser.PageTransitionTypes; | 51 import org.chromium.content.browser.PageTransitionTypes; |
| 50 import org.chromium.content.common.CleanupReference; | 52 import org.chromium.content.common.CleanupReference; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 private static final class DestroyRunnable implements Runnable { | 189 private static final class DestroyRunnable implements Runnable { |
| 188 private int mNativeAwContents; | 190 private int mNativeAwContents; |
| 189 private DestroyRunnable(int nativeAwContents) { | 191 private DestroyRunnable(int nativeAwContents) { |
| 190 mNativeAwContents = nativeAwContents; | 192 mNativeAwContents = nativeAwContents; |
| 191 } | 193 } |
| 192 @Override | 194 @Override |
| 193 public void run() { | 195 public void run() { |
| 194 // This is a no-op if not currently attached. | 196 // This is a no-op if not currently attached. |
| 195 nativeOnDetachedFromWindow(mNativeAwContents); | 197 nativeOnDetachedFromWindow(mNativeAwContents); |
| 196 nativeDestroy(mNativeAwContents); | 198 nativeDestroy(mNativeAwContents); |
| 199 | |
| 200 // Send a memory pressure signal for freeing up some memory if this | |
| 201 // is the last WebView instance. | |
| 202 if (getNativeInstanceCount() == 0) { | |
| 203 MemoryPressureListener.simulateMemoryPressureSignal( | |
| 204 ComponentCallbacks2.TRIM_MEMORY_COMPLETE); | |
|
joth
2013/09/03 18:37:58
It's always a bit hairy adding new code to the Cle
Primiano Tucci (use gerrit)
2013/09/05 11:47:25
Done.
| |
| 205 } | |
| 197 } | 206 } |
| 198 } | 207 } |
| 199 | 208 |
| 200 // Reference to the active mNativeAwContents pointer while it is active use | 209 // Reference to the active mNativeAwContents pointer while it is active use |
| 201 // (ie before it is destroyed). | 210 // (ie before it is destroyed). |
| 202 private CleanupReference mCleanupReference; | 211 private CleanupReference mCleanupReference; |
| 203 | 212 |
| 204 // A list of references to native pointers where the Java counterpart has be en | 213 // A list of references to native pointers where the Java counterpart has be en |
| 205 // destroyed, but are held here because they are waiting for onDetachFromWin dow | 214 // destroyed, but are held here because they are waiting for onDetachFromWin dow |
| 206 // to release GL resources. This is cleared inside onDetachFromWindow. | 215 // to release GL resources. This is cleared inside onDetachFromWindow. |
| (...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1918 | 1927 |
| 1919 private native int nativeGetAwDrawGLViewContext(int nativeAwContents); | 1928 private native int nativeGetAwDrawGLViewContext(int nativeAwContents); |
| 1920 private native int nativeCapturePicture(int nativeAwContents, int width, int height); | 1929 private native int nativeCapturePicture(int nativeAwContents, int width, int height); |
| 1921 private native void nativeEnableOnNewPicture(int nativeAwContents, boolean e nabled); | 1930 private native void nativeEnableOnNewPicture(int nativeAwContents, boolean e nabled); |
| 1922 | 1931 |
| 1923 private native void nativeInvokeGeolocationCallback( | 1932 private native void nativeInvokeGeolocationCallback( |
| 1924 int nativeAwContents, boolean value, String requestingFrame); | 1933 int nativeAwContents, boolean value, String requestingFrame); |
| 1925 | 1934 |
| 1926 private native void nativeSetJsOnlineProperty(int nativeAwContents, boolean networkUp); | 1935 private native void nativeSetJsOnlineProperty(int nativeAwContents, boolean networkUp); |
| 1927 } | 1936 } |
| OLD | NEW |