From efb1906816d97165a353b40f65ea0b057f6c8fe0 Mon Sep 17 00:00:00 2001 From: Chris Craik Date: Wed, 2 May 2012 11:44:36 -0700 Subject: Don't create a new functor if old one exists bug:6405861 Change-Id: Ife0dcc6416b18bbd50b4d244e6464f423f651de6 --- Source/WebKit/android/nav/WebView.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 92fbef6..0caa624 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -755,6 +755,9 @@ class GLDrawFunctor : Functor { void updateScale(float _scale) { scale = _scale; } + void updateExtras(jint _extras) { + extras = _extras; + } private: WebView* wvInstance; int (WebView::*funcPtr)(WebCore::IntRect&, WebCore::IntRect*, @@ -817,9 +820,16 @@ static jint nativeCreateDrawGLFunction(JNIEnv *env, jobject obj, jint nativeView SkRect visibleRect = jrectf_to_rect(env, jvisiblerect); wvInstance->setVisibleRect(visibleRect); - GLDrawFunctor* functor = new GLDrawFunctor(wvInstance, - &android::WebView::drawGL, viewRect, scale, extras); - wvInstance->setFunctor((Functor*) functor); + GLDrawFunctor* functor = (GLDrawFunctor*) wvInstance->getFunctor(); + if (!functor) { + functor = new GLDrawFunctor(wvInstance, &android::WebView::drawGL, + viewRect, scale, extras); + wvInstance->setFunctor((Functor*) functor); + } else { + functor->updateRect(viewRect); + functor->updateScale(scale); + functor->updateExtras(extras); + } WebCore::IntRect webViewRect = jrect_to_webrect(env, jviewrect); functor->updateViewRect(webViewRect); -- cgit v1.1