Index: src/core/SkTraceMemoryDump.h |
diff --git a/src/core/SkTraceMemoryDump.h b/src/core/SkTraceMemoryDump.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..daf0416012d00eacb4709f023d24849ac1f2ccbb |
--- /dev/null |
+++ b/src/core/SkTraceMemoryDump.h |
@@ -0,0 +1,64 @@ |
+/* |
+ * Copyright 2015 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#ifndef SkTraceMemoryDump_DEFINED |
+#define SkTraceMemoryDump_DEFINED |
+ |
+#include "SkTypes.h" |
+ |
+class SkDiscardableMemory; |
+class SkString; |
+ |
+/** |
+ * Interface for memory tracing. |
+ * This interface is meant to be passed as argument to the memory dump methods |
+ * of Skia objects. The implementation of this interface is provided by the |
+ * embedder. |
+ * |
+ * const char* argument values are assumed to have long-lived scope and will not |
+ * be copied. |
+ */ |
+class SK_API SkTraceMemoryDump { |
+public: |
+ /** |
ericrk
2015/08/19 12:45:28
skia uses 4 space indent.
Primiano Tucci (use gerrit)
2015/08/20 08:48:01
Ah, I guess I was relying too much on clang-format
|
+ * Appends a new memory dump (i.e. a row) to the trace memory infrastructure. |
+ * If dumpName does not exist yet, a new one is created. Otherwise, a new |
+ * column is appended to the previously created dump. |
+ * Arguements: |
+ * dumpName: an absolute, slash-separated, name for the item being dumped |
+ * e.g., "skia/CacheX/EntryY" |
+ * name: a string indicating the name of the column. |
+ * e.g., "size", "active_size", "number_of_objects". |
+ * units: a string indicating the units for the scalar. |
+ * e.g., "bytes", "objects". |
+ * value: the actual value being dumped. |
+ */ |
+ virtual void DumpScalarValue(const SkString &dumpName, const char *name, |
ericrk
2015/08/19 12:45:28
Skia uses different coding style - lowercase for m
Primiano Tucci (use gerrit)
2015/08/20 08:48:01
Done.
|
+ const char *units, uint64_t value) = 0; |
+ |
+ /** |
+ * Sets the memory backing for an existing dump. |
+ * backingType and backingObjectId are used by the embedder to associate |
+ * the memory dumped via DumpScalarValue with the corresponding dump that |
+ * backs the memory. |
+ */ |
+ virtual void SetMemoryBacking(const SkString &dumpName, |
ericrk
2015/08/19 12:45:28
* and & appear to bind left in skia - "const SkStr
Primiano Tucci (use gerrit)
2015/08/20 08:48:01
Done.
|
+ const SkString &backingType, |
+ const SkString &backingObjectId) = 0; |
+ |
+ /** |
+ * Specialization for memory backed by discardable memory. |
+ */ |
+ virtual void SetDiscardableMemoryBacking( |
+ const SkString &dumpName, |
+ const SkDiscardableMemory &discardableMemoryObject) = 0; |
+ |
+protected: |
+ virtual ~SkTraceMemoryDump() = 0; |
ericrk
2015/08/19 12:45:28
{}? Other cases (SkDiscardable) appear to inline t
Primiano Tucci (use gerrit)
2015/08/20 08:48:01
Done.
|
+}; |
+ |
+#endif |