| 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 "public/platform/WebMemoryDumpProvider.h" | 9 #include "public/platform/WebMemoryDumpProvider.h" |
| 10 #include "wtf/Allocator.h" |
| 10 #include "wtf/OwnPtr.h" | 11 #include "wtf/OwnPtr.h" |
| 11 #include "wtf/text/WTFString.h" | 12 #include "wtf/text/WTFString.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 class WebMemoryAllocatorDump; | 15 class WebMemoryAllocatorDump; |
| 15 | 16 |
| 16 class PLATFORM_EXPORT BlinkGCMemoryDumpProvider final : public WebMemoryDumpProv
ider { | 17 class PLATFORM_EXPORT BlinkGCMemoryDumpProvider final : public WebMemoryDumpProv
ider { |
| 18 USING_FAST_MALLOC(BlinkGCMemoryDumpProvider); |
| 17 public: | 19 public: |
| 18 static BlinkGCMemoryDumpProvider* instance(); | 20 static BlinkGCMemoryDumpProvider* instance(); |
| 19 ~BlinkGCMemoryDumpProvider() override; | 21 ~BlinkGCMemoryDumpProvider() override; |
| 20 | 22 |
| 21 // WebMemoryDumpProvider implementation. | 23 // WebMemoryDumpProvider implementation. |
| 22 bool onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) overrid
e; | 24 bool onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) overrid
e; |
| 23 | 25 |
| 24 // The returned WebMemoryAllocatorDump is owned by | 26 // The returned WebMemoryAllocatorDump is owned by |
| 25 // BlinkGCMemoryDumpProvider, and should not be retained (just used to | 27 // BlinkGCMemoryDumpProvider, and should not be retained (just used to |
| 26 // dump in the current call stack). | 28 // dump in the current call stack). |
| 27 WebMemoryAllocatorDump* createMemoryAllocatorDumpForCurrentGC(const String&
absoluteName); | 29 WebMemoryAllocatorDump* createMemoryAllocatorDumpForCurrentGC(const String&
absoluteName); |
| 28 | 30 |
| 29 // This must be called before taking a new process-wide GC snapshot, to | 31 // This must be called before taking a new process-wide GC snapshot, to |
| 30 // clear the previous dumps. | 32 // clear the previous dumps. |
| 31 void clearProcessDumpForCurrentGC(); | 33 void clearProcessDumpForCurrentGC(); |
| 32 | 34 |
| 33 WebProcessMemoryDump* currentProcessMemoryDump() { return m_currentProcessMe
moryDump.get(); } | 35 WebProcessMemoryDump* currentProcessMemoryDump() { return m_currentProcessMe
moryDump.get(); } |
| 34 | 36 |
| 35 private: | 37 private: |
| 36 BlinkGCMemoryDumpProvider(); | 38 BlinkGCMemoryDumpProvider(); |
| 37 | 39 |
| 38 OwnPtr<WebProcessMemoryDump> m_currentProcessMemoryDump; | 40 OwnPtr<WebProcessMemoryDump> m_currentProcessMemoryDump; |
| 39 }; | 41 }; |
| 40 | 42 |
| 41 } // namespace blink | 43 } // namespace blink |
| 42 | 44 |
| 43 #endif | 45 #endif |
| OLD | NEW |