summaryrefslogtreecommitdiffstats
path: root/Source/WebKit
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2011-08-23 15:31:32 -0700
committerNicolas Roard <nicolasroard@google.com>2011-08-23 15:43:31 -0700
commit983aece75ec4a559dcf65890b260976687fa8cc8 (patch)
tree9581d8f9081eeb2568efa04a20cab1746ac8ad9f /Source/WebKit
parent77e5b594dd717e27b1a8be2b521f738cf5941ae1 (diff)
downloadexternal_webkit-983aece75ec4a559dcf65890b260976687fa8cc8.zip
external_webkit-983aece75ec4a559dcf65890b260976687fa8cc8.tar.gz
external_webkit-983aece75ec4a559dcf65890b260976687fa8cc8.tar.bz2
Limit the number of inval rects we send to the UI
bug:5204192 Change-Id: I5c29e9b2411ac2e05274d9a89c472285ed1aeb67
Diffstat (limited to 'Source/WebKit')
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp20
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