diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-14 16:29:47 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-14 16:29:47 +0200 |
commit | d0424a769059c84ae20beb3c217812792ea6726b (patch) | |
tree | 6f94a5c3db8c52c6694ee56498542a6c35417350 /Source/WTF/wtf/text/StringImpl.h | |
parent | 88a04ac016f57c2d78e714682445dff2e7db4ade (diff) | |
download | qtwebkit-d0424a769059c84ae20beb3c217812792ea6726b.tar.gz |
Imported WebKit commit 37c5e5041d39a14ea0d429a77ebd352e4bd26516 (http://svn.webkit.org/repository/webkit/trunk@128608)
New snapshot that enables WebKit2 build on Windows (still some bugs) and allows for WebKit to be built with qmake && make
Diffstat (limited to 'Source/WTF/wtf/text/StringImpl.h')
-rw-r--r-- | Source/WTF/wtf/text/StringImpl.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/WTF/wtf/text/StringImpl.h b/Source/WTF/wtf/text/StringImpl.h index cd7e10cc5..a18f694be 100644 --- a/Source/WTF/wtf/text/StringImpl.h +++ b/Source/WTF/wtf/text/StringImpl.h @@ -714,6 +714,28 @@ public: #ifdef STRING_STATS ALWAYS_INLINE static StringStats& stringStats() { return m_stringStats; } #endif + + template<typename MemoryObjectInfo> + void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const + { + size_t selfSize = sizeof(StringImpl); + + // Count size used by internal buffer but skip strings that were constructed from literals. + if ((m_hashAndFlags & BufferInternal) && !hasTerminatingNullCharacter()) + // Three cases are covered here: + // 1) a normal 8-bit string with internal storage (BufferInternal) + // 2) a normal 16-bit string with internal storage (BufferInternal) + // 3) empty unique string with length = 0 (BufferInternal) + selfSize += m_length * (m_hashAndFlags & s_hashFlag8BitBuffer ? sizeof(LChar) : sizeof(UChar)); + + typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this, 0, selfSize); + + if (m_hashAndFlags & BufferSubstring) + info.addInstrumentedMember(m_substringBuffer); + else if (m_hashAndFlags & s_hashFlagHas16BitShadow) // Substring never has its own shadow. + info.addRawBuffer(m_copyData16, (m_length + (hasTerminatingNullCharacter() ? 1 : 0)) * sizeof(UChar)); + } + private: // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings. static const unsigned s_copyCharsInlineCutOff = 20; |