summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-05-02 13:09:27 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-05-02 13:09:27 -0700
commit8a3e157baecb453158df1f7bc81bfb4704448b2e (patch)
treee89be331461667f4de63cafd26fafbfae92c3ad0
parentfa3976234409edb5477e8950204c597cf2a6dda9 (diff)
parentefb1906816d97165a353b40f65ea0b057f6c8fe0 (diff)
downloadexternal_webkit-8a3e157baecb453158df1f7bc81bfb4704448b2e.zip
external_webkit-8a3e157baecb453158df1f7bc81bfb4704448b2e.tar.gz
external_webkit-8a3e157baecb453158df1f7bc81bfb4704448b2e.tar.bz2
Merge "Don't create a new functor if old one exists" into jb-dev
-rw-r--r--Source/WebKit/android/nav/WebView.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index 07b69c7..51ffdfe 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -761,6 +761,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*,
@@ -823,9 +826,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);