Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: third_party/WebKit/Source/platform/MemoryCacheDumpProvider.h

Issue 2391383002: Moving platform tracing things into platform/tracing. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MemoryCacheDumpProvider_h
6 #define MemoryCacheDumpProvider_h
7
8 #include "base/trace_event/memory_dump_provider.h"
9 #include "base/trace_event/process_memory_dump.h"
10 #include "platform/PlatformExport.h"
11 #include "platform/heap/Handle.h"
12 #include "platform/web_process_memory_dump.h"
13 #include "wtf/Allocator.h"
14
15 namespace blink {
16
17 class PLATFORM_EXPORT MemoryCacheDumpClient : public GarbageCollectedMixin {
18 public:
19 virtual ~MemoryCacheDumpClient() {}
20 virtual bool onMemoryDump(WebMemoryDumpLevelOfDetail,
21 WebProcessMemoryDump*) = 0;
22
23 DECLARE_VIRTUAL_TRACE();
24 };
25
26 // This class is wrapper around MemoryCache to take memory snapshots. It dumps
27 // the stats of cache only after the cache is created.
28 class PLATFORM_EXPORT MemoryCacheDumpProvider final
29 : public base::trace_event::MemoryDumpProvider {
30 USING_FAST_MALLOC(MemoryCacheDumpProvider);
31
32 public:
33 // This class is singleton since there is a global MemoryCache object.
34 static MemoryCacheDumpProvider* instance();
35 ~MemoryCacheDumpProvider() override;
36
37 // base::trace_event::MemoryDumpProvider implementation.
38 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs&,
39 base::trace_event::ProcessMemoryDump*) override;
40
41 void setMemoryCache(MemoryCacheDumpClient* client) {
42 DCHECK(isMainThread());
43 m_client = client;
44 }
45
46 private:
47 MemoryCacheDumpProvider();
48
49 WeakPersistent<MemoryCacheDumpClient> m_client;
50
51 WTF_MAKE_NONCOPYABLE(MemoryCacheDumpProvider);
52 };
53
54 } // namespace blink
55
56 #endif // MemoryCacheDumpProvider_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/BUILD.gn ('k') | third_party/WebKit/Source/platform/MemoryCacheDumpProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698