OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 SkGraphics_DEFINED | 8 #ifndef SkGraphics_DEFINED |
9 #define SkGraphics_DEFINED | 9 #define SkGraphics_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 | 12 |
13 class SkData; | 13 class SkData; |
14 class SkImageGenerator; | 14 class SkImageGenerator; |
| 15 class SkTraceMemoryDump; |
15 | 16 |
16 class SK_API SkGraphics { | 17 class SK_API SkGraphics { |
17 public: | 18 public: |
18 /** | 19 /** |
19 * Call this at process initialization time if your environment does not | 20 * Call this at process initialization time if your environment does not |
20 * permit static global initializers that execute code. | 21 * permit static global initializers that execute code. |
21 * Init() is thread-safe and idempotent. | 22 * Init() is thread-safe and idempotent. |
22 */ | 23 */ |
23 static void Init(); | 24 static void Init(); |
24 | 25 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 * can cause most/all of the existing entries to be purged. To avoid the, t
he client can set | 109 * can cause most/all of the existing entries to be purged. To avoid the, t
he client can set |
109 * a limit for a single allocation. If a cacheable entry would have been ca
ched, but its size | 110 * a limit for a single allocation. If a cacheable entry would have been ca
ched, but its size |
110 * exceeds this limit, then we do not attempt to cache it at all. | 111 * exceeds this limit, then we do not attempt to cache it at all. |
111 * | 112 * |
112 * Zero is the default value, meaning we always attempt to cache entries. | 113 * Zero is the default value, meaning we always attempt to cache entries. |
113 */ | 114 */ |
114 static size_t GetResourceCacheSingleAllocationByteLimit(); | 115 static size_t GetResourceCacheSingleAllocationByteLimit(); |
115 static size_t SetResourceCacheSingleAllocationByteLimit(size_t newLimit); | 116 static size_t SetResourceCacheSingleAllocationByteLimit(size_t newLimit); |
116 | 117 |
117 /** | 118 /** |
| 119 * Dumps memory usage of caches using the SkTraceMemoryDump interface. See
SkTraceMemoryDump |
| 120 * for usage of this method. |
| 121 */ |
| 122 static void DumpMemoryStatistics(SkTraceMemoryDump* dump); |
| 123 |
| 124 /** |
118 * Applications with command line options may pass optional state, such | 125 * Applications with command line options may pass optional state, such |
119 * as cache sizes, here, for instance: | 126 * as cache sizes, here, for instance: |
120 * font-cache-limit=12345678 | 127 * font-cache-limit=12345678 |
121 * | 128 * |
122 * The flags format is name=value[;name=value...] with no spaces. | 129 * The flags format is name=value[;name=value...] with no spaces. |
123 * This format is subject to change. | 130 * This format is subject to change. |
124 */ | 131 */ |
125 static void SetFlags(const char* flags); | 132 static void SetFlags(const char* flags); |
126 | 133 |
127 /** | 134 /** |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 public: | 168 public: |
162 SkAutoGraphics() { | 169 SkAutoGraphics() { |
163 SkGraphics::Init(); | 170 SkGraphics::Init(); |
164 } | 171 } |
165 ~SkAutoGraphics() { | 172 ~SkAutoGraphics() { |
166 SkGraphics::Term(); | 173 SkGraphics::Term(); |
167 } | 174 } |
168 }; | 175 }; |
169 | 176 |
170 #endif | 177 #endif |
OLD | NEW |