Chromium Code Reviews| Index: public/platform/WebMemoryAllocatorDump.h |
| diff --git a/public/platform/WebMemoryAllocatorDump.h b/public/platform/WebMemoryAllocatorDump.h |
| index 5b3035922c394d3260ad7702a1469411450a6d19..6ac214f9a1c371e8d7a5d63277c4ecec05f6c5de 100644 |
| --- a/public/platform/WebMemoryAllocatorDump.h |
| +++ b/public/platform/WebMemoryAllocatorDump.h |
| @@ -10,10 +10,43 @@ |
| namespace blink { |
| +// Struct which has the guid of the WebMemoryAllocatorDump. The guid can either |
| +// be uint64_t or WebString. |
| +struct BLINK_PLATFORM_EXPORT WebMemoryAllocatorDumpGuid { |
| +public: |
| + enum GuidType { |
| + IntType, |
| + StringType |
| + }; |
| + |
| + 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
|
| + WebString guidString; |
| + GuidType type; |
| + |
| + explicit WebMemoryAllocatorDumpGuid(const uint64_t guid) |
| + : guidInt(guid) |
| + , guidString() |
| + , type(IntType) |
| + { |
| + } |
| + |
| + explicit WebMemoryAllocatorDumpGuid(const WebString& guid) |
| + : guidInt(0) |
| + , guidString(guid) |
| + , type(StringType) |
| + { |
| + } |
| +}; |
| + |
| // A container which holds all the attributes of a particular dump for a given |
| // allocator. |
| class BLINK_PLATFORM_EXPORT WebMemoryAllocatorDump { |
| public: |
| + WebMemoryAllocatorDump() |
| + : 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.
|
| + { |
| + } |
| + |
| virtual ~WebMemoryAllocatorDump(); |
| // Adds a scalar attribute to the dump. |
| @@ -26,6 +59,22 @@ public: |
| // value: the value of the attribute. |
| virtual void AddScalar(const WebString& name, const char* units, uint64_t value) { } |
| virtual void AddString(const WebString& name, const char* units, const WebString& value) { } |
| + |
| + // |guid| is an optional global dump identifier, unique across all processes |
| + // within the scope of a global dump. It is only required when using the |
| + // graph APIs (see TODO_method_name) to express retention / suballocation or |
| + // cross process sharing. See crbug.com/492102 for design docs. |
| + // Subsequent MemoryAllocatorDump(s) with the same |absolute_name| are |
| + // expected to have the same guid. Always returns WebMemoryAllocatorDumpGuid |
| + // with IntType. |
| + const WebMemoryAllocatorDumpGuid& guid() const |
| + { |
| + BLINK_ASSERT(m_guid.guidInt); |
| + return m_guid; |
| + } |
| + |
| +protected: |
| + WebMemoryAllocatorDumpGuid m_guid; |
| }; |
| } // namespace blink |