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

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

Issue 739383006: Making GrGpuResource::release public for special case in Blink (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: whitespace Created 6 years 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 | no next file » | 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 */ 167 */
168 uint32_t getUniqueID() const { return fUniqueID; } 168 uint32_t getUniqueID() const { return fUniqueID; }
169 169
170 /** 170 /**
171 * Internal-only helper class used for cache manipulations of the reosurce. 171 * Internal-only helper class used for cache manipulations of the reosurce.
172 */ 172 */
173 class CacheAccess; 173 class CacheAccess;
174 inline CacheAccess cacheAccess(); 174 inline CacheAccess cacheAccess();
175 inline const CacheAccess cacheAccess() const; 175 inline const CacheAccess cacheAccess() const;
176 176
177 /**
178 * Removes references to objects in the underlying 3D API without freeing th em.
179 * Called by CacheAccess.
180 * In general this method should not be called outside of skia. It was
181 * made by public for a special case where it needs to be called in Blink
182 * when a texture becomes unsafe to use after having been shared through
183 * a texture mailbox.
184 */
185 void abandon();
186
177 protected: 187 protected:
178 // This must be called by every GrGpuObject. It should be called once the ob ject is fully 188 // This must be called by every GrGpuObject. It should be called once the ob ject is fully
179 // initialized (i.e. not in a base class constructor). 189 // initialized (i.e. not in a base class constructor).
180 void registerWithCache(); 190 void registerWithCache();
181 191
182 GrGpuResource(GrGpu*, bool isWrapped); 192 GrGpuResource(GrGpu*, bool isWrapped);
183 virtual ~GrGpuResource(); 193 virtual ~GrGpuResource();
184 194
185 GrGpu* getGpu() const { return fGpu; } 195 GrGpu* getGpu() const { return fGpu; }
186 196
(...skipping 17 matching lines...) Expand all
204 * By default resources are not usable as scratch. This should only be calle d once. 214 * By default resources are not usable as scratch. This should only be calle d once.
205 **/ 215 **/
206 void setScratchKey(const GrResourceKey& scratchKey); 216 void setScratchKey(const GrResourceKey& scratchKey);
207 217
208 private: 218 private:
209 /** 219 /**
210 * Frees the object in the underlying 3D API. Called by CacheAccess. 220 * Frees the object in the underlying 3D API. Called by CacheAccess.
211 */ 221 */
212 void release(); 222 void release();
213 223
214 /**
215 * Removes references to objects in the underlying 3D API without freeing th em.
216 * Called by CacheAccess.
217 */
218 void abandon();
219
220 virtual size_t onGpuMemorySize() const = 0; 224 virtual size_t onGpuMemorySize() const = 0;
221 225
222 // See comments in CacheAccess. 226 // See comments in CacheAccess.
223 bool setContentKey(const GrResourceKey& contentKey); 227 bool setContentKey(const GrResourceKey& contentKey);
224 void setBudgeted(bool countsAgainstBudget); 228 void setBudgeted(bool countsAgainstBudget);
225 void notifyIsPurgable() const; 229 void notifyIsPurgable() const;
226 void removeScratchKey(); 230 void removeScratchKey();
227 231
228 #ifdef SK_DEBUG 232 #ifdef SK_DEBUG
229 friend class GrGpu; // for assert in GrGpu to access getGpu 233 friend class GrGpu; // for assert in GrGpu to access getGpu
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 mutable size_t fGpuMemorySize; 270 mutable size_t fGpuMemorySize;
267 271
268 uint32_t fFlags; 272 uint32_t fFlags;
269 const uint32_t fUniqueID; 273 const uint32_t fUniqueID;
270 274
271 typedef GrIORef<GrGpuResource> INHERITED; 275 typedef GrIORef<GrGpuResource> INHERITED;
272 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable. 276 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable.
273 }; 277 };
274 278
275 #endif 279 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698