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 "Source/platform/heap/BlinkGCMemoryDumpProvider.h" | 6 #include "Source/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/WebMemoryAllocatorDump.h" | 10 #include "public/platform/WebMemoryAllocatorDump.h" |
10 #include "public/platform/WebProcessMemoryDump.h" | 11 #include "public/platform/WebProcessMemoryDump.h" |
11 #include "wtf/StdLibExtras.h" | 12 #include "wtf/StdLibExtras.h" |
12 | 13 |
13 namespace blink { | 14 namespace blink { |
14 | 15 |
15 BlinkGCMemoryDumpProvider* BlinkGCMemoryDumpProvider::instance() | 16 BlinkGCMemoryDumpProvider* BlinkGCMemoryDumpProvider::instance() |
16 { | 17 { |
17 DEFINE_STATIC_LOCAL(BlinkGCMemoryDumpProvider, instance, ()); | 18 DEFINE_STATIC_LOCAL(BlinkGCMemoryDumpProvider, instance, ()); |
18 return &instance; | 19 return &instance; |
19 } | 20 } |
20 | 21 |
21 bool BlinkGCMemoryDumpProvider::onMemoryDump(blink::WebProcessMemoryDump* memory Dump) | |
22 { | |
23 WebMemoryAllocatorDump* allocatorDump = memoryDump->createMemoryAllocatorDum p("blink_gc"); | |
24 allocatorDump->AddScalar("inner_size", "bytes", Heap::allocatedObjectSize()) ; | |
25 allocatorDump->AddScalar("outer_size", "bytes", Heap::allocatedSpace()); | |
26 allocatorDump->AddScalar("estimated_live_object_size", "bytes", Heap::estima tedLiveObjectSize()); | |
27 return true; | |
28 } | |
29 | |
30 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() | |
31 { | |
32 } | |
33 | |
34 BlinkGCMemoryDumpProvider::~BlinkGCMemoryDumpProvider() | 22 BlinkGCMemoryDumpProvider::~BlinkGCMemoryDumpProvider() |
35 { | 23 { |
36 } | 24 } |
37 | 25 |
26 bool BlinkGCMemoryDumpProvider::onMemoryDump(blink::WebProcessMemoryDump* memory Dump) | |
27 { | |
28 m_currentProcessMemoryDump->clear(); | |
29 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::TakeSn apshot, Heap::ForcedGC); | |
Primiano Tucci (use gerrit)
2015/05/27 14:19:30
Can you add a comment before this line clarifing t
ssid
2015/05/27 14:39:33
Added below.
| |
30 | |
31 WebMemoryAllocatorDump* allocatorDump = memoryDump->createMemoryAllocatorDum p("blink_gc"); | |
32 allocatorDump->AddScalar("inner_size", "bytes", Heap::allocatedObjectSize()) ; | |
33 allocatorDump->AddScalar("outer_size", "bytes", Heap::allocatedSpace()); | |
34 allocatorDump->AddScalar("estimated_live_object_size", "bytes", Heap::estima tedLiveObjectSize()); | |
35 | |
36 memoryDump->takeAllDumpsFrom(m_currentProcessMemoryDump.get()); | |
Primiano Tucci (use gerrit)
2015/05/27 14:19:30
Or alternatively you can comment here saying:
merg
ssid
2015/05/27 14:39:33
Done.
| |
37 return true; | |
38 } | |
39 | |
40 WebMemoryAllocatorDump* BlinkGCMemoryDumpProvider::createMemoryAllocatorDumpForC urrentGC(const String& absoluteName) | |
41 { | |
42 return m_currentProcessMemoryDump->createMemoryAllocatorDump(absoluteName); | |
43 } | |
44 | |
45 BlinkGCMemoryDumpProvider::BlinkGCMemoryDumpProvider() | |
46 { | |
47 m_currentProcessMemoryDump = adoptPtr(Platform::current()->createProcessMemo ryDump()); | |
Primiano Tucci (use gerrit)
2015/05/27 14:19:30
Can you do this in the ctor initializer list? Othe
ssid
2015/05/27 14:39:33
Done.
| |
48 ASSERT(m_currentProcessMemoryDump); | |
49 } | |
50 | |
38 } // namespace blink | 51 } // namespace blink |
OLD | NEW |