| 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 WebProcessMemoryDump_h | 5 #ifndef WebProcessMemoryDump_h |
| 6 #define WebProcessMemoryDump_h | 6 #define WebProcessMemoryDump_h |
| 7 | 7 |
| 8 #include "WebCommon.h" | 8 #include "WebCommon.h" |
| 9 #include "WebMemoryAllocatorDump.h" | 9 #include "WebMemoryAllocatorDump.h" |
| 10 #include "WebMemoryDumpProvider.h" | 10 #include "WebMemoryDumpProvider.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 virtual ~WebProcessMemoryDump(); | 35 virtual ~WebProcessMemoryDump(); |
| 36 | 36 |
| 37 // Creates a new MemoryAllocatorDump with the given name and returns the | 37 // Creates a new MemoryAllocatorDump with the given name and returns the |
| 38 // empty object back to the caller. |absoluteName| uniquely identifies the | 38 // empty object back to the caller. |absoluteName| uniquely identifies the |
| 39 // dump within the scope of a ProcessMemoryDump. It is possible to express | 39 // dump within the scope of a ProcessMemoryDump. It is possible to express |
| 40 // nesting by means of a slash-separated path naming (e.g., | 40 // nesting by means of a slash-separated path naming (e.g., |
| 41 // "allocator_name/arena_1/subheap_X"). | 41 // "allocator_name/arena_1/subheap_X"). |
| 42 // |guid| is an optional identifier, unique among all processes within the | 42 // |guid| is an optional identifier, unique among all processes within the |
| 43 // scope of a global dump. This is only relevant when using | 43 // scope of a global dump. This is only relevant when using |
| 44 // addOwnershipEdge(). If omitted, it will be automatically generated. | 44 // addOwnershipEdge(). If omitted, it will be automatically generated. |
| 45 virtual WebMemoryAllocatorDump* createMemoryAllocatorDump(const WebString& a
bsoluteName, WebMemoryAllocatorDumpGuid guid) | 45 virtual WebMemoryAllocatorDump* createMemoryAllocatorDump(const WebString& a
bsoluteName, WebMemoryAllocatorDumpGuid) = 0; |
| 46 { | |
| 47 BLINK_ASSERT_NOT_REACHED(); | |
| 48 return nullptr; | |
| 49 } | |
| 50 | 46 |
| 51 virtual WebMemoryAllocatorDump* createMemoryAllocatorDump(const WebString& a
bsoluteName) | 47 virtual WebMemoryAllocatorDump* createMemoryAllocatorDump(const WebString& a
bsoluteName) = 0; |
| 52 { | |
| 53 BLINK_ASSERT_NOT_REACHED(); | |
| 54 return nullptr; | |
| 55 } | |
| 56 | 48 |
| 57 // Gets a previously created MemoryAllocatorDump given its name. | 49 // Gets a previously created MemoryAllocatorDump given its name. |
| 58 virtual WebMemoryAllocatorDump* getMemoryAllocatorDump(const WebString& abso
luteName) const | 50 virtual WebMemoryAllocatorDump* getMemoryAllocatorDump(const WebString& abso
luteName) const = 0; |
| 59 { | |
| 60 BLINK_ASSERT_NOT_REACHED(); | |
| 61 return nullptr; | |
| 62 } | |
| 63 | 51 |
| 64 // Removes all the WebMemoryAllocatorDump(s) contained in this instance. | 52 // Removes all the WebMemoryAllocatorDump(s) contained in this instance. |
| 65 // This WebProcessMemoryDump can be safely reused as if it was new once this | 53 // This WebProcessMemoryDump can be safely reused as if it was new once this |
| 66 // method returns. | 54 // method returns. |
| 67 virtual void clear() | 55 virtual void clear() = 0; |
| 68 { | |
| 69 BLINK_ASSERT_NOT_REACHED(); | |
| 70 } | |
| 71 | 56 |
| 72 // Merges all WebMemoryAllocatorDump(s) contained in |other| inside this | 57 // Merges all WebMemoryAllocatorDump(s) contained in |other| inside this |
| 73 // WebProcessMemoryDump, transferring their ownership to this instance. | 58 // WebProcessMemoryDump, transferring their ownership to this instance. |
| 74 // |other| will be an empty WebProcessMemoryDump after this method returns | 59 // |other| will be an empty WebProcessMemoryDump after this method returns |
| 75 // and can be reused as if it was new. | 60 // and can be reused as if it was new. |
| 76 virtual void takeAllDumpsFrom(WebProcessMemoryDump* other) | 61 virtual void takeAllDumpsFrom(WebProcessMemoryDump* other) = 0; |
| 77 { | |
| 78 BLINK_ASSERT_NOT_REACHED(); | |
| 79 } | |
| 80 | 62 |
| 81 // Adds an ownership relationship between two MemoryAllocatorDump(s) with | 63 // Adds an ownership relationship between two MemoryAllocatorDump(s) with |
| 82 // the semantics: |source| owns |target|, and has the effect of attributing | 64 // the semantics: |source| owns |target|, and has the effect of attributing |
| 83 // the memory usage of |target| to |source|. |importance| is optional and | 65 // the memory usage of |target| to |source|. |importance| is optional and |
| 84 // relevant only for the cases of co-ownership, where it acts as a z-index: | 66 // relevant only for the cases of co-ownership, where it acts as a z-index: |
| 85 // the owner with the highest importance will be attributed |target|'s | 67 // the owner with the highest importance will be attributed |target|'s |
| 86 // memory. | 68 // memory. |
| 87 virtual void addOwnershipEdge(WebMemoryAllocatorDumpGuid source, WebMemoryAl
locatorDumpGuid target, int importance) | 69 virtual void addOwnershipEdge(WebMemoryAllocatorDumpGuid source, WebMemoryAl
locatorDumpGuid target, int importance) = 0; |
| 88 { | |
| 89 BLINK_ASSERT_NOT_REACHED(); | |
| 90 } | |
| 91 | 70 |
| 92 virtual void addOwnershipEdge(WebMemoryAllocatorDumpGuid source, WebMemoryAl
locatorDumpGuid target) | 71 virtual void addOwnershipEdge(WebMemoryAllocatorDumpGuid source, WebMemoryAl
locatorDumpGuid target) = 0; |
| 93 { | |
| 94 BLINK_ASSERT_NOT_REACHED(); | |
| 95 } | |
| 96 | 72 |
| 97 // Utility method to add a suballocation relationship with the following | 73 // Utility method to add a suballocation relationship with the following |
| 98 // semantics: |source| is suballocated from |target_node_name|. | 74 // semantics: |source| is suballocated from |target_node_name|. |
| 99 // This creates a child node of |target_node_name| and adds an ownership | 75 // This creates a child node of |target_node_name| and adds an ownership |
| 100 // edge between |source| and the new child node. As a result, the UI will | 76 // edge between |source| and the new child node. As a result, the UI will |
| 101 // not account the memory of |source| in the target node. | 77 // not account the memory of |source| in the target node. |
| 102 virtual void addSuballocation(WebMemoryAllocatorDumpGuid source, const WebSt
ring& targetNodeName) | 78 virtual void addSuballocation(WebMemoryAllocatorDumpGuid source, const WebSt
ring& targetNodeName) = 0; |
| 103 { | |
| 104 BLINK_ASSERT_NOT_REACHED(); | |
| 105 } | |
| 106 | 79 |
| 107 // Returns the SkTraceMemoryDump proxy interface that can be passed to Skia | 80 // Returns the SkTraceMemoryDump proxy interface that can be passed to Skia |
| 108 // to dump into this WebProcessMemoryDump. Multiple SkTraceMemoryDump | 81 // to dump into this WebProcessMemoryDump. Multiple SkTraceMemoryDump |
| 109 // objects can be created using this method. The created dumpers are owned | 82 // objects can be created using this method. The created dumpers are owned |
| 110 // by WebProcessMemoryDump and cannot outlive the WebProcessMemoryDump | 83 // by WebProcessMemoryDump and cannot outlive the WebProcessMemoryDump |
| 111 // object owning them. |dumpNamePrefix| is prefix appended to each dump | 84 // object owning them. |dumpNamePrefix| is prefix appended to each dump |
| 112 // created by the SkTraceMemoryDump implementation, if the dump should be | 85 // created by the SkTraceMemoryDump implementation, if the dump should be |
| 113 // placed under different namespace and not "skia". | 86 // placed under different namespace and not "skia". |
| 114 virtual SkTraceMemoryDump* createDumpAdapterForSkia(const WebString& dumpNam
ePrefix) | 87 virtual SkTraceMemoryDump* createDumpAdapterForSkia(const WebString& dumpNam
ePrefix) = 0; |
| 115 { | |
| 116 BLINK_ASSERT_NOT_REACHED(); | |
| 117 return nullptr; | |
| 118 } | |
| 119 | 88 |
| 120 virtual blink::WebMemoryAllocatorDump* createDiscardableMemoryAllocatorDump(
const std::string& name, base::DiscardableMemory* discardable) | 89 virtual blink::WebMemoryAllocatorDump* createDiscardableMemoryAllocatorDump(
const std::string& name, base::DiscardableMemory*) = 0; |
| 121 { | |
| 122 BLINK_ASSERT_NOT_REACHED(); | |
| 123 return nullptr; | |
| 124 } | |
| 125 | 90 |
| 126 // Dumps heap memory usage. |allocatorName| is used as an absolute name for | 91 // Dumps heap memory usage. |allocatorName| is used as an absolute name for |
| 127 // base::trace_event::ProcessMemoryDump::AddHeapDump. | 92 // base::trace_event::ProcessMemoryDump::AddHeapDump. |
| 128 virtual void dumpHeapUsage(const base::hash_map<base::trace_event::Allocatio
nContext, size_t>& bytesByContext, base::trace_event::TraceEventMemoryOverhead&
overhead, const char* allocatorName) | 93 virtual void dumpHeapUsage(const base::hash_map<base::trace_event::Allocatio
nContext, size_t>& bytesByContext, base::trace_event::TraceEventMemoryOverhead&,
const char* allocatorName) = 0; |
| 129 { | |
| 130 BLINK_ASSERT_NOT_REACHED(); | |
| 131 } | |
| 132 }; | 94 }; |
| 133 | 95 |
| 134 } // namespace blink | 96 } // namespace blink |
| 135 | 97 |
| 136 #endif // WebProcessMemoryDump_h | 98 #endif // WebProcessMemoryDump_h |
| OLD | NEW |