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