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

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

Issue 576763002: allow SkBitmapCache to operate on a local instance, for testability (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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
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
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 static size_t GetTotalBytesUsed(); 119 static size_t GetTotalBytesUsed();
120 static size_t GetTotalByteLimit(); 120 static size_t GetTotalByteLimit();
121 static size_t SetTotalByteLimit(size_t newLimit); 121 static size_t SetTotalByteLimit(size_t newLimit);
122 122
123 static size_t SetSingleAllocationByteLimit(size_t); 123 static size_t SetSingleAllocationByteLimit(size_t);
124 static size_t GetSingleAllocationByteLimit(); 124 static size_t GetSingleAllocationByteLimit();
125 125
126 static void PurgeAll(); 126 static void PurgeAll();
127 127
128 /** 128 /**
129 * Returns the DiscardableFactory used by the global cache, or NULL.
130 */
131 static DiscardableFactory GetDiscardableFactory();
132
133 /**
129 * Use this allocator for bitmaps, so they can use ashmem when available. 134 * Use this allocator for bitmaps, so they can use ashmem when available.
130 * Returns NULL if the ResourceCache has not been initialized with a Discard ableFactory. 135 * Returns NULL if the ResourceCache has not been initialized with a Discard ableFactory.
131 */ 136 */
132 static SkBitmap::Allocator* GetAllocator(); 137 static SkBitmap::Allocator* GetAllocator();
133 138
134 /** 139 /**
135 * Call SkDebugf() with diagnostic information about the state of the cache 140 * Call SkDebugf() with diagnostic information about the state of the cache
136 */ 141 */
137 static void Dump(); 142 static void Dump();
138 143
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 * Set the maximum number of bytes available to this cache. If the current 187 * Set the maximum number of bytes available to this cache. If the current
183 * cache exceeds this new value, it will be purged to try to fit within 188 * cache exceeds this new value, it will be purged to try to fit within
184 * this new limit. 189 * this new limit.
185 */ 190 */
186 size_t setTotalByteLimit(size_t newLimit); 191 size_t setTotalByteLimit(size_t newLimit);
187 192
188 void purgeAll() { 193 void purgeAll() {
189 this->purgeAsNeeded(true); 194 this->purgeAsNeeded(true);
190 } 195 }
191 196
197 DiscardableFactory discardableFactory() const { return fDiscardableFactory; }
192 SkBitmap::Allocator* allocator() const { return fAllocator; }; 198 SkBitmap::Allocator* allocator() const { return fAllocator; };
193 199
194 /** 200 /**
195 * Call SkDebugf() with diagnostic information about the state of the cache 201 * Call SkDebugf() with diagnostic information about the state of the cache
196 */ 202 */
197 void dump() const; 203 void dump() const;
198 204
199 private: 205 private:
200 Rec* fHead; 206 Rec* fHead;
201 Rec* fTail; 207 Rec* fTail;
(...skipping 20 matching lines...) Expand all
222 228
223 void init(); // called by constructors 229 void init(); // called by constructors
224 230
225 #ifdef SK_DEBUG 231 #ifdef SK_DEBUG
226 void validate() const; 232 void validate() const;
227 #else 233 #else
228 void validate() const {} 234 void validate() const {}
229 #endif 235 #endif
230 }; 236 };
231 #endif 237 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698