| OLD | NEW | 
|---|
| 1 |  | 
| 2 /* | 1 /* | 
| 3  * Copyright 2014 Google Inc. | 2  * Copyright 2014 Google Inc. | 
| 4  * | 3  * | 
| 5  * 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 | 
| 6  * found in the LICENSE file. | 5  * found in the LICENSE file. | 
| 7  */ | 6  */ | 
| 8 | 7 | 
| 9 #ifndef GrResourceCache_DEFINED | 8 #ifndef GrResourceCache_DEFINED | 
| 10 #define GrResourceCache_DEFINED | 9 #define GrResourceCache_DEFINED | 
| 11 | 10 | 
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 124         /** Will not return any resources that match but have pending IO. */ | 123         /** Will not return any resources that match but have pending IO. */ | 
| 125         kRequireNoPendingIO_ScratchFlag = 0x2, | 124         kRequireNoPendingIO_ScratchFlag = 0x2, | 
| 126     }; | 125     }; | 
| 127 | 126 | 
| 128     /** | 127     /** | 
| 129      * Find a resource that matches a scratch key. | 128      * Find a resource that matches a scratch key. | 
| 130      */ | 129      */ | 
| 131     GrGpuResource* findAndRefScratchResource(const GrScratchKey& scratchKey, | 130     GrGpuResource* findAndRefScratchResource(const GrScratchKey& scratchKey, | 
| 132                                              size_t resourceSize, | 131                                              size_t resourceSize, | 
| 133                                              uint32_t flags); | 132                                              uint32_t flags); | 
| 134 | 133 | 
| 135 #ifdef SK_DEBUG | 134 #ifdef SK_DEBUG | 
| 136     // This is not particularly fast and only used for validation, so debug only
     . | 135     // This is not particularly fast and only used for validation, so debug only
     . | 
| 137     int countScratchEntriesForKey(const GrScratchKey& scratchKey) const { | 136     int countScratchEntriesForKey(const GrScratchKey& scratchKey) const { | 
| 138         return fScratchMap.countForKey(scratchKey); | 137         return fScratchMap.countForKey(scratchKey); | 
| 139     } | 138     } | 
| 140 #endif | 139 #endif | 
| 141 | 140 | 
| 142     /** | 141     /** | 
| 143      * Find a resource that matches a unique key. | 142      * Find a resource that matches a unique key. | 
| 144      */ | 143      */ | 
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 254     void refAndMakeResourceMRU(GrGpuResource*); | 253     void refAndMakeResourceMRU(GrGpuResource*); | 
| 255     /// @} | 254     /// @} | 
| 256 | 255 | 
| 257     void resetFlushTimestamps(); | 256     void resetFlushTimestamps(); | 
| 258     void processInvalidUniqueKeys(const SkTArray<GrUniqueKeyInvalidatedMessage>&
     ); | 257     void processInvalidUniqueKeys(const SkTArray<GrUniqueKeyInvalidatedMessage>&
     ); | 
| 259     void addToNonpurgeableArray(GrGpuResource*); | 258     void addToNonpurgeableArray(GrGpuResource*); | 
| 260     void removeFromNonpurgeableArray(GrGpuResource*); | 259     void removeFromNonpurgeableArray(GrGpuResource*); | 
| 261     bool overBudget() const { return fBudgetedBytes > fMaxBytes || fBudgetedCoun
     t > fMaxCount; } | 260     bool overBudget() const { return fBudgetedBytes > fMaxBytes || fBudgetedCoun
     t > fMaxCount; } | 
| 262 | 261 | 
| 263     bool wouldFit(size_t bytes) { | 262     bool wouldFit(size_t bytes) { | 
| 264         return fBudgetedBytes+bytes <= fMaxBytes && fBudgetedCount+1 <= fMaxCoun
     t; | 263         return fBudgetedBytes+bytes <= fMaxBytes && fBudgetedCount+1 <= fMaxCoun
     t; | 
| 265     } | 264     } | 
| 266 | 265 | 
| 267     uint32_t getNextTimestamp(); | 266     uint32_t getNextTimestamp(); | 
| 268 | 267 | 
| 269 #ifdef SK_DEBUG | 268 #ifdef SK_DEBUG | 
| 270     bool isInCache(const GrGpuResource* r) const; | 269     bool isInCache(const GrGpuResource* r) const; | 
| 271     void validate() const; | 270     void validate() const; | 
| 272 #else | 271 #else | 
| 273     void validate() const {} | 272     void validate() const {} | 
| 274 #endif | 273 #endif | 
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 431 | 430 | 
| 432     friend class GrGpuResource; // To access all the proxy inline methods. | 431     friend class GrGpuResource; // To access all the proxy inline methods. | 
| 433     friend class GrResourceCache; // To create this type. | 432     friend class GrResourceCache; // To create this type. | 
| 434 }; | 433 }; | 
| 435 | 434 | 
| 436 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() { | 435 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() { | 
| 437     return ResourceAccess(this); | 436     return ResourceAccess(this); | 
| 438 } | 437 } | 
| 439 | 438 | 
| 440 #endif | 439 #endif | 
| OLD | NEW | 
|---|