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 WebCacheMemoryDumpProvider_h | 5 #ifndef WebCacheMemoryDumpProvider_h |
6 #define WebCacheMemoryDumpProvider_h | 6 #define WebCacheMemoryDumpProvider_h |
7 | 7 |
8 #include "core/fetch/MemoryCache.h" | 8 #include "core/fetch/MemoryCache.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "public/platform/WebCommon.h" | 10 #include "public/platform/WebCommon.h" |
11 #include "public/platform/WebMemoryDumpProvider.h" | 11 #include "public/platform/WebMemoryDumpProvider.h" |
| 12 #include "wtf/Allocator.h" |
12 #include "wtf/MainThread.h" | 13 #include "wtf/MainThread.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 // This class is wrapper around MemoryCache to take memory snapshots. It dumps | 17 // This class is wrapper around MemoryCache to take memory snapshots. It dumps |
17 // the stats of cache only after the cache is created. | 18 // the stats of cache only after the cache is created. |
18 class CORE_EXPORT WebCacheMemoryDumpProvider final : public WebMemoryDumpProvide
r { | 19 class CORE_EXPORT WebCacheMemoryDumpProvider final : public WebMemoryDumpProvide
r { |
| 20 USING_FAST_MALLOC(WebCacheMemoryDumpProvider); |
19 public: | 21 public: |
20 // This class is singleton since there is a global MemoryCache object. | 22 // This class is singleton since there is a global MemoryCache object. |
21 static WebCacheMemoryDumpProvider* instance(); | 23 static WebCacheMemoryDumpProvider* instance(); |
22 ~WebCacheMemoryDumpProvider() override; | 24 ~WebCacheMemoryDumpProvider() override; |
23 | 25 |
24 // WebMemoryDumpProvider implementation. | 26 // WebMemoryDumpProvider implementation. |
25 bool onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) overrid
e; | 27 bool onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) overrid
e; |
26 | 28 |
27 void setMemoryCache(MemoryCache* memoryCache) | 29 void setMemoryCache(MemoryCache* memoryCache) |
28 { | 30 { |
29 ASSERT(isMainThread()); | 31 ASSERT(isMainThread()); |
30 m_memoryCache = memoryCache; | 32 m_memoryCache = memoryCache; |
31 } | 33 } |
32 | 34 |
33 private: | 35 private: |
34 WebCacheMemoryDumpProvider(); | 36 WebCacheMemoryDumpProvider(); |
35 | 37 |
36 WeakPersistent<MemoryCache> m_memoryCache; | 38 WeakPersistent<MemoryCache> m_memoryCache; |
37 }; | 39 }; |
38 | 40 |
39 } // namespace blink | 41 } // namespace blink |
40 | 42 |
41 #endif // WebCacheMemoryDumpProvider_h | 43 #endif // WebCacheMemoryDumpProvider_h |
OLD | NEW |