Title: [129649] trunk/Source
Revision
129649
Author
[email protected]
Date
2012-09-26 08:21:23 -0700 (Wed, 26 Sep 2012)

Log Message

Web Inspector: NMI: replace manual JS external resources counting with MemoryInstrumentation
https://bugs.webkit.org/show_bug.cgi?id=97662

Reviewed by Yury Semikhatsky.

Source/WebCore:

Old schema uses sizeInBytes method on StringImpl. This method works incorrect for substrings.
Also we'd like to know exact pointers to strings and buffers for verification purposes.

* dom/WebCoreMemoryInstrumentation.cpp:
(WebCore):
* dom/WebCoreMemoryInstrumentation.h:
(WebCoreMemoryTypes):
* inspector/InspectorMemoryAgent.cpp:
(MemoryBlockName):
(WebCore):
(WebCore::collectDomTreeInfo):
(WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):

Source/WebKit/chromium:

Old schema used sizeInBytes method on StringImpl. This method works incorrect for substrings.
Also we'd like to know exact pointers to strings and buffers for verification purposes.

* tests/MemoryInstrumentationTest.cpp:
(WebCore::TEST):
(WebCore):

Source/WTF:

Old schema uses sizeInBytes method on StringImpl. This method works incorrect for substrings.
Also we'd like to know exact pointers to strings and buffers for verification purposes.

* GNUmakefile.list.am:
* WTF.gypi:
* WTF.pro:
* WTF.vcproj/WTF.vcproj:
* WTF.xcodeproj/project.pbxproj:
* wtf/MemoryInstrumentationArrayBufferView.h:
(WTF):
(WTF::reportMemoryUsage):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (129648 => 129649)


--- trunk/Source/WTF/ChangeLog	2012-09-26 15:19:48 UTC (rev 129648)
+++ trunk/Source/WTF/ChangeLog	2012-09-26 15:21:23 UTC (rev 129649)
@@ -1,3 +1,22 @@
+2012-09-26  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: NMI: replace manual JS external resources counting with MemoryInstrumentation
+        https://bugs.webkit.org/show_bug.cgi?id=97662
+
+        Reviewed by Yury Semikhatsky.
+
+        Old schema uses sizeInBytes method on StringImpl. This method works incorrect for substrings.
+        Also we'd like to know exact pointers to strings and buffers for verification purposes.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/MemoryInstrumentationArrayBufferView.h:
+        (WTF):
+        (WTF::reportMemoryUsage):
+
 2012-09-25  Ilya Tikhonovsky  <[email protected]>
 
         Web Inspector: extract HashSet instrumentation from core NMI code and put it into MemoryInstrumentationHashSet.h

Modified: trunk/Source/WTF/GNUmakefile.list.am (129648 => 129649)


--- trunk/Source/WTF/GNUmakefile.list.am	2012-09-26 15:19:48 UTC (rev 129648)
+++ trunk/Source/WTF/GNUmakefile.list.am	2012-09-26 15:21:23 UTC (rev 129649)
@@ -80,6 +80,7 @@
     Source/WTF/wtf/MediaTime.h \
     Source/WTF/wtf/MediaTime.cpp \
     Source/WTF/wtf/MemoryInstrumentation.h \
+    Source/WTF/wtf/MemoryInstrumentationArrayBufferView.h \
     Source/WTF/wtf/MemoryInstrumentationHashSet.h \
     Source/WTF/wtf/MemoryInstrumentationHashTable.h \
     Source/WTF/wtf/MemoryInstrumentationVector.h \

Modified: trunk/Source/WTF/WTF.gypi (129648 => 129649)


--- trunk/Source/WTF/WTF.gypi	2012-09-26 15:19:48 UTC (rev 129648)
+++ trunk/Source/WTF/WTF.gypi	2012-09-26 15:21:23 UTC (rev 129649)
@@ -50,6 +50,7 @@
             'wtf/MainThread.h',
             'wtf/MathExtras.h',
             'wtf/MemoryInstrumentation.h',
+            'wtf/MemoryInstrumentationArrayBufferView.h',
             'wtf/MemoryInstrumentationHashSet.h',
             'wtf/MemoryInstrumentationHashTable.h',
             'wtf/MemoryInstrumentationVector.h',

Modified: trunk/Source/WTF/WTF.pro (129648 => 129649)


--- trunk/Source/WTF/WTF.pro	2012-09-26 15:19:48 UTC (rev 129648)
+++ trunk/Source/WTF/WTF.pro	2012-09-26 15:21:23 UTC (rev 129649)
@@ -87,6 +87,7 @@
     MD5.h \
     MediaTime.h \
     MemoryInstrumentation.h \
