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 WebMemoryAllocatorDump_h | 5 #ifndef WebMemoryAllocatorDump_h |
| 6 #define WebMemoryAllocatorDump_h | 6 #define WebMemoryAllocatorDump_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 // Struct which has the guid of the WebMemoryAllocatorDump. The guid can either | |
| 14 // be uint64_t or WebString. | |
| 15 struct BLINK_PLATFORM_EXPORT WebMemoryAllocatorDumpGuid { | |
| 16 public: | |
| 17 enum GuidType { | |
| 18 IntType, | |
| 19 StringType | |
| 20 }; | |
| 21 | |
| 22 uint64_t guidInt; | |
|
Primiano Tucci (use gerrit)
2015/06/02 12:38:52
is this the right order in blink? Shouldn't these
ssid
2015/06/02 16:08:02
There is one place where it is in this order, thou
| |
| 23 WebString guidString; | |
| 24 GuidType type; | |
| 25 | |
| 26 explicit WebMemoryAllocatorDumpGuid(const uint64_t guid) | |
| 27 : guidInt(guid) | |
| 28 , guidString() | |
| 29 , type(IntType) | |
| 30 { | |
| 31 } | |
| 32 | |
| 33 explicit WebMemoryAllocatorDumpGuid(const WebString& guid) | |
| 34 : guidInt(0) | |
| 35 , guidString(guid) | |
| 36 , type(StringType) | |
| 37 { | |
| 38 } | |
| 39 }; | |
| 40 | |
| 13 // A container which holds all the attributes of a particular dump for a given | 41 // A container which holds all the attributes of a particular dump for a given |
| 14 // allocator. | 42 // allocator. |
| 15 class BLINK_PLATFORM_EXPORT WebMemoryAllocatorDump { | 43 class BLINK_PLATFORM_EXPORT WebMemoryAllocatorDump { |
| 16 public: | 44 public: |
| 45 WebMemoryAllocatorDump() | |
| 46 : m_guid(WebMemoryAllocatorDumpGuid(0)) | |
|
Primiano Tucci (use gerrit)
2015/06/02 12:38:52
I am not sure I understand this. Why the guid is j
ssid
2015/06/02 16:08:02
Done.
| |
| 47 { | |
| 48 } | |
| 49 | |
| 17 virtual ~WebMemoryAllocatorDump(); | 50 virtual ~WebMemoryAllocatorDump(); |
| 18 | 51 |
| 19 // Adds a scalar attribute to the dump. | 52 // Adds a scalar attribute to the dump. |
| 20 // Arguments: | 53 // Arguments: |
| 21 // name: name of the attribute. Typical names, emitted by most allocators | 54 // name: name of the attribute. Typical names, emitted by most allocators |
| 22 // dump providers are: "outer_size", "inner_size", "objects_count". | 55 // dump providers are: "outer_size", "inner_size", "objects_count". |
| 23 // units: the units for the attribute. Gives a hint to the trace-viewer UI | 56 // units: the units for the attribute. Gives a hint to the trace-viewer UI |
| 24 // about the semantics of the attribute. | 57 // about the semantics of the attribute. |
| 25 // Currently supported values are "bytes" and "objects". | 58 // Currently supported values are "bytes" and "objects". |
| 26 // value: the value of the attribute. | 59 // value: the value of the attribute. |
| 27 virtual void AddScalar(const WebString& name, const char* units, uint64_t va lue) { } | 60 virtual void AddScalar(const WebString& name, const char* units, uint64_t va lue) { } |
| 28 virtual void AddString(const WebString& name, const char* units, const WebSt ring& value) { } | 61 virtual void AddString(const WebString& name, const char* units, const WebSt ring& value) { } |
| 62 | |
| 63 // |guid| is an optional global dump identifier, unique across all processes | |
| 64 // within the scope of a global dump. It is only required when using the | |
| 65 // graph APIs (see TODO_method_name) to express retention / suballocation or | |
| 66 // cross process sharing. See crbug.com/492102 for design docs. | |
| 67 // Subsequent MemoryAllocatorDump(s) with the same |absolute_name| are | |
| 68 // expected to have the same guid. Always returns WebMemoryAllocatorDumpGuid | |
| 69 // with IntType. | |
| 70 const WebMemoryAllocatorDumpGuid& guid() const | |
| 71 { | |
| 72 BLINK_ASSERT(m_guid.guidInt); | |
| 73 return m_guid; | |
| 74 } | |
| 75 | |
| 76 protected: | |
| 77 WebMemoryAllocatorDumpGuid m_guid; | |
| 29 }; | 78 }; |
| 30 | 79 |
| 31 } // namespace blink | 80 } // namespace blink |
| 32 | 81 |
| 33 #endif // WebMemoryAllocatorDump_h | 82 #endif // WebMemoryAllocatorDump_h |
| OLD | NEW |