Diff
Modified: trunk/Source/WTF/ChangeLog (128608 => 128609)
--- trunk/Source/WTF/ChangeLog 2012-09-14 14:02:35 UTC (rev 128608)
+++ trunk/Source/WTF/ChangeLog 2012-09-14 14:08:27 UTC (rev 128609)
@@ -1,5 +1,33 @@
2012-09-14 Ilya Tikhonovsky <[email protected]>
+ Web Inspector: NMI: convert template versions of String*::reportMemoryUsage functions to normal functions.
+ https://bugs.webkit.org/show_bug.cgi?id=96759
+
+ Reviewed by Yury Semikhatsky.
+
+ Now when MemoryInstrumentation.h is a part of WTF we can move reportMemoryUsage functions to cpp file.
+
+ * wtf/text/AtomicString.cpp:
+ (WTF::AtomicString::reportMemoryUsage):
+ (WTF):
+ * wtf/text/AtomicString.h:
+ (WTF):
+ (AtomicString):
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::reportMemoryUsage):
+ (WTF):
+ * wtf/text/StringImpl.h:
+ (WTF):
+ (StringImpl):
+ * wtf/text/WTFString.cpp:
+ (WTF::String::reportMemoryUsage):
+ (WTF):
+ * wtf/text/WTFString.h:
+ (WTF):
+ (String):
+
+2012-09-14 Ilya Tikhonovsky <[email protected]>
+
Web Inspector: NMI: remove current traits helper class because it is customizing the instrumentation at a wrong place and is not necessary at the moment.
https://bugs.webkit.org/show_bug.cgi?id=96737
Modified: trunk/Source/WTF/wtf/text/AtomicString.cpp (128608 => 128609)
--- trunk/Source/WTF/wtf/text/AtomicString.cpp 2012-09-14 14:02:35 UTC (rev 128608)
+++ trunk/Source/WTF/wtf/text/AtomicString.cpp 2012-09-14 14:08:27 UTC (rev 128609)
@@ -26,6 +26,7 @@
#include "StringHash.h"
#include <wtf/HashSet.h>
+#include <wtf/MemoryInstrumentation.h>
#include <wtf/Threading.h>
#include <wtf/WTFThreadData.h>
#include <wtf/unicode/UTF8.h>
@@ -435,4 +436,10 @@
}
#endif
+void AtomicString::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this);
+ info.addInstrumentedMember(m_string);
+}
+
} // namespace WTF
Modified: trunk/Source/WTF/wtf/text/AtomicString.h (128608 => 128609)
--- trunk/Source/WTF/wtf/text/AtomicString.h 2012-09-14 14:02:35 UTC (rev 128608)
+++ trunk/Source/WTF/wtf/text/AtomicString.h 2012-09-14 14:08:27 UTC (rev 128609)
@@ -35,6 +35,7 @@
namespace WTF {
struct AtomicStringHash;
+class MemoryObjectInfo;
class AtomicString {
public:
@@ -158,12 +159,7 @@
void show() const;
#endif
- template<typename MemoryObjectInfo>
- void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
- {
- typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this);
- info.addInstrumentedMember(m_string);
- }
+ WTF_EXPORT_STRING_API void reportMemoryUsage(MemoryObjectInfo*) const;
private:
// The explicit constructors with AtomicString::ConstructFromLiteral must be used for literals.
Modified: trunk/Source/WTF/wtf/text/StringImpl.cpp (128608 => 128609)
--- trunk/Source/WTF/wtf/text/StringImpl.cpp 2012-09-14 14:02:35 UTC (rev 128608)
+++ trunk/Source/WTF/wtf/text/StringImpl.cpp 2012-09-14 14:08:27 UTC (rev 128609)
@@ -28,6 +28,7 @@
#include "AtomicString.h"
#include "StringBuffer.h"
#include "StringHash.h"
+#include <wtf/MemoryInstrumentation.h>
#include <wtf/StdLibExtras.h>
#include <wtf/WTFThreadData.h>
#include <wtf/unicode/CharacterNames.h>
@@ -1791,4 +1792,24 @@
return size + sizeof(*this);
}
+void StringImpl::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));
+
+ MemoryClassInfo 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));
+}
+
} // namespace WTF
Modified: trunk/Source/WTF/wtf/text/StringImpl.h (128608 => 128609)
--- trunk/Source/WTF/wtf/text/StringImpl.h 2012-09-14 14:02:35 UTC (rev 128608)
+++ trunk/Source/WTF/wtf/text/StringImpl.h 2012-09-14 14:08:27 UTC (rev 128609)
@@ -60,6 +60,7 @@
struct HashAndUTF8CharactersTranslator;
struct LCharBufferTranslator;
struct CharBufferFromLiteralDataTranslator;
+class MemoryObjectInfo;
struct SubstringTranslator;
struct UCharBufferTranslator;
@@ -715,27 +716,8 @@
ALWAYS_INLINE static StringStats& stringStats() { return m_stringStats; }
#endif
- template<typename MemoryObjectInfo>
- void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
- {
- size_t selfSize = sizeof(StringImpl);
+ WTF_EXPORT_STRING_API void reportMemoryUsage(MemoryObjectInfo*) const;
- // 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;
Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (128608 => 128609)
--- trunk/Source/WTF/wtf/text/WTFString.cpp 2012-09-14 14:02:35 UTC (rev 128608)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp 2012-09-14 14:08:27 UTC (rev 128609)
@@ -27,6 +27,7 @@
#include <wtf/ASCIICType.h>
#include <wtf/DataLog.h>
#include <wtf/MathExtras.h>
+#include <wtf/MemoryInstrumentation.h>
#include <wtf/text/CString.h>
#include <wtf/StringExtras.h>
#include <wtf/Vector.h>
@@ -820,6 +821,12 @@
return utf8;
}
+void String::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this);
+ info.addInstrumentedMember(m_impl);
+}
+
// String Operations
static bool isCharacterAllowedInBase(UChar c, int base)
Modified: trunk/Source/WTF/wtf/text/WTFString.h (128608 => 128609)
--- trunk/Source/WTF/wtf/text/WTFString.h 2012-09-14 14:02:35 UTC (rev 128608)
+++ trunk/Source/WTF/wtf/text/WTFString.h 2012-09-14 14:08:27 UTC (rev 128609)
@@ -58,6 +58,7 @@
namespace WTF {
class CString;
+class MemoryObjectInfo;
struct StringHash;
// Declarations of string operations
@@ -455,12 +456,7 @@
return (*m_impl)[index];
}
- template<typename MemoryObjectInfo>
- void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
- {
- typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this);
- info.addInstrumentedMember(m_impl);
- }
+ WTF_EXPORT_STRING_API void reportMemoryUsage(MemoryObjectInfo*) const;
private:
RefPtr<StringImpl> m_impl;