Diff
Modified: trunk/Source/WTF/ChangeLog (128447 => 128448)
--- trunk/Source/WTF/ChangeLog 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WTF/ChangeLog 2012-09-13 12:12:19 UTC (rev 128448)
@@ -1,3 +1,21 @@
+2012-09-13 Ilya Tikhonovsky <[email protected]>
+
+ Web Inspector: NMI: instrument KURL directly.
+ https://bugs.webkit.org/show_bug.cgi?id=96624
+
+ Reviewed by Yury Semikhatsky.
+
+ I replaced traits based instrumentation of KURL with reportMemoryUsage functions.
+ CString* were also instrumented.
+
+ Drive by fix: Instrumentation code in QualifiedName was moved to cpp.
+
+ * wtf/text/CString.h:
+ (CStringBuffer):
+ (WTF::CStringBuffer::reportMemoryUsage):
+ (CString):
+ (WTF::CString::reportMemoryUsage):
+
2012-09-12 Ilya Tikhonovsky <[email protected]>
Web Inspector: NMI: migrate core instrumentation code to WTF namespace
Modified: trunk/Source/WTF/wtf/text/CString.h (128447 => 128448)
--- trunk/Source/WTF/wtf/text/CString.h 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WTF/wtf/text/CString.h 2012-09-13 12:12:19 UTC (rev 128448)
@@ -39,6 +39,12 @@
const char* data() { return m_data; }
size_t length() { return m_length; }
+ template<typename MemoryObjectInfo>
+ void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+ {
+ typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this, 0, sizeof(CStringBuffer) + m_length);
+ }
+
private:
friend class CString;
@@ -75,6 +81,13 @@
CStringBuffer* buffer() const { return m_buffer.get(); }
+ template<typename MemoryObjectInfo>
+ void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+ {
+ typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this);
+ info.addInstrumentedMember(m_buffer);
+ }
+
private:
void copyBufferIfNeeded();
void init(const char*, size_t length);
Modified: trunk/Source/WebCore/ChangeLog (128447 => 128448)
--- trunk/Source/WebCore/ChangeLog 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebCore/ChangeLog 2012-09-13 12:12:19 UTC (rev 128448)
@@ -1,3 +1,40 @@
+2012-09-13 Ilya Tikhonovsky <[email protected]>
+
+ Web Inspector: NMI: instrument KURL directly.
+ https://bugs.webkit.org/show_bug.cgi?id=96624
+
+ Reviewed by Yury Semikhatsky.
+
+ I replaced traits based instrumentation of KURL with reportMemoryUsage functions.
+ CString* were also instrumented.
+
+ Drive by fix: Instrumentation code in QualifiedName was moved to cpp.
+
+ * bindings/v8/V8DOMMap.h:
+ * dom/Attribute.h:
+ * dom/QualifiedName.cpp:
+ (WebCore::QualifiedName::reportMemoryUsage):
+ (WebCore):
+ (WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage):
+ * dom/QualifiedName.h:
+ (QualifiedNameImpl):
+ (QualifiedName):
+ * dom/WebCoreMemoryInstrumentation.cpp:
+ * dom/WebCoreMemoryInstrumentation.h:
+ (WebCore):
+ * platform/KURL.cpp:
+ (WebCore::KURL::reportMemoryUsage):
+ (WebCore):
+ * platform/KURL.h:
+ (KURL):
+ * platform/KURLGoogle.cpp:
+ (WebCore::KURLGooglePrivate::reportMemoryUsage):
+ * platform/KURLGooglePrivate.h:
+ (KURLGooglePrivate):
+ * platform/KURLWTFURLImpl.h:
+ (KURLWTFURLImpl):
+ (WebCore::KURLWTFURLImpl::reportMemoryUsage):
+
2012-09-13 Kent Tamura <[email protected]>
Update binding test expectation for http://trac.webkit.org/changeset/128400
Modified: trunk/Source/WebCore/bindings/v8/V8DOMMap.h (128447 => 128448)
--- trunk/Source/WebCore/bindings/v8/V8DOMMap.h 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebCore/bindings/v8/V8DOMMap.h 2012-09-13 12:12:19 UTC (rev 128448)
@@ -32,6 +32,7 @@
#define V8DOMMap_h
#include "WebCoreMemoryInstrumentation.h"
+#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
#include <v8.h>
Modified: trunk/Source/WebCore/dom/Attribute.h (128447 => 128448)
--- trunk/Source/WebCore/dom/Attribute.h 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebCore/dom/Attribute.h 2012-09-13 12:12:19 UTC (rev 128448)
@@ -26,6 +26,7 @@
#define Attribute_h
#include "QualifiedName.h"
+#include "WebCoreMemoryInstrumentation.h"
namespace WebCore {
Modified: trunk/Source/WebCore/dom/QualifiedName.cpp (128447 => 128448)
--- trunk/Source/WebCore/dom/QualifiedName.cpp 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebCore/dom/QualifiedName.cpp 2012-09-13 12:12:19 UTC (rev 128448)
@@ -27,6 +27,7 @@
#include "QualifiedName.h"
#include "HTMLNames.h"
+#include "WebCoreMemoryInstrumentation.h"
#include "XLinkNames.h"
#include "XMLNSNames.h"
#include "XMLNames.h"
@@ -141,6 +142,22 @@
return m_impl->m_localNameUpper;
}
+void QualifiedName::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
+ info.addInstrumentedMember(m_impl);
+}
+
+
+void QualifiedName::QualifiedNameImpl::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
+ info.addInstrumentedMember(m_prefix);
+ info.addInstrumentedMember(m_localName);
+ info.addInstrumentedMember(m_namespace);
+ info.addInstrumentedMember(m_localNameUpper);
+}
+
void createQualifiedName(void* targetAddress, const char* name, unsigned nameLength, const AtomicString& nameNamespace)
{
AtomicString atomicName(name, nameLength, AtomicString::ConstructFromLiteral);
Modified: trunk/Source/WebCore/dom/QualifiedName.h (128447 => 128448)
--- trunk/Source/WebCore/dom/QualifiedName.h 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebCore/dom/QualifiedName.h 2012-09-13 12:12:19 UTC (rev 128448)
@@ -21,8 +21,7 @@
#ifndef QualifiedName_h
#define QualifiedName_h
-#include "WebCoreMemoryInstrumentation.h"
-
+#include <wtf/Forward.h>
#include <wtf/HashTraits.h>
#include <wtf/RefCounted.h>
#include <wtf/text/AtomicString.h>
@@ -50,14 +49,8 @@
const AtomicString m_namespace;
mutable AtomicString m_localNameUpper;
- void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
- {
- MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
- info.addInstrumentedMember(m_prefix);
- info.addInstrumentedMember(m_localName);
- info.addInstrumentedMember(m_namespace);
- info.addInstrumentedMember(m_localNameUpper);
- }
+ void reportMemoryUsage(MemoryObjectInfo*) const;
+
private:
QualifiedNameImpl(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI)
: m_prefix(prefix)
@@ -101,11 +94,8 @@
// Init routine for globals
static void init();
- void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
- {
- MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
- info.addInstrumentedMember(m_impl);
- }
+ void reportMemoryUsage(MemoryObjectInfo*) const;
+
private:
void ref() const { m_impl->ref(); }
void deref();
Modified: trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.cpp (128447 => 128448)
--- trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.cpp 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.cpp 2012-09-13 12:12:19 UTC (rev 128448)
@@ -31,10 +31,6 @@
#include "config.h"
#include "WebCoreMemoryInstrumentation.h"
-#include "KURL.h"
-#include <wtf/text/StringImpl.h>
-#include <wtf/text/WTFString.h>
-
namespace WebCore {
MemoryObjectType WebCoreMemoryTypes::Page = "Page";
@@ -56,23 +52,3 @@
MemoryObjectType WebCoreMemoryTypes::CachedResourceXSLT = "MemoryCache.XSLT";
} // namespace WebCore
-
-namespace WTF {
-
-template<> void MemoryInstrumentationTraits::addInstrumentedObject<WebCore::KURL>(MemoryInstrumentation* instrumentation, const WebCore::KURL* const& url, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
-{
- MemoryInstrumentationTraits::addInstrumentedObject<const WebCore::KURL>(instrumentation, url, ownerObjectType, owningType);
-}
-
-template<> void MemoryInstrumentationTraits::addInstrumentedObject<const WebCore::KURL>(MemoryInstrumentation* instrumentation, const WebCore::KURL* const& url, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
-{
- if (!url || instrumentation->visited(url))
- return;
- if (owningType == byPointer)
- instrumentation->countObjectSize(ownerObjectType, sizeof(WebCore::KURL));
- instrumentation->addInstrumentedObject(url->string(), ownerObjectType);
- if (url->innerURL())
- instrumentation->addInstrumentedObject(url->innerURL(), ownerObjectType);
-}
-
-}
Modified: trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.h (128447 => 128448)
--- trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.h 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.h 2012-09-13 12:12:19 UTC (rev 128448)
@@ -31,14 +31,12 @@
#ifndef WebCoreMemoryInstrumentation_h
#define WebCoreMemoryInstrumentation_h
-#include <wtf/Forward.h>
#include <wtf/MemoryInstrumentation.h>
namespace WebCore {
using WTF::MemoryClassInfo;
using WTF::MemoryObjectType;
-class KURL;
class WebCoreMemoryTypes {
public:
@@ -63,16 +61,4 @@
} // namespace WebCore
-namespace WTF {
-
-// Explicit specializations for some types.
-template<> void MemoryInstrumentationTraits::addInstrumentedObject<WebCore::KURL>(MemoryInstrumentation*, const WebCore::KURL* const&, MemoryObjectType, MemoryOwningType);
-template<> void MemoryInstrumentationTraits::addInstrumentedObject<const WebCore::KURL>(MemoryInstrumentation*, const WebCore::KURL* const&, MemoryObjectType, MemoryOwningType);
-
-// Link time guards with no body.
-template<> void MemoryInstrumentationTraits::addObject<WebCore::KURL>(MemoryInstrumentation*, const WebCore::KURL* const&, MemoryObjectType, MemoryOwningType);
-template<> void MemoryInstrumentationTraits::addObject<const WebCore::KURL>(MemoryInstrumentation*, const WebCore::KURL* const&, MemoryObjectType, MemoryOwningType);
-
-}
-
#endif // !defined(WebCoreMemoryInstrumentation_h)
Modified: trunk/Source/WebCore/platform/KURL.cpp (128447 => 128448)
--- trunk/Source/WebCore/platform/KURL.cpp 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebCore/platform/KURL.cpp 2012-09-13 12:12:19 UTC (rev 128448)
@@ -29,6 +29,7 @@
#include "DecodeEscapeSequences.h"
#include "TextEncoding.h"
+#include "WebCoreMemoryInstrumentation.h"
#include <stdio.h>
#include <wtf/HashMap.h>
#if !USE(WTFURL)
@@ -1916,4 +1917,16 @@
return "";
}
+void KURL::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this);
+#if USE(GOOGLEURL)
+ info.addInstrumentedMember(m_url);
+#elif USE(WTFURL)
+ info.addInstrumentedMember(m_urlImpl);
+#else // !USE(GOOGLEURL)
+ info.addInstrumentedMember(m_string);
+#endif
}
+
+}
Modified: trunk/Source/WebCore/platform/KURL.h (128447 => 128448)
--- trunk/Source/WebCore/platform/KURL.h 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebCore/platform/KURL.h 2012-09-13 12:12:19 UTC (rev 128448)
@@ -27,6 +27,7 @@
#define KURL_h
#include "KURLWTFURLImpl.h"
+#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/text/WTFString.h>
@@ -225,6 +226,8 @@
void print() const;
#endif
+ void reportMemoryUsage(MemoryObjectInfo*) const;
+
private:
void invalidate();
bool isHierarchical() const;
Modified: trunk/Source/WebCore/platform/KURLGoogle.cpp (128447 => 128448)
--- trunk/Source/WebCore/platform/KURLGoogle.cpp 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebCore/platform/KURLGoogle.cpp 2012-09-13 12:12:19 UTC (rev 128448)
@@ -42,6 +42,7 @@
#include "NotImplemented.h"
#include "TextEncoding.h"
+#include "WebCoreMemoryInstrumentation.h"
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
#include <wtf/StdLibExtras.h>
@@ -389,6 +390,13 @@
return m_string;
}
+void KURLGooglePrivate::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+{
+ MemoryClassInfo info(memoryObjectInfo, this);
+ info.addInstrumentedMember(m_utf8);
+ info.addInstrumentedMember(m_string);
+ info.addInstrumentedMember(m_innerURL);
+}
// KURL ------------------------------------------------------------------------
// Initializes with a string representing an absolute URL. No encoding
Modified: trunk/Source/WebCore/platform/KURLGooglePrivate.h (128447 => 128448)
--- trunk/Source/WebCore/platform/KURLGooglePrivate.h 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebCore/platform/KURLGooglePrivate.h 2012-09-13 12:12:19 UTC (rev 128448)
@@ -31,6 +31,7 @@
#ifndef KURLGooglePrivate_h
#define KURLGooglePrivate_h
+#include <wtf/Forward.h>
#include <wtf/OwnPtr.h>
#include <wtf/text/CString.h>
@@ -99,6 +100,8 @@
KURL* innerURL() const { return m_innerURL.get(); }
+ void reportMemoryUsage(MemoryObjectInfo*) const;
+
private:
void initInnerURL();
void initProtocolIsInHTTPFamily();
Modified: trunk/Source/WebCore/platform/KURLWTFURLImpl.h (128447 => 128448)
--- trunk/Source/WebCore/platform/KURLWTFURLImpl.h 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebCore/platform/KURLWTFURLImpl.h 2012-09-13 12:12:19 UTC (rev 128448)
@@ -41,6 +41,13 @@
WTF::ParsedURL m_parsedURL;
String m_invalidUrlString;
+ template<typename MemoruObjectInfo>
+ void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
+ {
+ typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this);
+ info.addInstrumentedMember(m_parsedURL);
+ info.addInstrumentedMember(m_invalidUrlString);
+ }
PassRefPtr<KURLWTFURLImpl> copy() const;
};
Modified: trunk/Source/WebKit/chromium/ChangeLog (128447 => 128448)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-09-13 12:12:19 UTC (rev 128448)
@@ -1,3 +1,22 @@
+2012-09-13 Ilya Tikhonovsky <[email protected]>
+
+ Web Inspector: NMI: instrument KURL directly.
+ https://bugs.webkit.org/show_bug.cgi?id=96624
+
+ Reviewed by Yury Semikhatsky.
+
+ I replaced traits based instrumentation of KURL with reportMemoryUsage functions.
+ CString* were also instrumented.
+
+ Drive by fix: Instrumentation code in QualifiedName was moved to cpp.
+
+ * tests/MemoryInstrumentationTest.cpp:
+ (WebCore):
+ (InstrumentedOwner):
+ (WebCore::InstrumentedOwner::InstrumentedOwner):
+ (WebCore::InstrumentedOwner::reportMemoryUsage):
+ (WebCore::TEST):
+
2012-09-13 Sheriff Bot <[email protected]>
Unreviewed, rolling out r128409.
Modified: trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp (128447 => 128448)
--- trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp 2012-09-13 12:11:35 UTC (rev 128447)
+++ trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp 2012-09-13 12:12:19 UTC (rev 128448)
@@ -40,6 +40,7 @@
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
#include <wtf/text/AtomicString.h>
+#include <wtf/text/CString.h>
#include <wtf/text/StringImpl.h>
#include <wtf/text/WTFString.h>
@@ -228,27 +229,50 @@
EXPECT_EQ(2, visitedObjects.size());
}
-class StringOwnerInstrumented {
+template<typename T>
+class InstrumentedOwner {
public:
- StringOwnerInstrumented() : m_name("string") { }
+ template<typename V>
+ InstrumentedOwner(const V& value) : m_value(value) { }
void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
- info.addInstrumentedMember(m_name);
+ info.addInstrumentedMember(m_value);
}
- String m_name;
+ T m_value;
};
TEST(MemoryInstrumentationTest, visitStrings)
{
- VisitedObjects visitedObjects;
- MemoryInstrumentationImpl impl(visitedObjects);
- StringOwnerInstrumented stringOwnerInstrumented;
- stringOwnerInstrumented.m_name.characters(); // Force 16bit shadow creation.
- impl.addRootObject(stringOwnerInstrumented);
- EXPECT_EQ(sizeof(StringImpl) + stringOwnerInstrumented.m_name.length() * 2, impl.reportedSizeForAllTypes());
- EXPECT_EQ(2, visitedObjects.size());
+ {
+ VisitedObjects visitedObjects;
+ MemoryInstrumentationImpl impl(visitedObjects);
+ InstrumentedOwner<String> stringInstrumentedOwner("String");
+ stringInstrumentedOwner.m_value.characters(); // Force 16bit shadow creation.
+ impl.addRootObject(stringInstrumentedOwner);
+ EXPECT_EQ(sizeof(StringImpl) + stringInstrumentedOwner.m_value.length() * 2, impl.reportedSizeForAllTypes());
+ EXPECT_EQ(2, visitedObjects.size());
+ }
+
+ {
+ VisitedObjects visitedObjects;
+ MemoryInstrumentationImpl impl(visitedObjects);
+ InstrumentedOwner<AtomicString> atomicStringInstrumentedOwner("AtomicString");
+ atomicStringInstrumentedOwner.m_value.string().characters(); // Force 16bit shadow creation.
+ impl.addRootObject(atomicStringInstrumentedOwner);
+ EXPECT_EQ(sizeof(StringImpl) + atomicStringInstrumentedOwner.m_value.length() * 2, impl.reportedSizeForAllTypes());
+ EXPECT_EQ(2, visitedObjects.size());
+ }
+
+ {
+ VisitedObjects visitedObjects;
+ MemoryInstrumentationImpl impl(visitedObjects);
+ InstrumentedOwner<CString> cStringInstrumentedOwner("CString");
+ impl.addRootObject(cStringInstrumentedOwner);
+ EXPECT_EQ(sizeof(WTF::CStringBuffer) + cStringInstrumentedOwner.m_value.length(), impl.reportedSizeForAllTypes());
+ EXPECT_EQ(1, visitedObjects.size());
+ }
}
} // namespace