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 PartitionAllocMemoryDumpProvider_h | 5 #ifndef PartitionAllocMemoryDumpProvider_h |
6 #define PartitionAllocMemoryDumpProvider_h | 6 #define PartitionAllocMemoryDumpProvider_h |
7 | 7 |
8 #include "public/platform/WebCommon.h" | 8 #include "public/platform/WebCommon.h" |
9 #include "public/platform/WebMemoryDumpProvider.h" | 9 #include "public/platform/WebMemoryDumpProvider.h" |
10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
11 #include "wtf/Noncopyable.h" | 11 #include "wtf/Noncopyable.h" |
| 12 #include "wtf/OwnPtr.h" |
| 13 #include "wtf/ThreadingPrimitives.h" |
| 14 |
| 15 namespace base { |
| 16 namespace trace_event { |
| 17 |
| 18 class AllocationRegister; |
| 19 |
| 20 } // namespace trace_event |
| 21 } // namespace base |
12 | 22 |
13 namespace blink { | 23 namespace blink { |
14 | 24 |
15 class BLINK_PLATFORM_EXPORT PartitionAllocMemoryDumpProvider final : public WebM
emoryDumpProvider { | 25 class BLINK_PLATFORM_EXPORT PartitionAllocMemoryDumpProvider final : public WebM
emoryDumpProvider { |
16 USING_FAST_MALLOC(PartitionAllocMemoryDumpProvider); | 26 USING_FAST_MALLOC(PartitionAllocMemoryDumpProvider); |
17 WTF_MAKE_NONCOPYABLE(PartitionAllocMemoryDumpProvider); | 27 WTF_MAKE_NONCOPYABLE(PartitionAllocMemoryDumpProvider); |
18 public: | 28 public: |
19 static PartitionAllocMemoryDumpProvider* instance(); | 29 static PartitionAllocMemoryDumpProvider* instance(); |
20 ~PartitionAllocMemoryDumpProvider() override; | 30 ~PartitionAllocMemoryDumpProvider() override; |
21 | 31 |
22 // WebMemoryDumpProvider implementation. | 32 // WebMemoryDumpProvider implementation. |
23 bool onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) overrid
e; | 33 bool onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) overrid
e; |
24 bool supportsHeapProfiling() override { return true; } | 34 bool supportsHeapProfiling() override { return true; } |
25 void onHeapProfilingEnabled(AllocationHook*, FreeHook*) override; | 35 void onHeapProfilingEnabled(bool) override; |
| 36 |
| 37 // These methods are called only from PartitionAllocHooks' callbacks. |
| 38 void insert(void*, size_t, const char*); |
| 39 void remove(void*); |
26 | 40 |
27 private: | 41 private: |
28 PartitionAllocMemoryDumpProvider(); | 42 PartitionAllocMemoryDumpProvider(); |
| 43 |
| 44 Mutex m_allocationRegisterMutex; |
| 45 OwnPtr<base::trace_event::AllocationRegister> m_allocationRegister; |
| 46 bool m_isHeapProfilingEnabled; |
29 }; | 47 }; |
30 | 48 |
31 } // namespace blink | 49 } // namespace blink |
32 | 50 |
33 #endif // PartitionAllocMemoryDumpProvider_h | 51 #endif // PartitionAllocMemoryDumpProvider_h |
OLD | NEW |