| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef GrResourceCache_DEFINED | 9 #ifndef GrResourceCache_DEFINED |
| 10 #define GrResourceCache_DEFINED | 10 #define GrResourceCache_DEFINED |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 public: | 51 public: |
| 52 GrResourceCache(const GrCaps* caps); | 52 GrResourceCache(const GrCaps* caps); |
| 53 ~GrResourceCache(); | 53 ~GrResourceCache(); |
| 54 | 54 |
| 55 // Default maximum number of budgeted resources in the cache. | 55 // Default maximum number of budgeted resources in the cache. |
| 56 static const int kDefaultMaxCount = 2 * (1 << 12); | 56 static const int kDefaultMaxCount = 2 * (1 << 12); |
| 57 // Default maximum number of bytes of gpu memory of budgeted resources in th
e cache. | 57 // Default maximum number of bytes of gpu memory of budgeted resources in th
e cache. |
| 58 static const size_t kDefaultMaxSize = 96 * (1 << 20); | 58 static const size_t kDefaultMaxSize = 96 * (1 << 20); |
| 59 // Default number of flushes a budgeted resources can go unused in the cache
before it is | 59 // Default number of flushes a budgeted resources can go unused in the cache
before it is |
| 60 // purged. Large values disable the feature (as the ring buffer of flush tim
estamps would be | 60 // purged. Large values disable the feature (as the ring buffer of flush tim
estamps would be |
| 61 // large). This is currently the default until we decide to enable this feat
ure | 61 // large). |
| 62 // of the cache by default. | 62 static const int kDefaultMaxUnusedFlushes = 64; |
| 63 static const int kDefaultMaxUnusedFlushes = 1024; | |
| 64 | 63 |
| 65 /** Used to access functionality needed by GrGpuResource for lifetime manage
ment. */ | 64 /** Used to access functionality needed by GrGpuResource for lifetime manage
ment. */ |
| 66 class ResourceAccess; | 65 class ResourceAccess; |
| 67 ResourceAccess resourceAccess(); | 66 ResourceAccess resourceAccess(); |
| 68 | 67 |
| 69 /** | 68 /** |
| 70 * Sets the cache limits in terms of number of resources, max gpu memory byt
e size, and number | 69 * Sets the cache limits in terms of number of resources, max gpu memory byt
e size, and number |
| 71 * of GrContext flushes that a resource can be unused before it is evicted.
The latter value is | 70 * of GrContext flushes that a resource can be unused before it is evicted.
The latter value is |
| 72 * a suggestion and there is no promise that a resource will be purged immed
iately after it | 71 * a suggestion and there is no promise that a resource will be purged immed
iately after it |
| 73 * hasn't been used in maxUnusedFlushes flushes. | 72 * hasn't been used in maxUnusedFlushes flushes. |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 383 |
| 385 friend class GrGpuResource; // To access all the proxy inline methods. | 384 friend class GrGpuResource; // To access all the proxy inline methods. |
| 386 friend class GrResourceCache; // To create this type. | 385 friend class GrResourceCache; // To create this type. |
| 387 }; | 386 }; |
| 388 | 387 |
| 389 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() { | 388 inline GrResourceCache::ResourceAccess GrResourceCache::resourceAccess() { |
| 390 return ResourceAccess(this); | 389 return ResourceAccess(this); |
| 391 } | 390 } |
| 392 | 391 |
| 393 #endif | 392 #endif |
| OLD | NEW |