Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 SkResourceCache_DEFINED | 8 #ifndef SkResourceCache_DEFINED |
| 9 #define SkResourceCache_DEFINED | 9 #define SkResourceCache_DEFINED |
| 10 | 10 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 */ | 116 */ |
| 117 static bool Find(const Key& key, VisitorProc, void* context); | 117 static bool Find(const Key& key, VisitorProc, void* context); |
| 118 static void Add(Rec*); | 118 static void Add(Rec*); |
| 119 | 119 |
| 120 static size_t GetTotalBytesUsed(); | 120 static size_t GetTotalBytesUsed(); |
| 121 static size_t GetTotalByteLimit(); | 121 static size_t GetTotalByteLimit(); |
| 122 static size_t SetTotalByteLimit(size_t newLimit); | 122 static size_t SetTotalByteLimit(size_t newLimit); |
| 123 | 123 |
| 124 static size_t SetSingleAllocationByteLimit(size_t); | 124 static size_t SetSingleAllocationByteLimit(size_t); |
| 125 static size_t GetSingleAllocationByteLimit(); | 125 static size_t GetSingleAllocationByteLimit(); |
| 126 static size_t GetEffectiveSingleAllocationByteLimit(); | |
| 126 | 127 |
| 127 static void PurgeAll(); | 128 static void PurgeAll(); |
| 128 | 129 |
| 129 /** | 130 /** |
| 130 * Returns the DiscardableFactory used by the global cache, or NULL. | 131 * Returns the DiscardableFactory used by the global cache, or NULL. |
| 131 */ | 132 */ |
| 132 static DiscardableFactory GetDiscardableFactory(); | 133 static DiscardableFactory GetDiscardableFactory(); |
| 133 | 134 |
| 134 /** | 135 /** |
| 135 * Use this allocator for bitmaps, so they can use ashmem when available. | 136 * Use this allocator for bitmaps, so they can use ashmem when available. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 size_t getTotalBytesUsed() const { return fTotalBytesUsed; } | 180 size_t getTotalBytesUsed() const { return fTotalBytesUsed; } |
| 180 size_t getTotalByteLimit() const { return fTotalByteLimit; } | 181 size_t getTotalByteLimit() const { return fTotalByteLimit; } |
| 181 | 182 |
| 182 /** | 183 /** |
| 183 * This is respected by SkBitmapProcState::possiblyScaleImage. | 184 * This is respected by SkBitmapProcState::possiblyScaleImage. |
| 184 * 0 is no maximum at all; this is the default. | 185 * 0 is no maximum at all; this is the default. |
| 185 * setSingleAllocationByteLimit() returns the previous value. | 186 * setSingleAllocationByteLimit() returns the previous value. |
| 186 */ | 187 */ |
| 187 size_t setSingleAllocationByteLimit(size_t maximumAllocationSize); | 188 size_t setSingleAllocationByteLimit(size_t maximumAllocationSize); |
| 188 size_t getSingleAllocationByteLimit() const; | 189 size_t getSingleAllocationByteLimit() const; |
| 190 // returns the logical single allocation size (pinning against the budget wh en the cache | |
|
robertphillips
2015/01/26 17:13:20
')' ?
| |
| 191 // is not backed by discardable memory. | |
| 192 size_t getEffectiveSingleAllocationByteLimit() const; | |
| 193 | |
| 189 /** | 194 /** |
| 190 * Set the maximum number of bytes available to this cache. If the current | 195 * Set the maximum number of bytes available to this cache. If the current |
| 191 * cache exceeds this new value, it will be purged to try to fit within | 196 * cache exceeds this new value, it will be purged to try to fit within |
| 192 * this new limit. | 197 * this new limit. |
| 193 */ | 198 */ |
| 194 size_t setTotalByteLimit(size_t newLimit); | 199 size_t setTotalByteLimit(size_t newLimit); |
| 195 | 200 |
| 196 void purgeAll() { | 201 void purgeAll() { |
| 197 this->purgeAsNeeded(true); | 202 this->purgeAsNeeded(true); |
| 198 } | 203 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 | 238 |
| 234 void init(); // called by constructors | 239 void init(); // called by constructors |
| 235 | 240 |
| 236 #ifdef SK_DEBUG | 241 #ifdef SK_DEBUG |
| 237 void validate() const; | 242 void validate() const; |
| 238 #else | 243 #else |
| 239 void validate() const {} | 244 void validate() const {} |
| 240 #endif | 245 #endif |
| 241 }; | 246 }; |
| 242 #endif | 247 #endif |
| OLD | NEW |