Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: src/core/SkResourceCache.h

Issue 635333002: Add SkCachedData and use it for SkMipMap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkMipMap.cpp ('k') | src/core/SkResourceCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "SkBitmap.h" 11 #include "SkBitmap.h"
12 12
13 class SkCachedData;
13 class SkDiscardableMemory; 14 class SkDiscardableMemory;
14 class SkMipMap; 15 class SkMipMap;
15 16
16 /** 17 /**
17 * Cache object for bitmaps (with possible scale in X Y as part of the key). 18 * Cache object for bitmaps (with possible scale in X Y as part of the key).
18 * 19 *
19 * Multiple caches can be instantiated, but each instance is not implicitly 20 * Multiple caches can be instantiated, but each instance is not implicitly
20 * thread-safe, so if a given instance is to be shared across threads, the 21 * thread-safe, so if a given instance is to be shared across threads, the
21 * caller must manage the access itself (e.g. via a mutex). 22 * caller must manage the access itself (e.g. via a mutex).
22 * 23 *
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 */ 191 */
191 size_t setTotalByteLimit(size_t newLimit); 192 size_t setTotalByteLimit(size_t newLimit);
192 193
193 void purgeAll() { 194 void purgeAll() {
194 this->purgeAsNeeded(true); 195 this->purgeAsNeeded(true);
195 } 196 }
196 197
197 DiscardableFactory discardableFactory() const { return fDiscardableFactory; } 198 DiscardableFactory discardableFactory() const { return fDiscardableFactory; }
198 SkBitmap::Allocator* allocator() const { return fAllocator; }; 199 SkBitmap::Allocator* allocator() const { return fAllocator; };
199 200
201 SkCachedData* newCachedData(size_t bytes);
202
200 /** 203 /**
201 * Call SkDebugf() with diagnostic information about the state of the cache 204 * Call SkDebugf() with diagnostic information about the state of the cache
202 */ 205 */
203 void dump() const; 206 void dump() const;
204 207
205 private: 208 private:
206 Rec* fHead; 209 Rec* fHead;
207 Rec* fTail; 210 Rec* fTail;
208 211
209 class Hash; 212 class Hash;
(...skipping 18 matching lines...) Expand all
228 231
229 void init(); // called by constructors 232 void init(); // called by constructors
230 233
231 #ifdef SK_DEBUG 234 #ifdef SK_DEBUG
232 void validate() const; 235 void validate() const;
233 #else 236 #else
234 void validate() const {} 237 void validate() const {}
235 #endif 238 #endif
236 }; 239 };
237 #endif 240 #endif
OLDNEW
« no previous file with comments | « src/core/SkMipMap.cpp ('k') | src/core/SkResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698