+    MemoryInstrumentationArrayBufferView.h \
     MemoryInstrumentationHashSet.h \
     MemoryInstrumentationHashTable.h \
     MemoryInstrumentationVector.h \

Modified: trunk/Source/WTF/WTF.vcproj/WTF.vcproj (129648 => 129649)


--- trunk/Source/WTF/WTF.vcproj/WTF.vcproj	2012-09-26 15:19:48 UTC (rev 129648)
+++ trunk/Source/WTF/WTF.vcproj/WTF.vcproj	2012-09-26 15:21:23 UTC (rev 129649)
@@ -905,6 +905,10 @@
 			>
 		</File>
 		<File
+		        RelativePath="..\wtf\MemoryInstrumentationArrayBufferView.h"
+			>
+		</File>
+		<File
 		        RelativePath="..\wtf\MemoryInstrumentationHashSet.h"
 			>
 		</File>

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (129648 => 129649)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2012-09-26 15:19:48 UTC (rev 129648)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2012-09-26 15:21:23 UTC (rev 129649)
@@ -44,6 +44,7 @@
 		4F1B2DB6160B44AA00586559 /* MemoryInstrumentationHashSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1B2DB5160B44AA00586559 /* MemoryInstrumentationHashSet.h */; };
 		4F1D115415FF11BE0026E908 /* MemoryInstrumentation.h in Headers */ = {isa = PBXBuildFile; fileRef = 4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */; };
 		4FCB710A160A1A07008425EC /* MemoryInstrumentationVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */; };
+		4FD8554716133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4FD8554616133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h */; };
 		7E29C33E15FFD79B00516D61 /* ObjcRuntimeExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 7E29C33D15FFD79B00516D61 /* ObjcRuntimeExtras.h */; };
 		8134013815B092FD001FF0B8 /* Base64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8134013615B092FD001FF0B8 /* Base64.cpp */; };
 		8134013915B092FD001FF0B8 /* Base64.h in Headers */ = {isa = PBXBuildFile; fileRef = 8134013715B092FD001FF0B8 /* Base64.h */; };
@@ -315,6 +316,7 @@
 		4F1B2DB5160B44AA00586559 /* MemoryInstrumentationHashSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationHashSet.h; sourceTree = "<group>"; };
 		4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentation.h; sourceTree = "<group>"; };
 		4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationVector.h; sourceTree = "<group>"; };
+		4FD8554616133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationArrayBufferView.h; sourceTree = "<group>"; };
 		5D247B6214689B8600E78B76 /* libWTF.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libWTF.a; sourceTree = BUILT_PRODUCTS_DIR; };
 		5D247B6E14689C4700E78B76 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = "<group>"; };
 		5D247B6F14689C4700E78B76 /* CompilerVersion.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = CompilerVersion.xcconfig; sourceTree = "<group>"; };
@@ -696,6 +698,7 @@
 				CD5497AA15857D0300B5BC30 /* MediaTime.cpp */,
 				CD5497AB15857D0300B5BC30 /* MediaTime.h */,
 				4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */,
+				4FD8554616133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h */,
 				4F1B2DB5160B44AA00586559 /* MemoryInstrumentationHashSet.h */,
 				4F0BABBA1611D5F500023F66 /* MemoryInstrumentationHashTable.h */,
 				4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */,
@@ -1153,6 +1156,7 @@
 				4FCB710A160A1A07008425EC /* MemoryInstrumentationVector.h in Headers */,
 				4F1B2DB6160B44AA00586559 /* MemoryInstrumentationHashSet.h in Headers */,
 				4F0BABBB1611D5F500023F66 /* MemoryInstrumentationHashTable.h in Headers */,
+				4FD8554716133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Copied: trunk/Source/WTF/wtf/MemoryInstrumentationArrayBufferView.h (from rev 129648, trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.h) (0 => 129649)


