diff options
author | Nicolas Roard <nicolasroard@google.com> | 2011-08-23 15:45:06 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-08-23 15:45:06 -0700 |
commit | be6c6b90bc7d5bcef3f94aeddee130dbcec7aff2 (patch) | |
tree | df2e6d07d7ccc266e43d40482baf22424b096543 /Source/WebKit | |
parent | 2611ed55f09dc1c2b17df5e453256c15722b5846 (diff) | |
parent | 983aece75ec4a559dcf65890b260976687fa8cc8 (diff) | |
download | external_webkit-be6c6b90bc7d5bcef3f94aeddee130dbcec7aff2.zip external_webkit-be6c6b90bc7d5bcef3f94aeddee130dbcec7aff2.tar.gz external_webkit-be6c6b90bc7d5bcef3f94aeddee130dbcec7aff2.tar.bz2 |
Merge "Limit the number of inval rects we send to the UI"
Diffstat (limited to 'Source/WebKit')
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 964a33d..3af55a3 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -164,6 +164,11 @@ FILE* gRenderTreeFile = 0; #include <v8.h> #endif +// In some cases, too many invalidations passed to the UI will slow us down. +// Limit ourselves to 32 rectangles, past this just send the area bounds to the UI. +// see WebViewCore::recordPictureSet(). +#define MAX_INVALIDATIONS 32 + /* We pass this flag when recording the actual content, so that we don't spend time actually regionizing complex path clips, when all we really want to do is record them. @@ -684,6 +689,21 @@ void WebViewCore::recordPictureSet(PictureSet* content) // Add the current inval rects to the PictureSet, and rebuild it. content->add(m_addInval, 0, 0, false); + + // If we have too many invalidations, just get the area bounds + SkRegion::Iterator iterator(m_addInval); + int nbInvals = 0; + while (!iterator.done()) { + iterator.next(); + nbInvals++; + if (nbInvals > MAX_INVALIDATIONS) + break; + } + if (nbInvals > MAX_INVALIDATIONS) { + SkIRect r = m_addInval.getBounds(); + m_addInval.setRect(r); + } + rebuildPictureSet(content); } // WebViewCoreRecordTimeCounter |