Chromium Code Reviews| 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 class SkString; | |
| 15 | |
| 16 /** | |
| 17 * Interface for memory tracing. | |
| 18 * This interface is meant to be passed as argument to the memory dump methods | |
| 19 * of Skia objects. The implementation of this interface is provided by the | |
| 20 * embedder. | |
| 21 * | |
| 22 * const char* argument values are assumed to have long-lived scope and will not | |
| 23 * be copied. | |
| 24 */ | |
| 25 class SK_API SkTraceMemoryDump { | |
| 26 public: | |
| 27 /** | |
| 
 
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
 
 | |
| 28 * Appends a new memory dump (i.e. a row) to the trace memory infrastructure. | |
| 29 * If dumpName does not exist yet, a new one is created. Otherwise, a new | |
| 30 * column is appended to the previously created dump. | |
| 31 * Arguements: | |
| 32 * dumpName: an absolute, slash-separated, name for the item being dumped | |
| 33 * e.g., "skia/CacheX/EntryY" | |
| 34 * name: a string indicating the name of the column. | |
| 35 * e.g., "size", "active_size", "number_of_objects". | |
| 36 * units: a string indicating the units for the scalar. | |
| 37 * e.g., "bytes", "objects". | |
| 38 * value: the actual value being dumped. | |
| 39 */ | |
| 40 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.
 
 | |
| 41 const char *units, uint64_t value) = 0; | |
| 42 | |
| 43 /** | |
| 44 * Sets the memory backing for an existing dump. | |
| 45 * backingType and backingObjectId are used by the embedder to associate | |
| 46 * the memory dumped via DumpScalarValue with the corresponding dump that | |
| 47 * backs the memory. | |
| 48 */ | |
| 49 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.
 
 | |
| 50 const SkString &backingType, | |
| 51 const SkString &backingObjectId) = 0; | |
| 52 | |
| 53 /** | |
| 54 * Specialization for memory backed by discardable memory. | |
| 55 */ | |
| 56 virtual void SetDiscardableMemoryBacking( | |
| 57 const SkString &dumpName, | |
| 58 const SkDiscardableMemory &discardableMemoryObject) = 0; | |
| 59 | |
| 60 protected: | |
| 61 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.
 
 | |
| 62 }; | |
| 63 | |
| 64 #endif | |
| OLD | NEW |