--- trunk/Source/WTF/wtf/MemoryInstrumentationArrayBufferView.h	                        (rev 0)
+++ trunk/Source/WTF/wtf/MemoryInstrumentationArrayBufferView.h	2012-09-26 15:21:23 UTC (rev 129649)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MemoryInstrumentationArrayBufferView_h
+#define MemoryInstrumentationArrayBufferView_h
+
+#include <wtf/ArrayBufferView.h>
+#include <wtf/MemoryInstrumentation.h>
+
+namespace WTF {
+
+inline void reportMemoryUsage(const ArrayBufferView* const& arrayBufferView, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, arrayBufferView);
+    info.addMember(arrayBufferView->buffer().get());
+}
+
+inline void reportMemoryUsage(const ArrayBuffer* const& arrayBuffer, MemoryObjectInfo* memoryObjectInfo)
+{
+    MemoryClassInfo info(memoryObjectInfo, arrayBuffer);
+    info.addRawBuffer(arrayBuffer->data(), arrayBuffer->byteLength());
+}
+
+}
+
+#endif // !defined(MemoryInstrumentationArrayBufferView_h)

Modified: trunk/Source/WebCore/ChangeLog (129648 => 129649)


--- trunk/Source/WebCore/ChangeLog	2012-09-26 15:19:48 UTC (rev 129648)
+++ trunk/Source/WebCore/ChangeLog	2012-09-26 15:21:23 UTC (rev 129649)
@@ -1,3 +1,23 @@
+2012-09-26  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: NMI: replace manual JS external resources counting with MemoryInstrumentation
+        https://bugs.webkit.org/show_bug.cgi?id=97662
+
+        Reviewed by Yury Semikhatsky.
+
+        Old schema uses sizeInBytes method on StringImpl. This method works incorrect for substrings.
+        Also we'd like to know exact pointers to strings and buffers for verification purposes.
+
+        * dom/WebCoreMemoryInstrumentation.cpp:
+        (WebCore):
+        * dom/WebCoreMemoryInstrumentation.h:
+        (WebCoreMemoryTypes):
+        * inspector/InspectorMemoryAgent.cpp:
+        (MemoryBlockName):
+        (WebCore):
+        (WebCore::collectDomTreeInfo):
+        (WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):
+
 2012-09-26  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: [REGRESSION] Revision support problems: revert and apply original content  cause exceptions

Modified: trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.cpp (129648 => 129649)


--- trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.cpp	2012-09-26 15:19:48 UTC (rev 129648)
+++ trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.cpp	2012-09-26 15:21:23 UTC (rev 129649)
@@ -50,4 +50,8 @@
 MemoryObjectType WebCoreMemoryTypes::CachedResourceShader = "MemoryCache.Shader";
 MemoryObjectType WebCoreMemoryTypes::CachedResourceXSLT = "MemoryCache.XSLT";
 
+MemoryObjectType WebCoreMemoryTypes::ExternalResources = "JSExternalResources";
+MemoryObjectType WebCoreMemoryTypes::ExternalStrings = "JSExternalResources.Strings";
+MemoryObjectType WebCoreMemoryTypes::ExternalArrays = "JSExternalResources.Arrays";
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.h (129648 => 129649)


--- trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.h	2012-09-26 15:19:48 UTC (rev 129648)
+++ trunk/Source/WebCore/dom/WebCoreMemoryInstrumentation.h	2012-09-26 15:21:23 UTC (rev 129649)
@@ -56,6 +56,10 @@
     static MemoryObjectType CachedResourceSVG;
     static MemoryObjectType CachedResourceShader;
     static MemoryObjectType CachedResourceXSLT;
+
+    static MemoryObjectType ExternalResources;
+    static MemoryObjectType ExternalStrings;
+    static MemoryObjectType ExternalArrays;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp (129648 => 129649)


--- trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp	2012-09-26 15:19:48 UTC (rev 129648)
+++ trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp	2012-09-26 15:21:23 UTC (rev 129649)
@@ -53,9 +53,9 @@
 #include "ScriptGCEvent.h"
 #include "ScriptProfiler.h"
 #include "StyledElement.h"
-#include <wtf/ArrayBuffer.h>
 #include <wtf/ArrayBufferView.h>
 #include <wtf/HashSet.h>
+#include <wtf/MemoryInstrumentationArrayBufferView.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
@@ -76,9 +76,6 @@
 namespace MemoryBlockName {
 static const char jsHeapAllocated[] = "JSHeapAllocated";
 static const char jsHeapUsed[] = "JSHeapUsed";
-static const char jsExternalResources[] = "JSExternalResources";
-static const char jsExternalArrays[] = "JSExternalArrays";
-static const char jsExternalStrings[] = "JSExternalStrings";
 static const char inspectorData[] = "InspectorData";
 static const char inspectorDOMData[] = "InspectorDOMData";
 static const char inspectorJSHeapData[] = "InspectorJSHeapData";
@@ -305,33 +302,46 @@
     int m_sharedStringSize;
 };
 
