Chromium Code Reviews| 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 "WebString.h" | 9 #include "WebString.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class WebMemoryAllocatorDump; | 13 class WebMemoryAllocatorDump; |
| 14 typedef uint64_t WebMemoryAllocatorDumpGuid; | |
| 14 | 15 |
| 15 // A container which holds all the dumps for the various allocators for a given | 16 // A container which holds all the dumps for the various allocators for a given |
| 16 // process. Embedders of WebMemoryDumpProvider are expected to populate a | 17 // process. Embedders of WebMemoryDumpProvider are expected to populate a |
| 17 // WebProcessMemoryDump instance with the stats of their allocators. | 18 // WebProcessMemoryDump instance with the stats of their allocators. |
| 18 class BLINK_PLATFORM_EXPORT WebProcessMemoryDump { | 19 class BLINK_PLATFORM_EXPORT WebProcessMemoryDump { |
| 19 public: | 20 public: |
| 20 virtual ~WebProcessMemoryDump(); | 21 virtual ~WebProcessMemoryDump(); |
| 21 | 22 |
| 22 // Creates a new MemoryAllocatorDump with the given name and returns the | 23 // Creates a new MemoryAllocatorDump with the given name and returns the |
| 23 // empty object back to the caller. |absoluteName| uniquely identifies the | 24 // empty object back to the caller. |absoluteName| uniquely identifies the |
| 24 // dump within the scope of a ProcessMemoryDump. It is possible to express | 25 // dump within the scope of a ProcessMemoryDump. It is possible to express |
| 25 // nesting by means of a slash-separated path naming (e.g., | 26 // nesting by means of a slash-separated path naming (e.g., |
| 26 // "allocator_name/arena_1/subheap_X"). | 27 // "allocator_name/arena_1/subheap_X"). |
| 28 // |guid| is an optional identifier, unique among all processes within the | |
| 29 // scope of a global dump. This is only relevant when using | |
| 30 // AddOwnershipEdge(). If omitted, it will be automatically generated. | |
| 31 virtual WebMemoryAllocatorDump* createMemoryAllocatorDump(const WebString& a bsoluteName, const WebMemoryAllocatorDumpGuid& guid) | |
|
Primiano Tucci (use gerrit)
2015/06/09 20:51:34
No need of the const& on the guid anymore, this is
ssid
2015/06/10 12:36:00
Done.
| |
| 32 { | |
| 33 BLINK_ASSERT_NOT_REACHED(); | |
| 34 return nullptr; | |
| 35 } | |
| 36 | |
| 27 virtual WebMemoryAllocatorDump* createMemoryAllocatorDump(const WebString& a bsoluteName) | 37 virtual WebMemoryAllocatorDump* createMemoryAllocatorDump(const WebString& a bsoluteName) |
| 28 { | 38 { |
| 39 BLINK_ASSERT_NOT_REACHED(); | |
| 29 return nullptr; | 40 return nullptr; |
| 30 } | 41 } |
| 31 | 42 |
| 32 // Gets a previously created MemoryAllocatorDump given its name. | 43 // Gets a previously created MemoryAllocatorDump given its name. |
| 33 virtual WebMemoryAllocatorDump* getMemoryAllocatorDump(const WebString& abso luteName) const | 44 virtual WebMemoryAllocatorDump* getMemoryAllocatorDump(const WebString& abso luteName) const |
| 34 { | 45 { |
| 46 BLINK_ASSERT_NOT_REACHED(); | |
| 35 return nullptr; | 47 return nullptr; |
| 36 } | 48 } |
| 37 | 49 |
| 38 // Removes all the WebMemoryAllocatorDump(s) contained in this instance. | 50 // Removes all the WebMemoryAllocatorDump(s) contained in this instance. |
| 39 // This WebProcessMemoryDump can be safely reused as if it was new once this | 51 // This WebProcessMemoryDump can be safely reused as if it was new once this |
| 40 // method returns. | 52 // method returns. |
| 41 virtual void clear() | 53 virtual void clear() |
| 42 { | 54 { |
| 43 BLINK_ASSERT_NOT_REACHED(); | 55 BLINK_ASSERT_NOT_REACHED(); |
| 44 } | 56 } |
| 45 | 57 |
| 46 // Merges all WebMemoryAllocatorDump(s) contained in |other| inside this | 58 // Merges all WebMemoryAllocatorDump(s) contained in |other| inside this |
| 47 // WebProcessMemoryDump, transferring their ownership to this instance. | 59 // WebProcessMemoryDump, transferring their ownership to this instance. |
| 48 // |other| will be an empty WebProcessMemoryDump after this method returns | 60 // |other| will be an empty WebProcessMemoryDump after this method returns |
| 49 // and can be reused as if it was new. | 61 // and can be reused as if it was new. |
| 50 virtual void takeAllDumpsFrom(WebProcessMemoryDump* other) | 62 virtual void takeAllDumpsFrom(WebProcessMemoryDump* other) |
| 51 { | 63 { |
| 52 BLINK_ASSERT_NOT_REACHED(); | 64 BLINK_ASSERT_NOT_REACHED(); |
| 53 } | 65 } |
| 66 | |
| 67 // Adds an ownership relationship between two MemoryAllocatorDump(s) with | |
| 68 // the semantics: |source| owns |target|, and has the effect of attributing | |
| 69 // the memory usage of |target| to |source|. |importance| is optional and | |
| 70 // relevant only for the cases of co-ownership, where it acts as a z-index: | |
| 71 // the owner with the highest importance will be attributed |target|'s | |
| 72 // memory. | |
| 73 virtual void AddOwnershipEdge(const WebMemoryAllocatorDumpGuid& source, cons t WebMemoryAllocatorDumpGuid& target, int importance) | |
|
Primiano Tucci (use gerrit)
2015/06/09 20:51:34
ditto here and below
ssid
2015/06/10 12:36:00
Done.
| |
| 74 { | |
| 75 BLINK_ASSERT_NOT_REACHED(); | |
| 76 } | |
| 77 | |
| 78 virtual void AddOwnershipEdge(const WebMemoryAllocatorDumpGuid& source, cons t WebMemoryAllocatorDumpGuid& target) | |
| 79 { | |
| 80 BLINK_ASSERT_NOT_REACHED(); | |
| 81 } | |
| 54 }; | 82 }; |
| 55 | 83 |
| 56 } // namespace blink | 84 } // namespace blink |
| 57 | 85 |
| 58 #endif // WebProcessMemoryDump_h | 86 #endif // WebProcessMemoryDump_h |
| OLD | NEW |