Web Inspector: add memory used by memory allocator itself to NMI
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 13:32:48 +0000 (13:32 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Dec 2012 13:32:48 +0000 (13:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=93372

Make native memory instrumentation report memory retained
for the memory allocator internal purposes.

Patch by Alexei Filippov <alph@chromium.org> on 2012-12-12
Reviewed by Yury Semikhatsky.

Source/Platform:

* chromium/public/Platform.h:
(Platform):
(WebKit::Platform::memoryAllocatorWasteInBytes):

Source/WebCore:

* inspector/front-end/NativeMemorySnapshotView.js:
(WebInspector.MemoryBlockViewProperties._initialize):
* platform/chromium/MemoryUsageSupportChromium.cpp:
(WebCore::MemoryUsageSupport::memoryUsageByComponents):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137457 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/Platform/ChangeLog
Source/Platform/chromium/public/Platform.h
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js
Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp

index 036f887..3ef21fe 100644 (file)
@@ -1,3 +1,17 @@
+2012-12-12  Alexei Filippov  <alph@chromium.org>
+
+        Web Inspector: add memory used by memory allocator itself to NMI
+        https://bugs.webkit.org/show_bug.cgi?id=93372
+
+        Make native memory instrumentation report memory retained
+        for the memory allocator internal purposes.
+
+        Reviewed by Yury Semikhatsky.
+
+        * chromium/public/Platform.h:
+        (Platform):
+        (WebKit::Platform::memoryAllocatorWasteInBytes):
+
 2012-12-12  Tommy Widenflycht  <tommyw@google.com>
 
         MediaStream API: Change the data channel descriptor pattern to a handler pattern
index bd80f06..9f8d53c 100644 (file)
@@ -212,6 +212,10 @@ public:
     // false on platform specific error conditions.
     virtual bool processMemorySizesInBytes(size_t* privateBytes, size_t* sharedBytes) { return false; }
 
+    // Reports number of bytes used by memory allocator for internal needs.
+    // Returns true if the size has been reported, or false otherwise.
+    virtual bool memoryAllocatorWasteInBytes(size_t*) { return false; }
+
 
     // Message Ports -------------------------------------------------------
 
index 25fa810..8a4abea 100644 (file)
@@ -1,3 +1,18 @@
+2012-12-12  Alexei Filippov  <alph@chromium.org>
+
+        Web Inspector: add memory used by memory allocator itself to NMI
+        https://bugs.webkit.org/show_bug.cgi?id=93372
+
+        Make native memory instrumentation report memory retained
+        for the memory allocator internal purposes.
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/NativeMemorySnapshotView.js:
+        (WebInspector.MemoryBlockViewProperties._initialize):
+        * platform/chromium/MemoryUsageSupportChromium.cpp:
+        (WebCore::MemoryUsageSupport::memoryUsageByComponents):
+
 2012-12-12  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r137438.
index d43099c..46a8e58 100644 (file)
@@ -396,6 +396,7 @@ WebInspector.MemoryBlockViewProperties._initialize = function()
     addBlock("hsl( 40, 80%,  80%)", "GlyphCache", "Glyph cache resources");
     addBlock("hsl( 35, 80%,  80%)", "DOMStorageCache", "DOM storage cache");
     addBlock("hsl( 60, 80%,  60%)", "RenderTree", "Render tree");
+    addBlock("hsl( 20, 80%,  50%)", "MallocWaste", "Memory allocator waste");
 }
 
 WebInspector.MemoryBlockViewProperties._forMemoryBlock = function(memoryBlock)
index 0fb570f..6d09242 100644 (file)
@@ -70,6 +70,9 @@ void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>& componen
 {
     size_t size = SkGraphics::GetFontCacheUsed();
     components.append(ComponentInfo("GlyphCache", size));
+
+    if (WebKit::Platform::current()->memoryAllocatorWasteInBytes(&size))
+        components.append(ComponentInfo("MallocWaste", size));
 }
 
 } // namespace WebCore