-class ExternalResourceVisitor : public ExternalStringVisitor, public ExternalArrayVisitor {
+class ExternalStringsRoot : public ExternalStringVisitor {
 public:
-    explicit ExternalResourceVisitor(VisitedObjects& visitedObjects)
-        : m_visitedObjects(visitedObjects)
-        , m_jsExternalStringSize(0)
-        , m_externalArraySize(0)
-    { }
+    ExternalStringsRoot() : m_memoryClassInfo(0) { }
 
-    size_t externalStringSize() const { return m_jsExternalStringSize; }
-    size_t externalArraySize() const { return m_externalArraySize; }
+    void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+    {
+        MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::ExternalStrings);
+        m_memoryClassInfo = &info;
+        ScriptProfiler::visitExternalStrings(const_cast<ExternalStringsRoot*>(this));
+        m_memoryClassInfo = 0;
+    }
 
 private:
-    virtual void visitJSExternalArray(ArrayBufferView* bufferView)
+    virtual void visitJSExternalString(StringImpl* string)
     {
-        ArrayBuffer* buffer = bufferView->buffer().get();
-        if (m_visitedObjects.add(buffer).isNewEntry)
-            m_externalArraySize += buffer->byteLength();
+        m_memoryClassInfo->addMember(string);
     }
-    virtual void visitJSExternalString(StringImpl* string)
+
+    mutable MemoryClassInfo* m_memoryClassInfo;
+};
+
+class ExternalArraysRoot : public ExternalArrayVisitor {
+public:
+    ExternalArraysRoot() : m_memoryClassInfo(0) { }
+
+    void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
     {
-        if (m_visitedObjects.add(string).isNewEntry)
-            m_jsExternalStringSize += string->sizeInBytes();
+        MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::ExternalArrays);
+        m_memoryClassInfo = &info;
+        ScriptProfiler::visitExternalArrays(const_cast<ExternalArraysRoot*>(this));
+        m_memoryClassInfo = 0;
     }
 
-    VisitedObjects& m_visitedObjects;
-    size_t m_jsExternalStringSize;
-    size_t m_externalArraySize;
+private:
+    virtual void visitJSExternalArray(ArrayBufferView* arrayBufferView)
+    {
+        m_memoryClassInfo->addMember(arrayBufferView);
+    }
+
+    mutable MemoryClassInfo* m_memoryClassInfo;
 };
 
 class InspectorDataCounter {
@@ -493,10 +503,25 @@
         return dom.release();
     }
 
+    PassRefPtr<InspectorMemoryBlock> buildObjectForExternalResources() const
+    {
+        size_t totalSize = 0;
+
+        RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > resourcesChildren = TypeBuilder::Array<InspectorMemoryBlock>::create();
+        totalSize += addMemoryBlockFor(resourcesChildren.get(), WebCoreMemoryTypes::ExternalStrings);
+        totalSize += addMemoryBlockFor(resourcesChildren.get(), WebCoreMemoryTypes::ExternalArrays);
+
+        RefPtr<InspectorMemoryBlock> resources = InspectorMemoryBlock::create().setName(WebCoreMemoryTypes::ExternalResources);
+        resources->setSize(totalSize);
+        resources->setChildren(resourcesChildren.release());
+        return resources.release();
+    }
+
     void dumpStatistics(TypeBuilder::Array<InspectorMemoryBlock>* children, InspectorDataCounter* inspectorData)
     {
         children->addItem(buildObjectForMemoryCache());
         children->addItem(buildObjectForPage());
+        children->addItem(buildObjectForExternalResources());
 
         inspectorData->addComponent(MemoryBlockName::inspectorDOMData, m_memoryInstrumentation.selfSize());
     }
@@ -523,6 +548,12 @@
     inspectorClient->getAllocatedObjects(allocatedObjects);
     MemoryInstrumentationImpl memoryInstrumentation(visitedObjects, allocatedObjects.isEmpty() ? 0 : &allocatedObjects);
 
+    ExternalStringsRoot stringsRoot;
+    memoryInstrumentation.addRootObject(stringsRoot);
+
+    ExternalArraysRoot arraysRoot;
+    memoryInstrumentation.addRootObject(arraysRoot);
+
     DOMTreesIterator domTreesIterator(page, memoryInstrumentation);
 
     ScriptProfiler::visitNodeWrappers(&domTreesIterator);
@@ -552,27 +583,6 @@
     }
 }
 
