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