Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: src/core/SkTraceMemoryDump.h

Issue 1300103004: Introduce interface for memory dumps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/TraceMemoryDumpTest.cpp » ('j') | tests/TraceMemoryDumpTest.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | tests/TraceMemoryDumpTest.cpp » ('j') | tests/TraceMemoryDumpTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698