Chromium Code Reviews| Index: include/gpu/GrGpuResource.h |
| diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h |
| index 3c87117124d66d98178867ee6af7828d328c410f..b4c5a9d8f9ff7e7de995623cde3fccdb0ed5b1b6 100644 |
| --- a/include/gpu/GrGpuResource.h |
| +++ b/include/gpu/GrGpuResource.h |
| @@ -208,7 +208,7 @@ protected: |
| virtual void onRelease() {}; |
| virtual void onAbandon() {}; |
| - bool isWrapped() const { return kWrapped_FlagBit & fFlags; } |
| + bool isWrapped() const { return SkToBool(kWrapped_Flag & fFlags); } |
| /** |
| * This entry point should be called whenever gpuMemorySize() should report a different size. |
| @@ -227,7 +227,7 @@ private: |
| // See comments in CacheAccess. |
| bool setContentKey(const GrResourceKey& contentKey); |
| - |
| + void setBudgeted(bool countsAgainstBudget); |
| void notifyIsPurgable() const; |
| #ifdef SK_DEBUG |
| @@ -239,31 +239,39 @@ private: |
| // We're in an internal doubly linked list owned by GrResourceCache2 |
| SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrGpuResource); |
| - // This is not ref'ed but abandon() or release() will be called before the GrGpu object |
| - // is destroyed. Those calls set will this to NULL. |
| - GrGpu* fGpu; |
| + static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0); |
| enum Flags { |
| /** |
| - * This object wraps a GPU object given to us by the user. |
| - * Lifetime management is left up to the user (i.e., we will not |
| - * free it). |
| + * The resource counts against the resource cache's budget. |
| */ |
| - kWrapped_FlagBit = 0x1, |
| - }; |
| + kBudgeted_Flag = 0x1, |
| - static const size_t kInvalidGpuMemorySize = ~static_cast<size_t>(0); |
| - |
| - uint32_t fFlags; |
| + /** |
| + * This object wraps a GPU object given to us by Skia's client. Skia will not free the |
| + * underlying backend API GPU resources when the GrGpuResource is destroyed. This also |
| + * implies that kBudgeted_Flag is not set. |
| + */ |
| + kWrapped_Flag = 0x2, |
| - mutable size_t fGpuMemorySize; |
| - const uint32_t fUniqueID; |
| + /** |
| + * If set then fContentKey is valid and the resource is cached based on its content. |
| + */ |
| + kContentKeySet_Flag = 0x4, |
| + }; |
| // TODO(bsalomon): Remove GrResourceKey and use different simpler types for content and scratch |
| // keys. |
| GrResourceKey fScratchKey; |
| GrResourceKey fContentKey; |
| - bool fContentKeySet; |
| + |
| + // This is not ref'ed but abandon() or release() will be called before the GrGpu object |
|
bsalomon
2014/11/13 19:20:54
Mostly shuffling order and removed fContentKeySet
|
| + // is destroyed. Those calls set will this to NULL. |
| + GrGpu* fGpu; |
| + mutable size_t fGpuMemorySize; |
| + |
| + uint32_t fFlags; |
| + const uint32_t fUniqueID; |
| typedef GrIORef<GrGpuResource> INHERITED; |
| friend class GrIORef<GrGpuResource>; // to access notifyIsPurgable. |