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

Side by Side Diff: content/child/web_process_memory_dump_impl.h

Issue 1308523004: Implement GetSkiaTraceMemoryDump and AddSuballocation on chrome blink platform impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web_cache_move
Patch Set: Add args in impl. Created 5 years, 3 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
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 CONTENT_CHILD_WEB_PROCESS_MEMORY_DUMP_IMPL_H_ 5 #ifndef CONTENT_CHILD_WEB_PROCESS_MEMORY_DUMP_IMPL_H_
6 #define CONTENT_CHILD_WEB_PROCESS_MEMORY_DUMP_IMPL_H_ 6 #define CONTENT_CHILD_WEB_PROCESS_MEMORY_DUMP_IMPL_H_
7 7
8 #include "base/containers/scoped_ptr_hash_map.h" 8 #include "base/containers/scoped_ptr_hash_map.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_vector.h"
11 #include "content/common/content_export.h" 11 #include "content/common/content_export.h"
12 #include "third_party/WebKit/public/platform/WebProcessMemoryDump.h" 12 #include "third_party/WebKit/public/platform/WebProcessMemoryDump.h"
13 13
14 namespace base { 14 namespace base {
15 namespace trace_event { 15 namespace trace_event {
16 class MemoryAllocatorDump; 16 class MemoryAllocatorDump;
17 struct MemoryDumpArgs;
17 class ProcessMemoryDump; 18 class ProcessMemoryDump;
18 } // namespace base 19 } // namespace base
19 } // namespace trace_event 20 } // namespace trace_event
20 21
22 namespace skia {
23 class SkTraceMemoryDump_Chrome;
24 } // namespace skia
25
21 namespace content { 26 namespace content {
22 27
23 class WebMemoryAllocatorDumpImpl; 28 class WebMemoryAllocatorDumpImpl;
24 29
25 // Implements the blink::WebProcessMemoryDump interface by means of proxying the 30 // Implements the blink::WebProcessMemoryDump interface by means of proxying the
26 // calls to createMemoryAllocatorDump() to the underlying 31 // calls to createMemoryAllocatorDump() to the underlying
27 // base::trace_event::ProcessMemoryDump instance. 32 // base::trace_event::ProcessMemoryDump instance.
28 class CONTENT_EXPORT WebProcessMemoryDumpImpl final 33 class CONTENT_EXPORT WebProcessMemoryDumpImpl final
29 : public NON_EXPORTED_BASE(blink::WebProcessMemoryDump) { 34 : public NON_EXPORTED_BASE(blink::WebProcessMemoryDump) {
30 public: 35 public:
31 // Creates a standalone WebProcessMemoryDumpImp, which owns the underlying 36 // Creates a standalone WebProcessMemoryDumpImp, which owns the underlying
32 // ProcessMemoryDump. 37 // ProcessMemoryDump.
33 WebProcessMemoryDumpImpl(); 38 WebProcessMemoryDumpImpl();
34 39
35 // Wraps (without owning) an existing ProcessMemoryDump. 40 // Wraps (without owning) an existing ProcessMemoryDump.
36 explicit WebProcessMemoryDumpImpl( 41 explicit WebProcessMemoryDumpImpl(
42 const base::trace_event::MemoryDumpArgs* dump_args,
37 base::trace_event::ProcessMemoryDump* process_memory_dump); 43 base::trace_event::ProcessMemoryDump* process_memory_dump);
38 44
39 virtual ~WebProcessMemoryDumpImpl(); 45 virtual ~WebProcessMemoryDumpImpl();
40 46
41 // blink::WebProcessMemoryDump implementation. 47 // blink::WebProcessMemoryDump implementation.
42 virtual blink::WebMemoryAllocatorDump* createMemoryAllocatorDump( 48 virtual blink::WebMemoryAllocatorDump* createMemoryAllocatorDump(
43 const blink::WebString& absolute_name); 49 const blink::WebString& absolute_name);
44 virtual blink::WebMemoryAllocatorDump* createMemoryAllocatorDump( 50 virtual blink::WebMemoryAllocatorDump* createMemoryAllocatorDump(
45 const blink::WebString& absolute_name, 51 const blink::WebString& absolute_name,
46 blink::WebMemoryAllocatorDumpGuid guid); 52 blink::WebMemoryAllocatorDumpGuid guid);
47 virtual blink::WebMemoryAllocatorDump* getMemoryAllocatorDump( 53 virtual blink::WebMemoryAllocatorDump* getMemoryAllocatorDump(
48 const blink::WebString& absolute_name) const; 54 const blink::WebString& absolute_name) const;
49 virtual void clear(); 55 virtual void clear();
50 virtual void takeAllDumpsFrom(blink::WebProcessMemoryDump* other); 56 virtual void takeAllDumpsFrom(blink::WebProcessMemoryDump* other);
51 virtual void AddOwnershipEdge(blink::WebMemoryAllocatorDumpGuid source, 57 virtual void AddOwnershipEdge(blink::WebMemoryAllocatorDumpGuid source,
52 blink::WebMemoryAllocatorDumpGuid target, 58 blink::WebMemoryAllocatorDumpGuid target,
53 int importance); 59 int importance);
54 virtual void AddOwnershipEdge(blink::WebMemoryAllocatorDumpGuid source, 60 virtual void AddOwnershipEdge(blink::WebMemoryAllocatorDumpGuid source,
55 blink::WebMemoryAllocatorDumpGuid target); 61 blink::WebMemoryAllocatorDumpGuid target);
62 virtual void AddSuballocation(blink::WebMemoryAllocatorDumpGuid source,
63 const blink::WebString& targetNodeName);
64 virtual SkTraceMemoryDump* CreateDumpAdapterForSkia(
65 const blink::WebString& dumpNamePrefix);
56 66
57 const base::trace_event::ProcessMemoryDump* process_memory_dump() const { 67 const base::trace_event::ProcessMemoryDump* process_memory_dump() const {
58 return process_memory_dump_; 68 return process_memory_dump_;
59 } 69 }
60 70
61 private: 71 private:
62 FRIEND_TEST_ALL_PREFIXES(WebProcessMemoryDumpImplTest, IntegrationTest); 72 FRIEND_TEST_ALL_PREFIXES(WebProcessMemoryDumpImplTest, IntegrationTest);
63 73
64 blink::WebMemoryAllocatorDump* createWebMemoryAllocatorDump( 74 blink::WebMemoryAllocatorDump* createWebMemoryAllocatorDump(
65 base::trace_event::MemoryAllocatorDump* memory_allocator_dump); 75 base::trace_event::MemoryAllocatorDump* memory_allocator_dump);
66 76
67 // Only for the case of ProcessMemoryDump being owned (i.e. the default ctor). 77 // Only for the case of ProcessMemoryDump being owned (i.e. the default ctor).
68 scoped_ptr<base::trace_event::ProcessMemoryDump> owned_process_memory_dump_; 78 scoped_ptr<base::trace_event::ProcessMemoryDump> owned_process_memory_dump_;
69 79
70 // The underlying ProcessMemoryDump instance to which the 80 // The underlying ProcessMemoryDump instance to which the
71 // createMemoryAllocatorDump() calls will be proxied to. 81 // createMemoryAllocatorDump() calls will be proxied to.
72 base::trace_event::ProcessMemoryDump* process_memory_dump_; // Not owned. 82 base::trace_event::ProcessMemoryDump* process_memory_dump_; // Not owned.
73 83
84 // TODO(ssid): Remove it once this information is added to ProcessMemoryDump.
85 const base::trace_event::MemoryDumpArgs* dump_args_;
Primiano Tucci (use gerrit) 2015/09/10 11:11:13 since MDArgs is very small and cheap to copy, can
86
74 // Reverse index of MemoryAllocatorDump -> WebMemoryAllocatorDumpImpl wrapper. 87 // Reverse index of MemoryAllocatorDump -> WebMemoryAllocatorDumpImpl wrapper.
75 // By design WebMemoryDumpProvider(s) are not supposed to hold the pointer 88 // By design WebMemoryDumpProvider(s) are not supposed to hold the pointer
76 // to the WebProcessMemoryDump passed as argument of the onMemoryDump() call. 89 // to the WebProcessMemoryDump passed as argument of the onMemoryDump() call.
77 // Those pointers are valid only within the scope of the call and can be 90 // Those pointers are valid only within the scope of the call and can be
78 // safely torn down once the WebProcessMemoryDumpImpl itself is destroyed. 91 // safely torn down once the WebProcessMemoryDumpImpl itself is destroyed.
79 base::ScopedPtrHashMap<base::trace_event::MemoryAllocatorDump*, 92 base::ScopedPtrHashMap<base::trace_event::MemoryAllocatorDump*,
80 scoped_ptr<WebMemoryAllocatorDumpImpl>> 93 scoped_ptr<WebMemoryAllocatorDumpImpl>>
81 memory_allocator_dumps_; 94 memory_allocator_dumps_;
82 95
96 // Stores SkTraceMemoryDump for the current ProcessMemoryDump.
97 ScopedVector<skia::SkTraceMemoryDump_Chrome> sk_trace_dump_list_;
98
83 DISALLOW_COPY_AND_ASSIGN(WebProcessMemoryDumpImpl); 99 DISALLOW_COPY_AND_ASSIGN(WebProcessMemoryDumpImpl);
84 }; 100 };
85 101
86 } // namespace content 102 } // namespace content
87 103
88 #endif // CONTENT_CHILD_WEB_PROCESS_MEMORY_DUMP_IMPL_H_ 104 #endif // CONTENT_CHILD_WEB_PROCESS_MEMORY_DUMP_IMPL_H_
OLDNEW
« no previous file with comments | « content/child/web_memory_dump_provider_adapter.cc ('k') | content/child/web_process_memory_dump_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698