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