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. | |
| 29 virtual WebMemoryAllocatorDump* createMemoryAllocatorDump(const WebString& a bsoluteName, const WebMemoryAllocatorDumpGuid& guid) | |
| 30 { | |
| 31 return nullptr; | |
|
Primiano Tucci (use gerrit)
2015/06/08 09:39:16
Can you plz add BLINK_ASSERT_NOT_REACHED(); here a
ssid
2015/06/08 14:29:19
Done.
| |
| 32 } | |
| 33 | |
| 27 virtual WebMemoryAllocatorDump* createMemoryAllocatorDump(const WebString& a bsoluteName) | 34 virtual WebMemoryAllocatorDump* createMemoryAllocatorDump(const WebString& a bsoluteName) |
| 28 { | 35 { |
| 29 return nullptr; | 36 return nullptr; |
| 30 } | 37 } |
| 31 | 38 |
| 32 // Gets a previously created MemoryAllocatorDump given its name. | 39 // Gets a previously created MemoryAllocatorDump given its name. |
| 33 virtual WebMemoryAllocatorDump* getMemoryAllocatorDump(const WebString& abso luteName) const | 40 virtual WebMemoryAllocatorDump* getMemoryAllocatorDump(const WebString& abso luteName) const |
| 34 { | 41 { |
| 35 return nullptr; | 42 return nullptr; |
| 36 } | 43 } |
| 37 | 44 |
| 38 // Removes all the WebMemoryAllocatorDump(s) contained in this instance. | 45 // Removes all the WebMemoryAllocatorDump(s) contained in this instance. |
| 39 // This WebProcessMemoryDump can be safely reused as if it was new once this | 46 // This WebProcessMemoryDump can be safely reused as if it was new once this |
| 40 // method returns. | 47 // method returns. |
| 41 virtual void clear() | 48 virtual void clear() |
| 42 { | 49 { |
| 43 BLINK_ASSERT_NOT_REACHED(); | 50 BLINK_ASSERT_NOT_REACHED(); |
| 44 } | 51 } |
| 45 | 52 |
| 46 // Merges all WebMemoryAllocatorDump(s) contained in |other| inside this | 53 // Merges all WebMemoryAllocatorDump(s) contained in |other| inside this |
| 47 // WebProcessMemoryDump, transferring their ownership to this instance. | 54 // WebProcessMemoryDump, transferring their ownership to this instance. |
| 48 // |other| will be an empty WebProcessMemoryDump after this method returns | 55 // |other| will be an empty WebProcessMemoryDump after this method returns |
| 49 // and can be reused as if it was new. | 56 // and can be reused as if it was new. |
| 50 virtual void takeAllDumpsFrom(WebProcessMemoryDump* other) | 57 virtual void takeAllDumpsFrom(WebProcessMemoryDump* other) |
| 51 { | 58 { |
| 52 BLINK_ASSERT_NOT_REACHED(); | 59 BLINK_ASSERT_NOT_REACHED(); |
| 53 } | 60 } |
| 61 | |
| 62 // Adds an ownership relationship between two MemoryAllocatorDump(s) with | |
| 63 // the semantics: |source| owns |target|, and has the effect of attributing | |
| 64 // the memory usage of |target| to |source|. |importance| is optional and | |
| 65 // relevant only for the cases of co-ownership, where it acts as a z-index: | |
| 66 // the owner with the highest importance will be attributed |target|'s | |
| 67 // memory. | |
| 68 virtual void AddOwnershipEdge(const WebMemoryAllocatorDumpGuid& source, cons t WebMemoryAllocatorDumpGuid& target, int importance) | |
| 69 { | |
| 70 BLINK_ASSERT_NOT_REACHED(); | |
| 71 } | |
| 72 | |
| 73 virtual void AddOwnershipEdge(const WebMemoryAllocatorDumpGuid& source, cons t WebMemoryAllocatorDumpGuid& target) | |
| 74 { | |
| 75 BLINK_ASSERT_NOT_REACHED(); | |
| 76 } | |
| 54 }; | 77 }; |
| 55 | 78 |
| 56 } // namespace blink | 79 } // namespace blink |
| 57 | 80 |
| 58 #endif // WebProcessMemoryDump_h | 81 #endif // WebProcessMemoryDump_h |
| OLD | NEW |