| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "platform/heap/BlinkGCMemoryDumpProvider.h" | 6 #include "platform/heap/BlinkGCMemoryDumpProvider.h" |
| 7 | 7 |
| 8 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
| 9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
| 10 #include "public/platform/WebMemoryAllocatorDump.h" | 10 #include "public/platform/WebMemoryAllocatorDump.h" |
| 11 #include "public/platform/WebProcessMemoryDump.h" | 11 #include "public/platform/WebProcessMemoryDump.h" |
| 12 #include "wtf/StdLibExtras.h" | 12 #include "wtf/StdLibExtras.h" |
| 13 #include "wtf/Threading.h" | 13 #include "wtf/Threading.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 void dumpMemoryTotals(blink::WebProcessMemoryDump* memoryDump) | 18 void dumpMemoryTotals(blink::WebProcessMemoryDump* memoryDump) |
| 19 { | 19 { |
| 20 String dumpName = String::format("blink_gc"); | 20 String dumpName = String::format("blink_gc"); |
| 21 WebMemoryAllocatorDump* allocatorDump = memoryDump->createMemoryAllocatorDum
p(dumpName); | 21 WebMemoryAllocatorDump* allocatorDump = memoryDump->createMemoryAllocatorDum
p(dumpName); |
| 22 allocatorDump->addScalar("size", "bytes", Heap::allocatedSpace()); | 22 allocatorDump->addScalar("size", "bytes", ThreadState::current()->allocatedS
pace()); |
| 23 | 23 |
| 24 dumpName.append("/allocated_objects"); | 24 dumpName.append("/allocated_objects"); |
| 25 WebMemoryAllocatorDump* objectsDump = memoryDump->createMemoryAllocatorDump(
dumpName); | 25 WebMemoryAllocatorDump* objectsDump = memoryDump->createMemoryAllocatorDump(
dumpName); |
| 26 | 26 |
| 27 // Heap::markedObjectSize() can be underestimated if we're still in the | 27 // ThreadState::markedObjectSize() can be underestimated if we're still in t
he |
| 28 // process of lazy sweeping. | 28 // process of lazy sweeping. |
| 29 objectsDump->addScalar("size", "bytes", Heap::allocatedObjectSize() + Heap::
markedObjectSize()); | 29 objectsDump->addScalar("size", "bytes", ThreadState::current()->allocatedObj
ectSize() + ThreadState::current()->markedObjectSize()); |
| 30 } | 30 } |
| 31 | 31 |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 BlinkGCMemoryDumpProvider* BlinkGCMemoryDumpProvider::instance() | 34 BlinkGCMemoryDumpProvider* BlinkGCMemoryDumpProvider::instance() |
| 35 { | 35 { |
| 36 DEFINE_STATIC_LOCAL(BlinkGCMemoryDumpProvider, instance, ()); | 36 DEFINE_STATIC_LOCAL(BlinkGCMemoryDumpProvider, instance, ()); |
| 37 return &instance; | 37 return &instance; |
| 38 } | 38 } |
| 39 | 39 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 65 { | 65 { |
| 66 m_currentProcessMemoryDump->clear(); | 66 m_currentProcessMemoryDump->clear(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() | 69 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() |
| 70 : m_currentProcessMemoryDump(adoptPtr(Platform::current()->createProcessMemo
ryDump())) | 70 : m_currentProcessMemoryDump(adoptPtr(Platform::current()->createProcessMemo
ryDump())) |
| 71 { | 71 { |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace blink | 74 } // namespace blink |
| OLD | NEW |