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

Side by Side Diff: include/gpu/GrGpuResource.h

Issue 858123002: Add specialized content key class for resources. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove default template arg Created 5 years, 11 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 | « include/gpu/GrContext.h ('k') | include/gpu/GrResourceKey.h » ('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 2014 Google Inc. 2 * Copyright 2014 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 GrGpuResource_DEFINED 8 #ifndef GrGpuResource_DEFINED
9 #define GrGpuResource_DEFINED 9 #define GrGpuResource_DEFINED
10 10
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 private: 253 private:
254 /** 254 /**
255 * Frees the object in the underlying 3D API. Called by CacheAccess. 255 * Frees the object in the underlying 3D API. Called by CacheAccess.
256 */ 256 */
257 void release(); 257 void release();
258 258
259 virtual size_t onGpuMemorySize() const = 0; 259 virtual size_t onGpuMemorySize() const = 0;
260 260
261 // See comments in CacheAccess. 261 // See comments in CacheAccess.
262 bool setContentKey(const GrResourceKey& contentKey); 262 bool setContentKey(const GrContentKey& contentKey);
263 void notifyIsPurgable() const; 263 void notifyIsPurgable() const;
264 void removeScratchKey(); 264 void removeScratchKey();
265 void makeBudgeted(); 265 void makeBudgeted();
266 266
267 #ifdef SK_DEBUG 267 #ifdef SK_DEBUG
268 friend class GrGpu; // for assert in GrGpu to access getGpu 268 friend class GrGpu; // for assert in GrGpu to access getGpu
269 #endif 269 #endif
270 270
271 static uint32_t CreateUniqueID(); 271 static uint32_t CreateUniqueID();
272 272
273 // We're in an internal doubly linked list owned by GrResourceCache2 273 // We're in an internal doubly linked list owned by GrResourceCache2
274 SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrGpuResource); 274 SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrGpuResource);
275 275
276 276
277 static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0); 277 static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0);
278 enum Flags { 278 GrScratchKey fScratchKey;
279 /** 279 GrContentKey fContentKey;
280 * If set then fContentKey is valid and the resource is cached based on its content.
281 */
282 kContentKeySet_Flag = 0x1,
283 };
284
285 GrScratchKey fScratchKey;
286 // TODO(bsalomon): Remove GrResourceKey and use different simpler type for c ontent keys.
287 GrResourceKey fContentKey;
288 280
289 // This is not ref'ed but abandon() or release() will be called before the G rGpu object 281 // This is not ref'ed but abandon() or release() will be called before the G rGpu object
290 // is destroyed. Those calls set will this to NULL. 282 // is destroyed. Those calls set will this to NULL.
291 GrGpu* fGpu; 283 GrGpu* fGpu;
292 mutable size_t fGpuMemorySize; 284 mutable size_t fGpuMemorySize;
293 285
294 uint32_t fFlags; 286 LifeCycle fLifeCycle;
295 LifeCycle fLifeCycle; 287 const uint32_t fUniqueID;
296 const uint32_t fUniqueID;
297 288
298 SkAutoTUnref<const SkData> fData; 289 SkAutoTUnref<const SkData> fData;
299 290
300 typedef GrIORef<GrGpuResource> INHERITED; 291 typedef GrIORef<GrGpuResource> INHERITED;
301 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable. 292 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable.
302 }; 293 };
303 294
304 #endif 295 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | include/gpu/GrResourceKey.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698