OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkTraceMemoryDump_DEFINED | 8 #ifndef SkTraceMemoryDump_DEFINED |
9 #define SkTraceMemoryDump_DEFINED | 9 #define SkTraceMemoryDump_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 | 12 |
13 class SkDiscardableMemory; | 13 class SkDiscardableMemory; |
14 | 14 |
15 /** | 15 /** |
16 * Interface for memory tracing. | 16 * Interface for memory tracing. |
17 * This interface is meant to be passed as argument to the memory dump methods o f Skia objects. | 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. | 18 * The implementation of this interface is provided by the embedder. |
19 */ | 19 */ |
20 class SK_API SkTraceMemoryDump { | 20 class SK_API SkTraceMemoryDump { |
21 public: | 21 public: |
22 /** | 22 /** |
23 * Enum of bit fields to specify the requested details for the dump from the Skia objects. | |
24 */ | |
25 enum RequestedDetails { | |
26 kMemoryTotals = 1 << 0, | |
27 kMallocDetails = 1 << 1, | |
28 kDiscardableDetails = 1 << 2, | |
29 kGpuMemoryDetails = 1 << 3 | |
30 }; | |
31 | |
32 /** | |
23 * Appends a new memory dump (i.e. a row) to the trace memory infrastructur e. | 33 * 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 | 34 * If dumpName does not exist yet, a new one is created. Otherwise, a new c olumn is appended to |
25 * the previously created dump. | 35 * the previously created dump. |
26 * Arguments: | 36 * Arguments: |
27 * dumpName: an absolute, slash-separated, name for the item being dumped | 37 * dumpName: an absolute, slash-separated, name for the item being dumped |
28 * e.g., "skia/CacheX/EntryY". | 38 * e.g., "skia/CacheX/EntryY". |
29 * valueName: a string indicating the name of the column. | 39 * valueName: a string indicating the name of the column. |
30 * e.g., "size", "active_size", "number_of_objects". | 40 * e.g., "size", "active_size", "number_of_objects". |
31 * This string is supposed to be long lived and is NOT copied. | 41 * This string is supposed to be long lived and is NOT copied. |
32 * units: a string indicating the units for the value. | 42 * units: a string indicating the units for the value. |
(...skipping 15 matching lines...) Expand all Loading... | |
48 const char* backingType, | 58 const char* backingType, |
49 const char* backingObjectId) = 0; | 59 const char* backingObjectId) = 0; |
50 | 60 |
51 /** | 61 /** |
52 * Specialization for memory backed by discardable memory. | 62 * Specialization for memory backed by discardable memory. |
53 */ | 63 */ |
54 virtual void setDiscardableMemoryBacking( | 64 virtual void setDiscardableMemoryBacking( |
55 const char* dumpName, | 65 const char* dumpName, |
56 const SkDiscardableMemory& discardableMemoryObject) = 0; | 66 const SkDiscardableMemory& discardableMemoryObject) = 0; |
57 | 67 |
68 /** | |
69 * Returns a bit mask of RequestedDetails enum. The embedder can request onl y the details | |
70 required in the dump. It is expected that the skia objects can add extra details if one mask | |
71 field is related to the other. | |
72 */ | |
73 virtual int getRequestedDetails() const = 0; | |
Primiano Tucci (use gerrit)
2015/09/11 12:16:16
I'd probably make this uint and fixed size (uint32
| |
74 | |
58 protected: | 75 protected: |
59 virtual ~SkTraceMemoryDump() { } | 76 virtual ~SkTraceMemoryDump() { } |
60 }; | 77 }; |
61 | 78 |
62 #endif | 79 #endif |
OLD | NEW |