Index: include/utils/SkMemoryAllocatorDump.h |
diff --git a/include/utils/SkMemoryAllocatorDump.h b/include/utils/SkMemoryAllocatorDump.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..15c0b20871a53383a783b62c788a7051499b71b9 |
--- /dev/null |
+++ b/include/utils/SkMemoryAllocatorDump.h |
@@ -0,0 +1,45 @@ |
+/* |
+ * Copyright (C) 2014 Google Inc. All rights reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#ifndef SkMemoryAllocatorDump_DEFINED |
+#define SkMemoryAllocatorDump_DEFINED |
+ |
+#include "SkTypes.h" |
+#include "SkString.h" |
+ |
+typedef uint64_t SkMemoryAllocatorDumpGuid; |
+ |
+// A container which holds all the attributes of a particular dump for a given |
+// allocator. |
+class SK_API SkMemoryAllocatorDump { |
+ public: |
+ virtual ~SkMemoryAllocatorDump(); |
+ |
+ // Adds a scalar attribute to the dump. |
+ // Arguments: |
+ // name: name of the attribute. Typical names, emitted by most allocators |
+ // dump providers are: "size" and "objects_count". |
+ // units: the units for the attribute. Gives a hint to the trace-viewer UI |
+ // about the semantics of the attribute. |
+ // Currently supported values are "bytes" and "objects". |
+ // value: the value of the attribute. |
+ virtual void AddScalar(const char* name, const char* units, uint64_t value) {} |
+ virtual void AddScalarF(const char* name, const char* units, double value) {} |
+ virtual void AddString(const char* name, |
+ const char* units, |
+ const SkString& 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 AddOwnershipEdge) 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. |
+ virtual SkMemoryAllocatorDumpGuid guid() const { return 0; } |
+}; |
+ |
+#endif // SkMemoryAllocatorDump_DEFINED |