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

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

Issue 376703009: Use the GrCacheable ID to eliminate the need for notifications to GrGpuGL when textures and RTs are… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: now with 64 bits Created 6 years, 5 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 | « no previous file | src/gpu/GrBitmapTextContext.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 GrCacheable_DEFINED 8 #ifndef GrCacheable_DEFINED
9 #define GrCacheable_DEFINED 9 #define GrCacheable_DEFINED
10 10
(...skipping 28 matching lines...) Expand all
39 virtual bool isValidOnGpu() const = 0; 39 virtual bool isValidOnGpu() const = 0;
40 40
41 void setCacheEntry(GrResourceCacheEntry* cacheEntry) { fCacheEntry = cacheEn try; } 41 void setCacheEntry(GrResourceCacheEntry* cacheEntry) { fCacheEntry = cacheEn try; }
42 GrResourceCacheEntry* getCacheEntry() { return fCacheEntry; } 42 GrResourceCacheEntry* getCacheEntry() { return fCacheEntry; }
43 43
44 /** 44 /**
45 * Gets an id that is unique for this GrCacheable object. It is static in th at it does 45 * Gets an id that is unique for this GrCacheable object. It is static in th at it does
46 * not change when the content of the GrCacheable object changes. This will never return 46 * not change when the content of the GrCacheable object changes. This will never return
47 * 0. 47 * 0.
48 */ 48 */
49 uint32_t getGenerationID() const; 49 uint64_t getInstanceID() const { return fInstanceID; }
50 50
51 protected: 51 protected:
52 GrCacheable() 52 GrCacheable()
53 : fCacheEntry(NULL) 53 : fCacheEntry(NULL)
54 , fGenID(0) {} 54 , fInstanceID(CreateInstanceID()) {}
55 55
56 bool isInCache() const { return NULL != fCacheEntry; } 56 bool isInCache() const { return NULL != fCacheEntry; }
57 57
58 /** 58 /**
59 * This entry point should be called whenever gpuMemorySize() begins 59 * This entry point should be called whenever gpuMemorySize() begins
60 * reporting a different size. If the object is in the cache, it will call 60 * reporting a different size. If the object is in the cache, it will call
61 * gpuMemorySize() immediately and pass the new size on to the resource 61 * gpuMemorySize() immediately and pass the new size on to the resource
62 * cache. 62 * cache.
63 */ 63 */
64 void didChangeGpuMemorySize() const; 64 void didChangeGpuMemorySize() const;
65 65
66 private: 66 private:
67 static uint64_t CreateInstanceID();
68
67 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache 69 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache
68 mutable uint32_t fGenID; 70 mutable uint64_t fInstanceID;
69 71
70 typedef SkRefCnt INHERITED; 72 typedef SkRefCnt INHERITED;
71 }; 73 };
72 74
73 #endif 75 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrBitmapTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698