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 "base/trace_event/memory_dump_provider.h" | 8 #include "base/trace_event/memory_dump_provider.h" |
| 9 #include "base/trace_event/sharded_allocation_register.h" |
9 #include "platform/wtf/Noncopyable.h" | 10 #include "platform/wtf/Noncopyable.h" |
10 #include "platform/wtf/ThreadingPrimitives.h" | |
11 #include "public/platform/WebCommon.h" | 11 #include "public/platform/WebCommon.h" |
12 | 12 |
13 namespace base { | |
14 namespace trace_event { | |
15 | |
16 class AllocationRegister; | |
17 | |
18 } // namespace trace_event | |
19 } // namespace base | |
20 | |
21 namespace blink { | 13 namespace blink { |
22 | 14 |
23 class BLINK_PLATFORM_EXPORT PartitionAllocMemoryDumpProvider final | 15 class BLINK_PLATFORM_EXPORT PartitionAllocMemoryDumpProvider final |
24 : public base::trace_event::MemoryDumpProvider { | 16 : public base::trace_event::MemoryDumpProvider { |
25 // TODO(tasak): PartitionAllocMemoryDumpProvider should be | 17 // TODO(tasak): PartitionAllocMemoryDumpProvider should be |
26 // USING_FAST_MALLOC. c.f. crbug.com/584196 | 18 // USING_FAST_MALLOC. c.f. crbug.com/584196 |
27 WTF_MAKE_NONCOPYABLE(PartitionAllocMemoryDumpProvider); | 19 WTF_MAKE_NONCOPYABLE(PartitionAllocMemoryDumpProvider); |
28 | 20 |
29 public: | 21 public: |
30 static PartitionAllocMemoryDumpProvider* Instance(); | 22 static PartitionAllocMemoryDumpProvider* Instance(); |
31 ~PartitionAllocMemoryDumpProvider() override; | 23 ~PartitionAllocMemoryDumpProvider() override; |
32 | 24 |
33 // MemoryDumpProvider implementation. | 25 // MemoryDumpProvider implementation. |
34 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs&, | 26 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs&, |
35 base::trace_event::ProcessMemoryDump*) override; | 27 base::trace_event::ProcessMemoryDump*) override; |
36 void OnHeapProfilingEnabled(bool) override; | 28 void OnHeapProfilingEnabled(bool) override; |
37 | 29 |
38 // These methods are called only from PartitionAllocHooks' callbacks. | 30 // These methods are called only from PartitionAllocHooks' callbacks. |
39 void insert(void*, size_t, const char*); | 31 void insert(void*, size_t, const char*); |
40 void Remove(void*); | 32 void Remove(void*); |
41 | 33 |
42 private: | 34 private: |
43 PartitionAllocMemoryDumpProvider(); | 35 PartitionAllocMemoryDumpProvider(); |
44 | 36 |
45 Mutex allocation_register_mutex_; | 37 base::trace_event::ShardedAllocationRegister allocation_register_; |
46 std::unique_ptr<base::trace_event::AllocationRegister> allocation_register_; | |
47 bool is_heap_profiling_enabled_; | |
48 }; | 38 }; |
49 | 39 |
50 } // namespace blink | 40 } // namespace blink |
51 | 41 |
52 #endif // PartitionAllocMemoryDumpProvider_h | 42 #endif // PartitionAllocMemoryDumpProvider_h |
OLD | NEW |