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

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

Issue 414493002: Revert "Revert of Use the GrCacheable ID to eliminate the need for notifications to GrGpuGL when te… (Closed) Base URL: https://skia.googlesource.com/skia.git@removestuff
Patch Set: Address round 2 of comments 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 | « include/core/SkTypes.h ('k') | 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 virtual bool isValidOnGpu() const = 0; 55 virtual bool isValidOnGpu() const = 0;
56 56
57 void setCacheEntry(GrResourceCacheEntry* cacheEntry) { fCacheEntry = cacheEn try; } 57 void setCacheEntry(GrResourceCacheEntry* cacheEntry) { fCacheEntry = cacheEn try; }
58 GrResourceCacheEntry* getCacheEntry() { return fCacheEntry; } 58 GrResourceCacheEntry* getCacheEntry() { return fCacheEntry; }
59 59
60 /** 60 /**
61 * Gets an id that is unique for this GrCacheable object. It is static in th at it does 61 * Gets an id that is unique for this GrCacheable object. It is static in th at it does
62 * not change when the content of the GrCacheable object changes. This will never return 62 * not change when the content of the GrCacheable object changes. This will never return
63 * 0. 63 * 0.
64 */ 64 */
65 uint32_t getGenerationID() const; 65 uint32_t getUniqueID() const { return fUniqueID; }
66 66
67 protected: 67 protected:
68 GrCacheable() 68 GrCacheable()
69 : fRefCnt(1) 69 : fRefCnt(1)
70 , fCacheEntry(NULL) 70 , fCacheEntry(NULL)
71 , fGenID(0) {} 71 , fUniqueID(CreateUniqueID()) {}
72 72
73 bool isInCache() const { return NULL != fCacheEntry; } 73 bool isInCache() const { return NULL != fCacheEntry; }
74 74
75 /** 75 /**
76 * This entry point should be called whenever gpuMemorySize() begins 76 * This entry point should be called whenever gpuMemorySize() begins
77 * reporting a different size. If the object is in the cache, it will call 77 * reporting a different size. If the object is in the cache, it will call
78 * gpuMemorySize() immediately and pass the new size on to the resource 78 * gpuMemorySize() immediately and pass the new size on to the resource
79 * cache. 79 * cache.
80 */ 80 */
81 void didChangeGpuMemorySize() const; 81 void didChangeGpuMemorySize() const;
82 82
83 private: 83 private:
84 static uint32_t CreateUniqueID();
85
84 mutable int32_t fRefCnt; 86 mutable int32_t fRefCnt;
85 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache 87 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache
86 mutable uint32_t fGenID; 88 const uint32_t fUniqueID;
87 89
88 typedef SkNoncopyable INHERITED; 90 typedef SkNoncopyable INHERITED;
89 }; 91 };
90 92
91 #endif 93 #endif
OLDNEW
« no previous file with comments | « include/core/SkTypes.h ('k') | src/gpu/GrBitmapTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698