OLD | NEW |
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 |
11 #include "GrResourceKey.h" | 11 #include "GrResourceKey.h" |
12 #include "GrTypesPriv.h" | 12 #include "GrTypesPriv.h" |
13 #include "SkData.h" | 13 #include "SkData.h" |
14 #include "SkInstCnt.h" | 14 #include "SkInstCnt.h" |
15 #include "SkTInternalLList.h" | |
16 | 15 |
17 class GrContext; | 16 class GrContext; |
18 class GrGpu; | 17 class GrGpu; |
19 class GrResourceCache; | 18 class GrResourceCache; |
20 | 19 |
21 /** | 20 /** |
22 * Base class for GrGpuResource. Handles the various types of refs we need. Sepa
rated out as a base | 21 * Base class for GrGpuResource. Handles the various types of refs we need. Sepa
rated out as a base |
23 * class to isolate the ref-cnting behavior and provide friendship without expos
ing all of | 22 * class to isolate the ref-cnting behavior and provide friendship without expos
ing all of |
24 * GrGpuResource. | 23 * GrGpuResource. |
25 * | 24 * |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 void removeScratchKey(); | 275 void removeScratchKey(); |
277 void makeBudgeted(); | 276 void makeBudgeted(); |
278 void makeUnbudgeted(); | 277 void makeUnbudgeted(); |
279 | 278 |
280 #ifdef SK_DEBUG | 279 #ifdef SK_DEBUG |
281 friend class GrGpu; // for assert in GrGpu to access getGpu | 280 friend class GrGpu; // for assert in GrGpu to access getGpu |
282 #endif | 281 #endif |
283 | 282 |
284 static uint32_t CreateUniqueID(); | 283 static uint32_t CreateUniqueID(); |
285 | 284 |
286 // We're in an internal doubly linked list owned by GrResourceCache. TODO: R
eplace this with an | |
287 // array of unpurgeable resources in the cache. | |
288 SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrGpuResource); | |
289 | |
290 // These are used for cache bookkeeping | 285 // These are used for cache bookkeeping |
291 int fCacheArrayIndex; | 286 int fCacheArrayIndex; |
292 uint32_t fTimestamp; | 287 uint32_t fTimestamp; |
293 | 288 |
294 static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0); | 289 static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0); |
295 GrScratchKey fScratchKey; | 290 GrScratchKey fScratchKey; |
296 GrContentKey fContentKey; | 291 GrContentKey fContentKey; |
297 | 292 |
298 // This is not ref'ed but abandon() or release() will be called before the G
rGpu object | 293 // This is not ref'ed but abandon() or release() will be called before the G
rGpu object |
299 // is destroyed. Those calls set will this to NULL. | 294 // is destroyed. Those calls set will this to NULL. |
300 GrGpu* fGpu; | 295 GrGpu* fGpu; |
301 mutable size_t fGpuMemorySize; | 296 mutable size_t fGpuMemorySize; |
302 | 297 |
303 LifeCycle fLifeCycle; | 298 LifeCycle fLifeCycle; |
304 const uint32_t fUniqueID; | 299 const uint32_t fUniqueID; |
305 | 300 |
306 SkAutoTUnref<const SkData> fData; | 301 SkAutoTUnref<const SkData> fData; |
307 | 302 |
308 typedef GrIORef<GrGpuResource> INHERITED; | 303 typedef GrIORef<GrGpuResource> INHERITED; |
309 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgeable. | 304 friend class GrIORef<GrGpuResource>; // to access notifyIsPurgeable. |
310 }; | 305 }; |
311 | 306 |
312 #endif | 307 #endif |
OLD | NEW |