OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef SkTraceMemoryDump_DEFINED |
| 9 #define SkTraceMemoryDump_DEFINED |
| 10 |
| 11 #include "SkTypes.h" |
| 12 |
| 13 class SkDiscardableMemory; |
| 14 |
| 15 /** |
| 16 * Interface for memory tracing. |
| 17 * This interface is meant to be passed as argument to the memory dump methods o
f Skia objects. |
| 18 * The implementation of this interface is provided by the embedder. |
| 19 */ |
| 20 class SK_API SkTraceMemoryDump { |
| 21 public: |
| 22 /** |
| 23 * Appends a new memory dump (i.e. a row) to the trace memory infrastructur
e. |
| 24 * If dumpName does not exist yet, a new one is created. Otherwise, a new c
olumn is appended to |
| 25 * the previously created dump. |
| 26 * Arguments: |
| 27 * dumpName: an absolute, slash-separated, name for the item being dumped |
| 28 * e.g., "skia/CacheX/EntryY". |
| 29 * valueName: a string indicating the name of the column. |
| 30 * e.g., "size", "active_size", "number_of_objects". |
| 31 * This string is supposed to be long lived and is NOT copied. |
| 32 * units: a string indicating the units for the value. |
| 33 * e.g., "bytes", "objects". |
| 34 * This string is supposed to be long lived and is NOT copied. |
| 35 * value: the actual value being dumped. |
| 36 */ |
| 37 virtual void dumpNumericValue(const char* dumpName, |
| 38 const char* valueName, |
| 39 const char* units, |
| 40 uint64_t value) = 0; |
| 41 |
| 42 /** |
| 43 * Sets the memory backing for an existing dump. |
| 44 * backingType and backingObjectId are used by the embedder to associate the
memory dumped via |
| 45 * dumpNumericValue with the corresponding dump that backs the memory. |
| 46 */ |
| 47 virtual void setMemoryBacking(const char* dumpName, |
| 48 const char* backingType, |
| 49 const char* backingObjectId) = 0; |
| 50 |
| 51 /** |
| 52 * Specialization for memory backed by discardable memory. |
| 53 */ |
| 54 virtual void setDiscardableMemoryBacking( |
| 55 const char* dumpName, |
| 56 const SkDiscardableMemory& discardableMemoryObject) = 0; |
| 57 |
| 58 protected: |
| 59 virtual ~SkTraceMemoryDump() { } |
| 60 }; |
| 61 |
| 62 #endif |
OLD | NEW |