-static PassRefPtr<InspectorMemoryBlock> jsExternalResourcesInfo(VisitedObjects& visitedObjects)
-{
-    ExternalResourceVisitor visitor(visitedObjects);
-    ScriptProfiler::visitExternalStrings(&visitor);
-    ScriptProfiler::visitExternalArrays(&visitor);
-
-    RefPtr<InspectorMemoryBlock> externalResourcesStats = InspectorMemoryBlock::create().setName(MemoryBlockName::jsExternalResources);
-    externalResourcesStats->setSize(visitor.externalStringSize() + visitor.externalArraySize());
-    RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children = TypeBuilder::Array<InspectorMemoryBlock>::create();
-
-    RefPtr<InspectorMemoryBlock> externalStringStats = InspectorMemoryBlock::create().setName(MemoryBlockName::jsExternalStrings);
-    externalStringStats->setSize(visitor.externalStringSize());
-    children->addItem(externalStringStats);
-
-    RefPtr<InspectorMemoryBlock> externalArrayStats = InspectorMemoryBlock::create().setName(MemoryBlockName::jsExternalArrays);
-    externalArrayStats->setSize(visitor.externalArraySize());
-    children->addItem(externalArrayStats);
-
-    return externalResourcesStats.release();
-}
-
 static PassRefPtr<InspectorMemoryBlock> dumpDOMStorageCache(size_t cacheSize)
 {
     RefPtr<InspectorMemoryBlock> domStorageCache = InspectorMemoryBlock::create().setName(MemoryBlockName::domStorageCache);
@@ -591,7 +601,6 @@
     RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children = TypeBuilder::Array<InspectorMemoryBlock>::create();
     children->addItem(jsHeapInfo());
     children->addItem(renderTreeInfo(m_page)); // FIXME: collect for all pages?
-    children->addItem(jsExternalResourcesInfo(visitedObjects));
     collectDomTreeInfo(m_page, m_inspectorClient, visitedObjects, children.get(), &inspectorData); // FIXME: collect for all pages?
     children->addItem(inspectorData.dumpStatistics());
     children->addItem(dumpDOMStorageCache(m_domStorageAgent->memoryBytesUsedByStorageCache()));

Modified: trunk/Source/WebKit/chromium/ChangeLog (129648 => 129649)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-09-26 15:19:48 UTC (rev 129648)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-09-26 15:21:23 UTC (rev 129649)
@@ -1,3 +1,17 @@
+2012-09-26  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: NMI: replace manual JS external resources counting with MemoryInstrumentation
+        https://bugs.webkit.org/show_bug.cgi?id=97662
+
+        Reviewed by Yury Semikhatsky.
+
+        Old schema used sizeInBytes method on StringImpl. This method works incorrect for substrings.
+        Also we'd like to know exact pointers to strings and buffers for verification purposes.
+
+        * tests/MemoryInstrumentationTest.cpp:
+        (WebCore::TEST):
+        (WebCore):
+
 2012-09-25  Ilya Tikhonovsky  <[email protected]>
 
         Web Inspector: extract HashSet instrumentation from core NMI code and put it into MemoryInstrumentationHashSet.h

Modified: trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp (129648 => 129649)


--- trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp	2012-09-26 15:19:48 UTC (rev 129648)
+++ trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp	2012-09-26 15:21:23 UTC (rev 129649)
@@ -36,7 +36,9 @@
 
 #include <gtest/gtest.h>
 
+#include <wtf/ArrayBuffer.h>
 #include <wtf/HashSet.h>
+#include <wtf/MemoryInstrumentationArrayBufferView.h>
 #include <wtf/MemoryInstrumentationHashSet.h>
 #include <wtf/MemoryInstrumentationVector.h>
 #include <wtf/RefCounted.h>
@@ -457,5 +459,17 @@
     EXPECT_EQ(count + 2, (size_t)visitedObjects.size());
 }
 
+TEST(MemoryInstrumentationTest, arrayBuffer)
+{
+    VisitedObjects visitedObjects;
+    MemoryInstrumentationImpl impl(visitedObjects);
+
+    typedef InstrumentedTemplate<RefPtr<ArrayBuffer> > ValueType;
+    ValueType value(ArrayBuffer::create(1000, sizeof(int)));
+    impl.addRootObject(value);
+    EXPECT_EQ(sizeof(int) * 1000 + sizeof(ArrayBuffer), impl.reportedSizeForAllTypes());
+    EXPECT_EQ(2, visitedObjects.size());
+}
+
 } // namespace
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to