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

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

Issue 488463004: Revert of Make GrGpuResources register with GrResourceCache2 after fully constructed. (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
« no previous file with comments | « bench/GrResourceCacheBench.cpp ('k') | src/gpu/GrGpuResource.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 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 GrResourceCacheEntry* getCacheEntry() { return fCacheEntry; } 83 GrResourceCacheEntry* getCacheEntry() { return fCacheEntry; }
84 84
85 /** 85 /**
86 * Gets an id that is unique for this GrCacheable object. It is static in th at it does 86 * Gets an id that is unique for this GrCacheable object. It is static in th at it does
87 * not change when the content of the GrCacheable object changes. This will never return 87 * not change when the content of the GrCacheable object changes. This will never return
88 * 0. 88 * 0.
89 */ 89 */
90 uint32_t getUniqueID() const { return fUniqueID; } 90 uint32_t getUniqueID() const { return fUniqueID; }
91 91
92 protected: 92 protected:
93
94 // This must be called by every GrGpuObject. It should be called once the ob ject is fully
95 // initialized (i.e. not in a base class constructor).
96 void registerWithCache();
97
98 GrGpuResource(GrGpu*, bool isWrapped); 93 GrGpuResource(GrGpu*, bool isWrapped);
99 virtual ~GrGpuResource(); 94 virtual ~GrGpuResource();
100 95
101 bool isInCache() const { return NULL != fCacheEntry; } 96 bool isInCache() const { return NULL != fCacheEntry; }
102 97
103 GrGpu* getGpu() const { return fGpu; } 98 GrGpu* getGpu() const { return fGpu; }
104 99
105 // Derived classes should always call their parent class' onRelease 100 // Derived classes should always call their parent class' onRelease
106 // and onAbandon methods in their overrides. 101 // and onAbandon methods in their overrides.
107 virtual void onRelease() {}; 102 virtual void onRelease() {};
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 uint32_t fFlags; 138 uint32_t fFlags;
144 139
145 mutable int32_t fRefCnt; 140 mutable int32_t fRefCnt;
146 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache 141 GrResourceCacheEntry* fCacheEntry; // NULL if not in cache
147 const uint32_t fUniqueID; 142 const uint32_t fUniqueID;
148 143
149 typedef SkNoncopyable INHERITED; 144 typedef SkNoncopyable INHERITED;
150 }; 145 };
151 146
152 #endif 147 #endif
OLDNEW
« no previous file with comments | « bench/GrResourceCacheBench.cpp ('k') | src/gpu/GrGpuResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698