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/TraceEvent.h" |
9 #include "public/platform/WebMemoryDumpProvider.h" | 10 #include "public/platform/WebMemoryDumpProvider.h" |
| 11 #include "wtf/OwnPtr.h" |
| 12 #include "wtf/text/WTFString.h" |
10 | 13 |
11 namespace blink { | 14 namespace blink { |
| 15 class WebMemoryAllocatorDump; |
12 | 16 |
13 class PLATFORM_EXPORT BlinkGCMemoryDumpProvider final : public WebMemoryDumpProv
ider { | 17 class PLATFORM_EXPORT BlinkGCMemoryDumpProvider final : public WebMemoryDumpProv
ider { |
14 public: | 18 public: |
15 static BlinkGCMemoryDumpProvider* instance(); | 19 static BlinkGCMemoryDumpProvider* instance(); |
16 ~BlinkGCMemoryDumpProvider() override; | 20 ~BlinkGCMemoryDumpProvider() override; |
17 | 21 |
18 // WebMemoryDumpProvider implementation. | 22 // WebMemoryDumpProvider implementation. |
19 bool onMemoryDump(WebProcessMemoryDump*) override; | 23 bool onMemoryDump(WebProcessMemoryDump*) override; |
20 | 24 |
| 25 static inline bool isMemoryTracingEnabled() |
| 26 { |
| 27 // TODO(ssid): Change this to use api from memory-infra to check tracing |
| 28 // memory_tracing_enabled (crbug.com/490087). |
| 29 bool enabled; |
| 30 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("memory-inf
ra"), &enabled); |
| 31 return enabled; |
| 32 } |
| 33 |
| 34 WebMemoryAllocatorDump* createMemoryAllocatorDumpForLastGC(const String& abs
oluteName); |
| 35 void clearLastGCProcessMemoryDump(); |
| 36 |
21 private: | 37 private: |
22 BlinkGCMemoryDumpProvider(); | 38 BlinkGCMemoryDumpProvider(); |
| 39 |
| 40 OwnPtr<WebProcessMemoryDump> m_lastProcessMemoryDump; |
23 }; | 41 }; |
24 | 42 |
25 } // namespace blink | 43 } // namespace blink |
26 | 44 |
27 #endif | 45 #endif |
OLD | NEW |