Diff
Modified: trunk/Source/WebCore/ChangeLog (121143 => 121144)
--- trunk/Source/WebCore/ChangeLog 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/ChangeLog 2012-06-25 09:26:50 UTC (rev 121144)
@@ -1,3 +1,54 @@
+2012-06-22 Yury Semikhatsky <[email protected]>
+
+ Web Inspector: add external resources size to the native memory diagram
+ https://bugs.webkit.org/show_bug.cgi?id=89754
+
+ Reviewed by Vsevolod Vlasov.
+
+ Size of external strings and arrays is now reported through the inspector
+ protocol and displayed on the native memory chart.
+
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/ScriptProfiler.h:
+ (WebCore):
+ (WebCore::ScriptProfiler::visitJSDOMWrappers):
+ (WebCore::ScriptProfiler::visitExternalJSStrings):
+ (WebCore::ScriptProfiler::visitExternalJSArrays):
+ * bindings/v8/ScriptProfiler.cpp:
+ (WebCore::ScriptProfiler::visitJSDOMWrappers):
+ (WebCore::ScriptProfiler::visitExternalJSStrings):
+ (WebCore::ScriptProfiler::visitExternalJSArrays):
+ (WebCore):
+ * bindings/v8/ScriptProfiler.h:
+ (WebCore):
+ (ScriptProfiler):
+ * bindings/v8/V8Binding.cpp:
+ (WebCore::WebCoreStringResource::visitStrings):
+ (WebCore::V8BindingPerIsolateData::visitJSExternalStrings):
+ * bindings/v8/V8Binding.h:
+ (WebCore):
+ (V8BindingPerIsolateData):
+ * inspector/BindingVisitors.h: Renamed from Source/WebCore/inspector/DOMWrapperVisitor.h.
+ (WTF):
+ (WebCore):
+ (NodeWrapperVisitor):
+ (WebCore::NodeWrapperVisitor::~NodeWrapperVisitor):
+ (ExternalStringVisitor):
+ (WebCore::ExternalStringVisitor::~ExternalStringVisitor):
+ (ExternalArrayVisitor):
+ (WebCore::ExternalArrayVisitor::~ExternalArrayVisitor):
+ * inspector/InspectorMemoryAgent.cpp:
+ (MemoryBlockName):
+ (WebCore):
+ (WebCore::jsExternalResourcesInfo):
+ (WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):
+ * inspector/front-end/NativeMemorySnapshotView.js:
+ (WebInspector.MemoryBlockViewProperties._initialize):
+
2012-06-24 Fumitoshi Ukai <[email protected]>
Unreviewed compile error fix of Chromium Win Release.
Modified: trunk/Source/WebCore/GNUmakefile.list.am (121143 => 121144)
--- trunk/Source/WebCore/GNUmakefile.list.am 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/GNUmakefile.list.am 2012-06-25 09:26:50 UTC (rev 121144)
@@ -2642,6 +2642,7 @@
Source/WebCore/icu/unicode/utf_old.h \
Source/WebCore/icu/unicode/utypes.h \
Source/WebCore/icu/unicode/uversion.h \
+ Source/WebCore/inspector/BindingVisitors.h \
Source/WebCore/inspector/ConsoleMessage.cpp \
Source/WebCore/inspector/ConsoleMessage.h \
Source/WebCore/inspector/ContentSearchUtils.cpp \
@@ -2652,7 +2653,6 @@
Source/WebCore/inspector/DOMNodeHighlighter.h \
Source/WebCore/inspector/DOMPatchSupport.cpp \
Source/WebCore/inspector/DOMPatchSupport.h \
- Source/WebCore/inspector/DOMWrapperVisitor.h \
Source/WebCore/inspector/IdentifiersFactory.cpp \
Source/WebCore/inspector/IdentifiersFactory.h \
Source/WebCore/inspector/InjectedScript.cpp \
Modified: trunk/Source/WebCore/Target.pri (121143 => 121144)
--- trunk/Source/WebCore/Target.pri 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/Target.pri 2012-06-25 09:26:50 UTC (rev 121144)
@@ -2035,12 +2035,12 @@
html/track/WebVTTParser.h \
html/track/WebVTTToken.h \
html/track/WebVTTTokenizer.h \
+ inspector/BindingVisitor.h \
inspector/ConsoleMessage.h \
inspector/ContentSearchUtils.h \
inspector/DOMEditor.h \
inspector/DOMNodeHighlighter.h \
inspector/DOMPatchSupport.h \
- inspector/DOMWrapperVisitor.h \
inspector/IdentifiersFactory.h \
inspector/InjectedScript.h \
inspector/InjectedScriptBase.h \
Modified: trunk/Source/WebCore/WebCore.gypi (121143 => 121144)
--- trunk/Source/WebCore/WebCore.gypi 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/WebCore.gypi 2012-06-25 09:26:50 UTC (rev 121144)
@@ -2753,6 +2753,7 @@
'icu/unicode/utf_old.h',
'icu/unicode/utypes.h',
'icu/unicode/uversion.h',
+ 'inspector/BindingVisitors.h',
'inspector/ConsoleMessage.cpp',
'inspector/ConsoleMessage.h',
'inspector/ContentSearchUtils.cpp',
@@ -2763,7 +2764,6 @@
'inspector/DOMNodeHighlighter.h',
'inspector/DOMPatchSupport.cpp',
'inspector/DOMPatchSupport.h',
- 'inspector/DOMWrapperVisitor.h',
'inspector/IdentifiersFactory.cpp',
'inspector/IdentifiersFactory.h',
'inspector/InjectedScript.cpp',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (121143 => 121144)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2012-06-25 09:26:50 UTC (rev 121144)
@@ -73187,6 +73187,10 @@
Name="inspector"
>
<File
+ RelativePath="..\inspector\BindingVisitors.h"
+ >
+ </File>
+ <File
RelativePath="..\inspector\ConsoleMessage.cpp"
>
<FileConfiguration
@@ -73307,10 +73311,6 @@
>
</File>
<File
- RelativePath="..\inspector\DOMWrapperVisitor.h"
- >
- </File>
- <File
RelativePath="..\inspector\IdentifiersFactory.cpp"
>
<FileConfiguration
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (121143 => 121144)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2012-06-25 09:26:50 UTC (rev 121144)
@@ -6120,7 +6120,7 @@
F34742E81343635000531BC2 /* WorkerScriptDebugServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F34742E61343635000531BC2 /* WorkerScriptDebugServer.cpp */; };
F34742E91343635000531BC2 /* WorkerScriptDebugServer.h in Headers */ = {isa = PBXBuildFile; fileRef = F34742E71343635000531BC2 /* WorkerScriptDebugServer.h */; };
F350B73513F1377D00880C43 /* InstrumentingAgents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F350B73413F1377D00880C43 /* InstrumentingAgents.cpp */; };
- F35AE5AC14925F5B004D5776 /* DOMWrapperVisitor.h in Headers */ = {isa = PBXBuildFile; fileRef = F35AE5AB14925F5B004D5776 /* DOMWrapperVisitor.h */; };
+ F35AE5AC14925F5B004D5776 /* BindingVisitors.h in Headers */ = {isa = PBXBuildFile; fileRef = F35AE5AB14925F5B004D5776 /* BindingVisitors.h */; };
F3644AFF1119805900E0D537 /* InjectedScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3644AFD1119805900E0D537 /* InjectedScript.cpp */; };
F3644B001119805900E0D537 /* InjectedScript.h in Headers */ = {isa = PBXBuildFile; fileRef = F3644AFE1119805900E0D537 /* InjectedScript.h */; };
F36E07A41358A8BE00AACBC9 /* WorkerInspectorController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F36E07A21358A8BE00AACBC9 /* WorkerInspectorController.cpp */; };
@@ -13388,7 +13388,7 @@
F34742E61343635000531BC2 /* WorkerScriptDebugServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerScriptDebugServer.cpp; sourceTree = "<group>"; };
F34742E71343635000531BC2 /* WorkerScriptDebugServer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerScriptDebugServer.h; sourceTree = "<group>"; };
F350B73413F1377D00880C43 /* InstrumentingAgents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InstrumentingAgents.cpp; sourceTree = "<group>"; };
- F35AE5AB14925F5B004D5776 /* DOMWrapperVisitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWrapperVisitor.h; sourceTree = "<group>"; };
+ F35AE5AB14925F5B004D5776 /* BindingVisitors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BindingVisitors.h; sourceTree = "<group>"; };
F3644AFD1119805900E0D537 /* InjectedScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedScript.cpp; sourceTree = "<group>"; };
F3644AFE1119805900E0D537 /* InjectedScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedScript.h; sourceTree = "<group>"; };
F36E07A21358A8BE00AACBC9 /* WorkerInspectorController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerInspectorController.cpp; sourceTree = "<group>"; };
@@ -14414,6 +14414,7 @@
isa = PBXGroup;
children = (
1C81B9590E97330800266E07 /* front-end */,
+ F35AE5AB14925F5B004D5776 /* BindingVisitors.h */,
41F0618D0F5F069800A07EAC /* ConsoleMessage.cpp */,
41F0618C0F5F069800A07EAC /* ConsoleMessage.h */,
59102FB914327D3B003C9D04 /* ContentSearchUtils.cpp */,
@@ -14424,7 +14425,6 @@
4F1442271339FD6200E0D6F8 /* DOMNodeHighlighter.h */,
7A54881614E432A1006AE05A /* DOMPatchSupport.cpp */,
7A54881514E432A1006AE05A /* DOMPatchSupport.h */,
- F35AE5AB14925F5B004D5776 /* DOMWrapperVisitor.h */,
5913A23F13D49EBA00F5B05C /* IdentifiersFactory.cpp */,
5913A24013D49EBA00F5B05C /* IdentifiersFactory.h */,
F3644AFD1119805900E0D537 /* InjectedScript.cpp */,
@@ -22036,6 +22036,7 @@
938192050F87E1EC00D5352A /* BinaryPropertyList.h in Headers */,
A622A8FB122C44A600A785B3 /* BindingSecurity.h in Headers */,
A622A8FD122C44A600A785B3 /* BindingSecurityBase.h in Headers */,
+ F35AE5AC14925F5B004D5776 /* BindingVisitors.h in Headers */,
FD31608D12B026F700C1A359 /* Biquad.h in Headers */,
FD31602512B0267600C1A359 /* BiquadDSPKernel.h in Headers */,
FDC54F051399B0DA008D9117 /* BiquadFilterNode.h in Headers */,
@@ -22920,7 +22921,6 @@
97D2AD0414B823A60093DF32 /* DOMWindowProperty.h in Headers */,
89F60B11157F686E0075E157 /* DOMWindowQuota.h in Headers */,
A8CCBB49151F831600AB7CE9 /* DOMWindowWebDatabase.h in Headers */,
- F35AE5AC14925F5B004D5776 /* DOMWrapperVisitor.h in Headers */,
BC53DA2E1143121E000D817E /* DOMWrapperWorld.h in Headers */,
1A1D13800A5325520064BF5F /* DOMXPath.h in Headers */,
858015CE0ABCA75D0080588D /* DOMXPathException.h in Headers */,
Modified: trunk/Source/WebCore/bindings/js/ScriptProfiler.h (121143 => 121144)
--- trunk/Source/WebCore/bindings/js/ScriptProfiler.h 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/bindings/js/ScriptProfiler.h 2012-06-25 09:26:50 UTC (rev 121144)
@@ -36,7 +36,9 @@
namespace WebCore {
-class DOMWrapperVisitor;
+class ExternalArrayVisitor;
+class ExternalStringVisitor;
+class NodeWrapperVisitor;
class Page;
class ScriptObject;
class ScriptValue;
@@ -72,8 +74,9 @@
static bool isSampling() { return false; }
static bool hasHeapProfiler() { return false; }
// FIXME: Implement this counter for JSC. See bug 73936 for more details.
- static void visitJSDOMWrappers(DOMWrapperVisitor*) { }
- static void visitExternalJSStrings(DOMWrapperVisitor*) { }
+ static void visitNodeWrappers(NodeWrapperVisitor*) { }
+ static void visitExternalStrings(ExternalStringVisitor*) { }
+ static void visitExternalArrays(ExternalArrayVisitor*) { }
static size_t profilerSnapshotsSize() { return 0; }
};
Modified: trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp (121143 => 121144)
--- trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/bindings/v8/ScriptProfiler.cpp 2012-06-25 09:26:50 UTC (rev 121144)
@@ -32,9 +32,10 @@
#if ENABLE(INSPECTOR)
#include "ScriptProfiler.h"
-#include "DOMWrapperVisitor.h"
+#include "BindingVisitors.h"
#include "RetainedDOMInfo.h"
#include "ScriptObject.h"
+#include "V8ArrayBufferView.h"
#include "V8Binding.h"
#include "V8DOMMap.h"
#include "V8Node.h"
@@ -175,27 +176,49 @@
v8::HeapProfiler::DefineWrapperClass(v8DOMSubtreeClassId, &retainedDOMInfo);
}
-void ScriptProfiler::visitJSDOMWrappers(DOMWrapperVisitor* visitor)
+void ScriptProfiler::visitNodeWrappers(NodeWrapperVisitor* visitor)
{
class VisitorAdapter : public DOMWrapperMap<Node>::Visitor {
public:
- VisitorAdapter(DOMWrapperVisitor* visitor) : m_visitor(visitor) { }
+ VisitorAdapter(NodeWrapperVisitor* visitor) : m_visitor(visitor) { }
virtual void visitDOMWrapper(DOMDataStore*, Node* node, v8::Persistent<v8::Object>)
{
m_visitor->visitNode(node);
}
private:
- DOMWrapperVisitor* m_visitor;
+ NodeWrapperVisitor* m_visitor;
} adapter(visitor);
visitDOMNodes(&adapter);
}
-void ScriptProfiler::visitExternalJSStrings(DOMWrapperVisitor* visitor)
+void ScriptProfiler::visitExternalStrings(ExternalStringVisitor* visitor)
{
- V8BindingPerIsolateData::current()->visitJSExternalStrings(visitor);
+ V8BindingPerIsolateData::current()->visitExternalStrings(visitor);
}
+void ScriptProfiler::visitExternalArrays(ExternalArrayVisitor* visitor)
+{
+ class VisitorAdapter : public DOMWrapperMap<void>::Visitor {
+ public:
+ VisitorAdapter(ExternalArrayVisitor* visitor) : m_visitor(visitor) { }
+
+ virtual void visitDOMWrapper(DOMDataStore*, void* impl, v8::Persistent<v8::Object> v8Object)
+ {
+ WrapperTypeInfo* type = V8DOMWrapper::domWrapperType(v8Object);
+ if (!type->isSubclass(&V8ArrayBufferView::info))
+ return;
+ ArrayBufferView* arrayBufferView = V8ArrayBufferView::toNative(v8Object);
+ m_visitor->visitJSExternalArray(arrayBufferView);
+ }
+ private:
+ ExternalArrayVisitor* m_visitor;
+ } adapter(visitor);
+
+ getDOMObjectMap().visit(0, &adapter);
+
+}
+
size_t ScriptProfiler::profilerSnapshotsSize()
{
return v8::HeapProfiler::GetMemorySizeUsedByProfiler();
Modified: trunk/Source/WebCore/bindings/v8/ScriptProfiler.h (121143 => 121144)
--- trunk/Source/WebCore/bindings/v8/ScriptProfiler.h 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/bindings/v8/ScriptProfiler.h 2012-06-25 09:26:50 UTC (rev 121144)
@@ -40,7 +40,9 @@
namespace WebCore {
-class DOMWrapperVisitor;
+class ExternalArrayVisitor;
+class ExternalStringVisitor;
+class NodeWrapperVisitor;
class Page;
class ScriptObject;
class ScriptValue;
@@ -76,8 +78,9 @@
static bool isSampling() { return true; }
static bool hasHeapProfiler() { return true; }
static void initialize();
- static void visitJSDOMWrappers(DOMWrapperVisitor*);
- static void visitExternalJSStrings(DOMWrapperVisitor*);
+ static void visitNodeWrappers(NodeWrapperVisitor*);
+ static void visitExternalStrings(ExternalStringVisitor*);
+ static void visitExternalArrays(ExternalArrayVisitor*);
static size_t profilerSnapshotsSize();
};
Modified: trunk/Source/WebCore/bindings/v8/V8Binding.cpp (121143 => 121144)
--- trunk/Source/WebCore/bindings/v8/V8Binding.cpp 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.cpp 2012-06-25 09:26:50 UTC (rev 121144)
@@ -31,8 +31,8 @@
#include "config.h"
#include "V8Binding.h"
+#include "BindingVisitors.h"
#include "DOMStringList.h"
-#include "DOMWrapperVisitor.h"
#include "Element.h"
#include "PlatformString.h"
#include "QualifiedName.h"
@@ -150,7 +150,7 @@
return m_atomicString;
}
- void visitStrings(DOMWrapperVisitor* visitor)
+ void visitStrings(ExternalStringVisitor* visitor)
{
visitor->visitJSExternalString(m_plainString.impl());
if (m_plainString.impl() != m_atomicString.impl() && !m_atomicString.isNull())
@@ -178,12 +178,12 @@
};
#if ENABLE(INSPECTOR)
-void V8BindingPerIsolateData::visitJSExternalStrings(DOMWrapperVisitor* visitor)
+void V8BindingPerIsolateData::visitExternalStrings(ExternalStringVisitor* visitor)
{
v8::HandleScope handleScope;
class VisitorImpl : public v8::ExternalResourceVisitor {
public:
- VisitorImpl(DOMWrapperVisitor* visitor) : m_visitor(visitor) { }
+ VisitorImpl(ExternalStringVisitor* visitor) : m_visitor(visitor) { }
virtual ~VisitorImpl() { }
virtual void VisitExternalString(v8::Handle<v8::String> string)
{
@@ -192,7 +192,7 @@
resource->visitStrings(m_visitor);
}
private:
- DOMWrapperVisitor* m_visitor;
+ ExternalStringVisitor* m_visitor;
} v8Visitor(visitor);
v8::V8::VisitExternalResources(&v8Visitor);
}
Modified: trunk/Source/WebCore/bindings/v8/V8Binding.h (121143 => 121144)
--- trunk/Source/WebCore/bindings/v8/V8Binding.h 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/bindings/v8/V8Binding.h 2012-06-25 09:26:50 UTC (rev 121144)
@@ -46,9 +46,9 @@
namespace WebCore {
class DOMStringList;
- class DOMWrapperVisitor;
class EventListener;
class EventTarget;
+ class ExternalStringVisitor;
// FIXME: Remove V8Binding.
class V8Binding {
@@ -146,7 +146,7 @@
StringCache* stringCache() { return &m_stringCache; }
#if ENABLE(INSPECTOR)
- void visitJSExternalStrings(DOMWrapperVisitor*);
+ void visitExternalStrings(ExternalStringVisitor*);
#endif
DOMDataList& allStores() { return m_domDataList; }
Copied: trunk/Source/WebCore/inspector/BindingVisitors.h (from rev 121143, trunk/Source/WebCore/inspector/DOMWrapperVisitor.h) (0 => 121144)
--- trunk/Source/WebCore/inspector/BindingVisitors.h (rev 0)
+++ trunk/Source/WebCore/inspector/BindingVisitors.h 2012-06-25 09:26:50 UTC (rev 121144)
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2011 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:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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 BindingVisitors_h
+#define BindingVisitors_h
+
+namespace WTF {
+class ArrayBufferView;
+class StringImpl;
+}
+
+namespace WebCore {
+
+class Node;
+
+class NodeWrapperVisitor {
+public:
+ virtual void visitNode(Node*) = 0;
+protected:
+ virtual ~NodeWrapperVisitor() { }
+};
+
+class ExternalStringVisitor {
+public:
+ virtual void visitJSExternalString(WTF::StringImpl*) = 0;
+protected:
+ virtual ~ExternalStringVisitor() { }
+};
+
+
+class ExternalArrayVisitor {
+public:
+ virtual void visitJSExternalArray(WTF::ArrayBufferView*) = 0;
+protected:
+ virtual ~ExternalArrayVisitor() { }
+};
+
+} // namespace WebCore
+
+#endif // BindingVisitors_h
Deleted: trunk/Source/WebCore/inspector/DOMWrapperVisitor.h (121143 => 121144)
--- trunk/Source/WebCore/inspector/DOMWrapperVisitor.h 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/inspector/DOMWrapperVisitor.h 2012-06-25 09:26:50 UTC (rev 121144)
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2011 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:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. 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.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") 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 APPLE AND ITS 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 APPLE OR ITS 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 DOMWrapperVisitor_h
-#define DOMWrapperVisitor_h
-
-namespace WebCore {
-
-class Node;
-
-class DOMWrapperVisitor {
-public:
- virtual void visitNode(Node*) = 0;
- virtual void visitJSExternalString(StringImpl*) = 0;
-protected:
- virtual ~DOMWrapperVisitor() { }
-};
-
-} // namespace WebCore
-
-#endif // DOMWrapperVisitor_h
Modified: trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp (121143 => 121144)
--- trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp 2012-06-25 09:26:50 UTC (rev 121144)
@@ -34,8 +34,8 @@
#include "InspectorMemoryAgent.h"
+#include "BindingVisitors.h"
#include "CharacterData.h"
-#include "DOMWrapperVisitor.h"
#include "Document.h"
#include "EventListenerMap.h"
#include "Frame.h"
@@ -51,6 +51,8 @@
#include "ScriptGCEvent.h"
#include "ScriptProfiler.h"
#include "StyledElement.h"
+#include <wtf/ArrayBuffer.h>
+#include <wtf/ArrayBufferView.h>
#include <wtf/HashSet.h>
#include <wtf/text/StringBuilder.h>
@@ -67,6 +69,9 @@
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 memoryCache[] = "MemoryCache";
static const char processPrivateMemory[] = "ProcessPrivateMemory";
@@ -94,9 +99,9 @@
return node->nodeName().lower();
}
-int stringSize(StringImpl* string)
+size_t stringSize(StringImpl* string)
{
- int size = string->length();
+ size_t size = string->length();
if (!string->is8Bit())
size *= 2;
return size + sizeof(*string);
@@ -218,7 +223,7 @@
CharacterDataStatistics& m_characterDataStatistics;
};
-class CounterVisitor : public DOMWrapperVisitor {
+class CounterVisitor : public NodeWrapperVisitor, public ExternalStringVisitor {
public:
CounterVisitor(Page* page)
: m_page(page)
@@ -308,6 +313,34 @@
int m_sharedStringSize;
};
+class ExternalResourceVisitor : public ExternalStringVisitor, public ExternalArrayVisitor {
+public:
+ ExternalResourceVisitor()
+ : m_jsExternalStringSize(0)
+ , m_externalArraySize(0)
+ { }
+
+ size_t externalStringSize() const { return m_jsExternalStringSize; }
+ size_t externalArraySize() const { return m_externalArraySize; }
+
+private:
+ virtual void visitJSExternalArray(ArrayBufferView* bufferView)
+ {
+ ArrayBuffer* buffer = bufferView->buffer().get();
+ if (m_arrayBuffers.add(buffer).isNewEntry)
+ m_externalArraySize += buffer->byteLength();
+ }
+ virtual void visitJSExternalString(StringImpl* string)
+ {
+ int size = stringSize(string);
+ m_jsExternalStringSize += size;
+ }
+
+ size_t m_jsExternalStringSize;
+ size_t m_externalArraySize;
+ HashSet<ArrayBuffer*> m_arrayBuffers;
+};
+
} // namespace
InspectorMemoryAgent::~InspectorMemoryAgent()
@@ -317,7 +350,7 @@
void InspectorMemoryAgent::getDOMNodeCount(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Memory::DOMGroup> >& domGroups, RefPtr<TypeBuilder::Memory::StringStatistics>& strings)
{
CounterVisitor counterVisitor(m_page);
- ScriptProfiler::visitJSDOMWrappers(&counterVisitor);
+ ScriptProfiler::visitNodeWrappers(&counterVisitor);
// Make sure all documents reachable from the main frame are accounted.
for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
@@ -325,7 +358,7 @@
counterVisitor.visitNode(doc);
}
- ScriptProfiler::visitExternalJSStrings(&counterVisitor);
+ ScriptProfiler::visitExternalStrings(&counterVisitor);
domGroups = counterVisitor.domGroups();
strings = counterVisitor.strings();
@@ -424,7 +457,7 @@
VisitedObjects m_visitedObjects;
};
-class DOMTreesIterator : public DOMWrapperVisitor {
+class DOMTreesIterator : public NodeWrapperVisitor {
public:
explicit DOMTreesIterator(Page* page) : m_page(page) { }
@@ -436,8 +469,6 @@
m_domMemoryUsage.reportInstrumentedPointer(node);
}
- virtual void visitJSExternalString(StringImpl*) { }
-
PassRefPtr<InspectorMemoryBlock> dumpStatistics() { return m_domMemoryUsage.dumpStatistics(); }
private:
@@ -450,7 +481,7 @@
static PassRefPtr<InspectorMemoryBlock> domTreeInfo(Page* page)
{
DOMTreesIterator domTreesIterator(page);
- ScriptProfiler::visitJSDOMWrappers(&domTreesIterator);
+ ScriptProfiler::visitNodeWrappers(&domTreesIterator);
// Make sure all documents reachable from the main frame are accounted.
for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) {
@@ -482,6 +513,27 @@
return memoryCacheStats.release();
}
+static PassRefPtr<InspectorMemoryBlock> jsExternalResourcesInfo()
+{
+ ExternalResourceVisitor visitor;
+ 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();
+}
+
void InspectorMemoryAgent::getProcessMemoryDistribution(ErrorString*, RefPtr<InspectorMemoryBlock>& processMemory)
{
size_t privateBytes = 0;
@@ -492,6 +544,7 @@
RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children = TypeBuilder::Array<InspectorMemoryBlock>::create();
children->addItem(jsHeapInfo());
+ children->addItem(jsExternalResourcesInfo());
children->addItem(inspectorData());
children->addItem(memoryCacheInfo());
children->addItem(renderTreeInfo(m_page)); // TODO: collect for all pages?
Modified: trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js (121143 => 121144)
--- trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js 2012-06-25 08:42:39 UTC (rev 121143)
+++ trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js 2012-06-25 09:26:50 UTC (rev 121144)
@@ -218,6 +218,9 @@
addBlock("hsl( 0, 0%, 80%)", "Other", "Other");
addBlock("hsl( 90, 60%, 80%)", "JSHeapAllocated", "_javascript_ heap");
addBlock("hsl( 90, 80%, 80%)", "JSHeapUsed", "Used _javascript_ heap");
+ addBlock("hsl( 90, 30%, 80%)", "JSExternalResources", "_javascript_ external resources");
+ addBlock("hsl( 90, 40%, 80%)", "JSExternalArrays", "_javascript_ external arrays");
+ addBlock("hsl( 90, 50%, 80%)", "JSExternalStrings", "_javascript_ external strings");
addBlock("hsl(210, 60%, 80%)", "InspectorData", "Inspector data");
addBlock("hsl( 30, 60%, 80%)", "MemoryCache", "Memory cache resources");
addBlock("hsl( 60, 60%, 80%)", "RenderTreeAllocated", "Render tree");