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

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: 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 * Frees the object in the underlying 3D API. Called by CacheAccess.
179 * In general this method should not be called outside of skia. It was
180 * made by public for a special case where it need to be called in Blink
181 * when a texture becomes unsafe to use after having been shared through
182 * a texture mailbox.
183 */
184 void release();
bsalomon 2014/12/10 20:35:02 Is it right to call release and not abandon in the
185
177 protected: 186 protected:
178 // This must be called by every GrGpuObject. It should be called once the ob ject is fully 187 // 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). 188 // initialized (i.e. not in a base class constructor).
180 void registerWithCache(); 189 void registerWithCache();
181 190
182 GrGpuResource(GrGpu*, bool isWrapped); 191 GrGpuResource(GrGpu*, bool isWrapped);
183 virtual ~GrGpuResource(); 192 virtual ~GrGpuResource();
184 193
185 GrGpu* getGpu() const { return fGpu; } 194 GrGpu* getGpu() const { return fGpu; }
186 195
(...skipping 12 matching lines...) Expand all
199 */ 208 */
200 void didChangeGpuMemorySize() const; 209 void didChangeGpuMemorySize() const;
201 210
202 /** 211 /**
203 * Optionally called by the GrGpuResource subclass if the resource can be us ed as scratch. 212 * Optionally called by the GrGpuResource subclass if the resource can be us ed as scratch.
204 * By default resources are not usable as scratch. This should only be calle d once. 213 * By default resources are not usable as scratch. This should only be calle d once.
205 **/ 214 **/
206 void setScratchKey(const GrResourceKey& scratchKey); 215 void setScratchKey(const GrResourceKey& scratchKey);
207 216
208 private: 217 private:
209 /**
210 * Frees the object in the underlying 3D API. Called by CacheAccess.
211 */
212 void release();
213 218
214 /** 219 /**
215 * Removes references to objects in the underlying 3D API without freeing th em. 220 * Removes references to objects in the underlying 3D API without freeing th em.
216 * Called by CacheAccess. 221 * Called by CacheAccess.
217 */ 222 */
218 void abandon(); 223 void abandon();
219 224
220 virtual size_t onGpuMemorySize() const = 0; 225 virtual size_t onGpuMemorySize() const = 0;
221 226
222 // See comments in CacheAccess. 227 // See comments in CacheAccess.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 mutable size_t fGpuMemorySize; 271 mutable size_t fGpuMemorySize;
267 272
268 uint32_t fFlags; 273 uint32_t fFlags;
269 const uint32_t fUniqueID; 274 const uint32_t fUniqueID;
270 275
271 typedef GrIORef<GrGpuResource> INHERITED; 276 typedef GrIORef<GrGpuResource> INHERITED;
272 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable. 277 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable.
273 }; 278 };
274 279
275 #endif 280 #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