Changeset 48752 in webkit
- Timestamp:
- Sep 25, 2009 1:54:55 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r48748 r48752 1 2009-09-25 Yongjun Zhang <yongjun.zhang@nokia.com> 2 3 Reviewed by Ariya Hidayat. 4 5 https://bugs.webkit.org/show_bug.cgi?id=28876 6 [Qt] reduce peak memory consumption of text decoding. 7 8 Chop large input buffer into small buffers to reduce peak memory 9 during decoding. 10 11 * platform/text/qt/TextCodecQt.cpp: 12 (WebCore::TextCodecQt::decode): 13 1 14 2009-09-24 Jon Honeycutt <jhoneycutt@apple.com> 2 15 -
trunk/WebCore/platform/text/qt/TextCodecQt.cpp
r44112 r48752 95 95 String TextCodecQt::decode(const char* bytes, size_t length, bool flush, bool /*stopOnError*/, bool& sawError) 96 96 { 97 QString unicode = m_codec->toUnicode(bytes, length, &m_state); 97 // We chop input buffer to smaller buffers to avoid excessive memory consumption 98 // when the input buffer is big. This helps reduce peak memory consumption in 99 // mobile devices where system RAM is limited. 100 #if PLATFORM(SYMBIAN) 101 static const int MaxInputChunkSize = 32 * 1024; 102 #else 103 static const int MaxInputChunkSize = 1024 * 1024; 104 #endif 105 const char* buf = bytes; 106 const char* end = buf + length; 107 String unicode; 108 109 while (buf < end) { 110 int size = end - buf; 111 size = qMin(size, MaxInputChunkSize); 112 QString decoded = m_codec->toUnicode(buf, size, &m_state); 113 unicode.append(decoded); 114 buf += size; 115 } 116 98 117 sawError = m_state.invalidChars != 0; 99 118
Note: See TracChangeset
for help on using the changeset viewer.