| 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 "platform/heap/BlinkGC.h" |
| 10 #include "public/platform/WebMemoryDumpProvider.h" | 10 #include "public/platform/WebMemoryDumpProvider.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 class PLATFORM_EXPORT BlinkGCMemoryDumpProvider final : public WebMemoryDumpProv
ider { | 27 class PLATFORM_EXPORT BlinkGCMemoryDumpProvider final : public WebMemoryDumpProv
ider { |
| 28 USING_FAST_MALLOC(BlinkGCMemoryDumpProvider); | 28 USING_FAST_MALLOC(BlinkGCMemoryDumpProvider); |
| 29 public: | 29 public: |
| 30 static BlinkGCMemoryDumpProvider* instance(); | 30 static BlinkGCMemoryDumpProvider* instance(); |
| 31 ~BlinkGCMemoryDumpProvider() override; | 31 ~BlinkGCMemoryDumpProvider() override; |
| 32 | 32 |
| 33 // WebMemoryDumpProvider implementation. | 33 // WebMemoryDumpProvider implementation. |
| 34 bool onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) overrid
e; | 34 bool onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) overrid
e; |
| 35 bool supportsHeapProfiling() override { return true; } | 35 bool supportsHeapProfiling() override { return true; } |
| 36 void onHeapProfilingEnabled(bool) override; | 36 void onHeapProfilingEnabled() override; |
| 37 | 37 |
| 38 // The returned WebMemoryAllocatorDump is owned by | 38 // The returned WebMemoryAllocatorDump is owned by |
| 39 // BlinkGCMemoryDumpProvider, and should not be retained (just used to | 39 // BlinkGCMemoryDumpProvider, and should not be retained (just used to |
| 40 // dump in the current call stack). | 40 // dump in the current call stack). |
| 41 WebMemoryAllocatorDump* createMemoryAllocatorDumpForCurrentGC(const String&
absoluteName); | 41 WebMemoryAllocatorDump* createMemoryAllocatorDumpForCurrentGC(const String&
absoluteName); |
| 42 | 42 |
| 43 // 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 |
| 44 // clear the previous dumps. | 44 // clear the previous dumps. |
| 45 void clearProcessDumpForCurrentGC(); | 45 void clearProcessDumpForCurrentGC(); |
| 46 | 46 |
| 47 WebProcessMemoryDump* currentProcessMemoryDump() { return m_currentProcessMe
moryDump.get(); } | 47 WebProcessMemoryDump* currentProcessMemoryDump() { return m_currentProcessMe
moryDump.get(); } |
| 48 | 48 |
| 49 void insert(Address, size_t); | 49 void insert(Address, size_t); |
| 50 void remove(Address); | 50 void remove(Address); |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 BlinkGCMemoryDumpProvider(); | 53 BlinkGCMemoryDumpProvider(); |
| 54 | 54 |
| 55 Mutex m_allocationRegisterMutex; | 55 Mutex m_allocationRegisterMutex; |
| 56 OwnPtr<base::trace_event::AllocationRegister> m_allocationRegister; | 56 OwnPtr<base::trace_event::AllocationRegister> m_allocationRegister; |
| 57 OwnPtr<WebProcessMemoryDump> m_currentProcessMemoryDump; | 57 OwnPtr<WebProcessMemoryDump> m_currentProcessMemoryDump; |
| 58 bool m_isHeapProfilingEnabled; | 58 bool m_isHeapProfilingEnabled; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace blink | 61 } // namespace blink |
| 62 | 62 |
| 63 #endif | 63 #endif |
| OLD | NEW |