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 #ifndef BlinkGCMemoryDumpProvider_h | 5 #ifndef BlinkGCMemoryDumpProvider_h |
6 #define BlinkGCMemoryDumpProvider_h | 6 #define BlinkGCMemoryDumpProvider_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 9 #include "platform/heap/BlinkGC.h" |
9 #include "public/platform/WebMemoryDumpProvider.h" | 10 #include "public/platform/WebMemoryDumpProvider.h" |
10 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
11 #include "wtf/OwnPtr.h" | 12 #include "wtf/OwnPtr.h" |
| 13 #include "wtf/ThreadingPrimitives.h" |
12 #include "wtf/text/WTFString.h" | 14 #include "wtf/text/WTFString.h" |
13 | 15 |
| 16 namespace base { |
| 17 namespace trace_event { |
| 18 |
| 19 class AllocationRegister; |
| 20 |
| 21 } // namespace trace_event |
| 22 } // namespace base |
| 23 |
14 namespace blink { | 24 namespace blink { |
15 class WebMemoryAllocatorDump; | 25 class WebMemoryAllocatorDump; |
16 | 26 |
17 class PLATFORM_EXPORT BlinkGCMemoryDumpProvider final : public WebMemoryDumpProv
ider { | 27 class PLATFORM_EXPORT BlinkGCMemoryDumpProvider final : public WebMemoryDumpProv
ider { |
18 USING_FAST_MALLOC(BlinkGCMemoryDumpProvider); | 28 USING_FAST_MALLOC(BlinkGCMemoryDumpProvider); |
19 public: | 29 public: |
20 static BlinkGCMemoryDumpProvider* instance(); | 30 static BlinkGCMemoryDumpProvider* instance(); |
21 ~BlinkGCMemoryDumpProvider() override; | 31 ~BlinkGCMemoryDumpProvider() override; |
22 | 32 |
23 // WebMemoryDumpProvider implementation. | 33 // WebMemoryDumpProvider implementation. |
24 bool onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) overrid
e; | 34 bool onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) overrid
e; |
| 35 bool supportsHeapProfiling() override { return true; } |
| 36 void onHeapProfilingEnabled(bool) override; |
25 | 37 |
26 // The returned WebMemoryAllocatorDump is owned by | 38 // The returned WebMemoryAllocatorDump is owned by |
27 // BlinkGCMemoryDumpProvider, and should not be retained (just used to | 39 // BlinkGCMemoryDumpProvider, and should not be retained (just used to |
28 // dump in the current call stack). | 40 // dump in the current call stack). |
29 WebMemoryAllocatorDump* createMemoryAllocatorDumpForCurrentGC(const String&
absoluteName); | 41 WebMemoryAllocatorDump* createMemoryAllocatorDumpForCurrentGC(const String&
absoluteName); |
30 | 42 |
31 // This must be called before taking a new process-wide GC snapshot, to | 43 // This must be called before taking a new process-wide GC snapshot, to |
32 // clear the previous dumps. | 44 // clear the previous dumps. |
33 void clearProcessDumpForCurrentGC(); | 45 void clearProcessDumpForCurrentGC(); |
34 | 46 |
35 WebProcessMemoryDump* currentProcessMemoryDump() { return m_currentProcessMe
moryDump.get(); } | 47 WebProcessMemoryDump* currentProcessMemoryDump() { return m_currentProcessMe
moryDump.get(); } |
36 | 48 |
| 49 void insert(Address, size_t); |
| 50 void remove(Address); |
| 51 |
37 private: | 52 private: |
38 BlinkGCMemoryDumpProvider(); | 53 BlinkGCMemoryDumpProvider(); |
39 | 54 |
| 55 Mutex m_allocationRegisterMutex; |
| 56 OwnPtr<base::trace_event::AllocationRegister> m_allocationRegister; |
40 OwnPtr<WebProcessMemoryDump> m_currentProcessMemoryDump; | 57 OwnPtr<WebProcessMemoryDump> m_currentProcessMemoryDump; |
| 58 bool m_isHeapProfilingEnabled; |
41 }; | 59 }; |
42 | 60 |
43 } // namespace blink | 61 } // namespace blink |
44 | 62 |
45 #endif | 63 #endif |
OLD | NEW |