[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

hausmann at webkit.org hausmann at webkit.org
Thu Oct 29 20:34:11 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 9c27a2e7c95056de8264489d97b359a72e504ecf
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 25 08:54:55 2009 +0000

    https://bugs.webkit.org/show_bug.cgi?id=28876
    [Qt] reduce peak memory consumption of text decoding.
    
    Patch by Yongjun Zhang <yongjun.zhang at nokia.com> on 2009-09-25
    Reviewed by Ariya Hidayat.
    
    Chop large input buffer into small buffers to reduce peak memory
    during decoding.
    
    * platform/text/qt/TextCodecQt.cpp:
    (WebCore::TextCodecQt::decode):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48752 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 73313e0..a302df4 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2009-09-25  Yongjun Zhang  <yongjun.zhang at nokia.com>
+
+        Reviewed by Ariya Hidayat.
+
+        https://bugs.webkit.org/show_bug.cgi?id=28876
+        [Qt] reduce peak memory consumption of text decoding.
+
+        Chop large input buffer into small buffers to reduce peak memory
+        during decoding.
+
+        * platform/text/qt/TextCodecQt.cpp:
+        (WebCore::TextCodecQt::decode):
+
 2009-09-24  Jon Honeycutt  <jhoneycutt at apple.com>
 
         Add a mechanism for automatically halting plug-ins.
diff --git a/WebCore/platform/text/qt/TextCodecQt.cpp b/WebCore/platform/text/qt/TextCodecQt.cpp
index c6c02cf..e351522 100644
--- a/WebCore/platform/text/qt/TextCodecQt.cpp
+++ b/WebCore/platform/text/qt/TextCodecQt.cpp
@@ -94,7 +94,26 @@ TextCodecQt::~TextCodecQt()
 
 String TextCodecQt::decode(const char* bytes, size_t length, bool flush, bool /*stopOnError*/, bool& sawError)
 {
-    QString unicode = m_codec->toUnicode(bytes, length, &m_state);
+    // We chop input buffer to smaller buffers to avoid excessive memory consumption
+    // when the input buffer is big.  This helps reduce peak memory consumption in
+    // mobile devices where system RAM is limited.
+#if PLATFORM(SYMBIAN)
+    static const int MaxInputChunkSize = 32 * 1024;
+#else
+    static const int MaxInputChunkSize = 1024 * 1024;
+#endif
+    const char* buf = bytes;
+    const char* end = buf + length;
+    String unicode;
+
+    while (buf < end) {
+        int size = end - buf;
+        size = qMin(size, MaxInputChunkSize);
+        QString decoded = m_codec->toUnicode(buf, size, &m_state);
+        unicode.append(decoded);
+        buf += size;
+    }
+
     sawError = m_state.invalidChars != 0;
 
     if (flush) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list