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 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_ptr.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 class ProcessMemoryDump; | 17 class ProcessMemoryDump; |
18 } // namespace base | 18 } // namespace base |
19 } // namespace trace_event | 19 } // namespace trace_event |
20 | 20 |
21 namespace skia { | |
22 class SkTraceMemoryDump_Chrome; | |
23 } // namespace skia | |
24 | |
21 namespace content { | 25 namespace content { |
22 | 26 |
23 class WebMemoryAllocatorDumpImpl; | 27 class WebMemoryAllocatorDumpImpl; |
24 | 28 |
25 // Implements the blink::WebProcessMemoryDump interface by means of proxying the | 29 // Implements the blink::WebProcessMemoryDump interface by means of proxying the |
26 // calls to createMemoryAllocatorDump() to the underlying | 30 // calls to createMemoryAllocatorDump() to the underlying |
27 // base::trace_event::ProcessMemoryDump instance. | 31 // base::trace_event::ProcessMemoryDump instance. |
28 class CONTENT_EXPORT WebProcessMemoryDumpImpl final | 32 class CONTENT_EXPORT WebProcessMemoryDumpImpl final |
29 : public NON_EXPORTED_BASE(blink::WebProcessMemoryDump) { | 33 : public NON_EXPORTED_BASE(blink::WebProcessMemoryDump) { |
30 public: | 34 public: |
(...skipping 15 matching lines...) Expand all Loading... | |
46 blink::WebMemoryAllocatorDumpGuid guid); | 50 blink::WebMemoryAllocatorDumpGuid guid); |
47 virtual blink::WebMemoryAllocatorDump* getMemoryAllocatorDump( | 51 virtual blink::WebMemoryAllocatorDump* getMemoryAllocatorDump( |
48 const blink::WebString& absolute_name) const; | 52 const blink::WebString& absolute_name) const; |
49 virtual void clear(); | 53 virtual void clear(); |
50 virtual void takeAllDumpsFrom(blink::WebProcessMemoryDump* other); | 54 virtual void takeAllDumpsFrom(blink::WebProcessMemoryDump* other); |
51 virtual void AddOwnershipEdge(blink::WebMemoryAllocatorDumpGuid source, | 55 virtual void AddOwnershipEdge(blink::WebMemoryAllocatorDumpGuid source, |
52 blink::WebMemoryAllocatorDumpGuid target, | 56 blink::WebMemoryAllocatorDumpGuid target, |
53 int importance); | 57 int importance); |
54 virtual void AddOwnershipEdge(blink::WebMemoryAllocatorDumpGuid source, | 58 virtual void AddOwnershipEdge(blink::WebMemoryAllocatorDumpGuid source, |
55 blink::WebMemoryAllocatorDumpGuid target); | 59 blink::WebMemoryAllocatorDumpGuid target); |
60 virtual SkTraceMemoryDump* CreateSkiaTraceMemoryDump( | |
Primiano Tucci (use gerrit)
2015/09/04 10:02:16
I'd probably call this CreateDumpAdapterForSkia(du
ssid
2015/09/07 17:29:53
Done.
| |
61 const blink::WebString& dumpNamePrefix); | |
56 | 62 |
57 const base::trace_event::ProcessMemoryDump* process_memory_dump() const { | 63 const base::trace_event::ProcessMemoryDump* process_memory_dump() const { |
58 return process_memory_dump_; | 64 return process_memory_dump_; |
59 } | 65 } |
60 | 66 |
61 private: | 67 private: |
62 FRIEND_TEST_ALL_PREFIXES(WebProcessMemoryDumpImplTest, IntegrationTest); | 68 FRIEND_TEST_ALL_PREFIXES(WebProcessMemoryDumpImplTest, IntegrationTest); |
63 | 69 |
64 blink::WebMemoryAllocatorDump* createWebMemoryAllocatorDump( | 70 blink::WebMemoryAllocatorDump* createWebMemoryAllocatorDump( |
65 base::trace_event::MemoryAllocatorDump* memory_allocator_dump); | 71 base::trace_event::MemoryAllocatorDump* memory_allocator_dump); |
66 | 72 |
67 // Only for the case of ProcessMemoryDump being owned (i.e. the default ctor). | 73 // Only for the case of ProcessMemoryDump being owned (i.e. the default ctor). |
68 scoped_ptr<base::trace_event::ProcessMemoryDump> owned_process_memory_dump_; | 74 scoped_ptr<base::trace_event::ProcessMemoryDump> owned_process_memory_dump_; |
69 | 75 |
70 // The underlying ProcessMemoryDump instance to which the | 76 // The underlying ProcessMemoryDump instance to which the |
71 // createMemoryAllocatorDump() calls will be proxied to. | 77 // createMemoryAllocatorDump() calls will be proxied to. |
72 base::trace_event::ProcessMemoryDump* process_memory_dump_; // Not owned. | 78 base::trace_event::ProcessMemoryDump* process_memory_dump_; // Not owned. |
73 | 79 |
74 // Reverse index of MemoryAllocatorDump -> WebMemoryAllocatorDumpImpl wrapper. | 80 // Reverse index of MemoryAllocatorDump -> WebMemoryAllocatorDumpImpl wrapper. |
75 // By design WebMemoryDumpProvider(s) are not supposed to hold the pointer | 81 // By design WebMemoryDumpProvider(s) are not supposed to hold the pointer |
76 // to the WebProcessMemoryDump passed as argument of the onMemoryDump() call. | 82 // 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 | 83 // Those pointers are valid only within the scope of the call and can be |
78 // safely torn down once the WebProcessMemoryDumpImpl itself is destroyed. | 84 // safely torn down once the WebProcessMemoryDumpImpl itself is destroyed. |
79 base::ScopedPtrHashMap<base::trace_event::MemoryAllocatorDump*, | 85 base::ScopedPtrHashMap<base::trace_event::MemoryAllocatorDump*, |
80 scoped_ptr<WebMemoryAllocatorDumpImpl>> | 86 scoped_ptr<WebMemoryAllocatorDumpImpl>> |
81 memory_allocator_dumps_; | 87 memory_allocator_dumps_; |
82 | 88 |
89 // Stores SkTraceMemoryDump for the current ProcessMemoryDump. | |
90 scoped_ptr<skia::SkTraceMemoryDump_Chrome> sk_trace_dump_; | |
91 | |
83 DISALLOW_COPY_AND_ASSIGN(WebProcessMemoryDumpImpl); | 92 DISALLOW_COPY_AND_ASSIGN(WebProcessMemoryDumpImpl); |
84 }; | 93 }; |
85 | 94 |
86 } // namespace content | 95 } // namespace content |
87 | 96 |
88 #endif // CONTENT_CHILD_WEB_PROCESS_MEMORY_DUMP_IMPL_H_ | 97 #endif // CONTENT_CHILD_WEB_PROCESS_MEMORY_DUMP_IMPL_H_ |
OLD | NEW |