diff options
Diffstat (limited to 'android_webview')
5 files changed, 9 insertions, 33 deletions
diff --git a/android_webview/browser/browser_view_renderer.h b/android_webview/browser/browser_view_renderer.h index ded115a..e24b25c 100644 --- a/android_webview/browser/browser_view_renderer.h +++ b/android_webview/browser/browser_view_renderer.h @@ -54,8 +54,7 @@ class BrowserViewRenderer { virtual base::android::ScopedJavaLocalRef<jobject> CreateBitmap( JNIEnv* env, int width, - int height, - bool cache_result) = 0; + int height) = 0; // Draws the provided Java Bitmap into the provided Java Canvas. virtual void DrawBitmapIntoCanvas( diff --git a/android_webview/browser/in_process_view_renderer.cc b/android_webview/browser/in_process_view_renderer.cc index 556b7c5..0ad4a41 100644 --- a/android_webview/browser/in_process_view_renderer.cc +++ b/android_webview/browser/in_process_view_renderer.cc @@ -440,7 +440,7 @@ bool InProcessViewRenderer::DrawSWInternal(jobject java_canvas, if (pixels == NULL) { TRACE_EVENT0("android_webview", "Render to Aux Bitmap"); ScopedJavaLocalRef<jobject> jbitmap(java_helper_->CreateBitmap( - env, clip.width(), clip.height(), false)); + env, clip.width(), clip.height())); if (!jbitmap.obj()) { TRACE_EVENT_INSTANT0("android_webview", "Bitmap Alloc Fail", TRACE_EVENT_SCOPE_THREAD); @@ -532,7 +532,7 @@ InProcessViewRenderer::CapturePicture() { // to the bitmap drawn, and we don't want subsequent draws to corrupt any // previously returned pictures. ScopedJavaLocalRef<jobject> jbitmap(java_helper_->CreateBitmap( - env, picture->width(), picture->height(), false)); + env, picture->width(), picture->height())); if (!jbitmap.obj()) return ScopedJavaLocalRef<jobject>(); diff --git a/android_webview/java/src/org/chromium/android_webview/JavaBrowserViewRendererHelper.java b/android_webview/java/src/org/chromium/android_webview/JavaBrowserViewRendererHelper.java index 404743a..85d32c1 100644 --- a/android_webview/java/src/org/chromium/android_webview/JavaBrowserViewRendererHelper.java +++ b/android_webview/java/src/org/chromium/android_webview/JavaBrowserViewRendererHelper.java @@ -13,37 +13,18 @@ import org.chromium.base.CalledByNative; import org.chromium.base.JNINamespace; import org.chromium.content.common.TraceEvent; -import java.lang.ref.SoftReference; - /** * Provides auxiliary methods related to Picture objects and native SkPictures. */ @JNINamespace("android_webview") public class JavaBrowserViewRendererHelper { - private static SoftReference<Bitmap> sCachedBitmap; - /** * Provides a Bitmap object with a given width and height used for auxiliary rasterization. */ @CalledByNative - private static Bitmap createBitmap(int width, int height, boolean cacheResult) { - if (cacheResult && sCachedBitmap != null) { - Bitmap result = sCachedBitmap.get(); - if (result != null) { - if (result.getWidth() == width && result.getHeight() == height) { - TraceEvent.instant("Reused cached bitmap"); - return result; - } - result.recycle(); - } - sCachedBitmap = null; - } - Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); - if (cacheResult) { - sCachedBitmap = new SoftReference<Bitmap>(result); - } - return result; + private static Bitmap createBitmap(int width, int height) { + return Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); } /** diff --git a/android_webview/native/java_browser_view_renderer_helper.cc b/android_webview/native/java_browser_view_renderer_helper.cc index 2cb984f..04278ad 100644 --- a/android_webview/native/java_browser_view_renderer_helper.cc +++ b/android_webview/native/java_browser_view_renderer_helper.cc @@ -21,13 +21,10 @@ JavaBrowserViewRendererHelper::~JavaBrowserViewRendererHelper() { ScopedJavaLocalRef<jobject> JavaBrowserViewRendererHelper::CreateBitmap( JNIEnv* env, int width, - int height, - bool cache_result) { - TRACE_EVENT1("android_webview", "RendererHelper::CreateBitmap", - "cache_result", cache_result); + int height) { + TRACE_EVENT0("android_webview", "RendererHelper::CreateBitmap"); return width <= 0 || height <= 0 ? ScopedJavaLocalRef<jobject>() : - Java_JavaBrowserViewRendererHelper_createBitmap(env, width, height, - cache_result); + Java_JavaBrowserViewRendererHelper_createBitmap(env, width, height); } void JavaBrowserViewRendererHelper::DrawBitmapIntoCanvas( diff --git a/android_webview/native/java_browser_view_renderer_helper.h b/android_webview/native/java_browser_view_renderer_helper.h index 74c72e2..40732d0 100644 --- a/android_webview/native/java_browser_view_renderer_helper.h +++ b/android_webview/native/java_browser_view_renderer_helper.h @@ -22,8 +22,7 @@ class JavaBrowserViewRendererHelper : public BrowserViewRenderer::JavaHelper { virtual base::android::ScopedJavaLocalRef<jobject> CreateBitmap( JNIEnv* env, int width, - int height, - bool cache_result) OVERRIDE; + int height) OVERRIDE; virtual void DrawBitmapIntoCanvas( JNIEnv* env, const base::android::JavaRef<jobject>& jbitmap, |