| Index: cc/tiles/gpu_image_decode_cache.h
|
| diff --git a/cc/tiles/gpu_image_decode_cache.h b/cc/tiles/gpu_image_decode_cache.h
|
| index a48624d6ef4c122301cec1c6bc77ef7bf0c03c2b..c80c5a9b43ccca53b1b67e760c27fc7d29e213f0 100644
|
| --- a/cc/tiles/gpu_image_decode_cache.h
|
| +++ b/cc/tiles/gpu_image_decode_cache.h
|
| @@ -103,7 +103,8 @@ class CC_EXPORT GpuImageDecodeCache
|
|
|
| explicit GpuImageDecodeCache(ContextProvider* context,
|
| ResourceFormat decode_format,
|
| - size_t max_gpu_image_bytes);
|
| + size_t max_working_set_bytes,
|
| + size_t max_cache_bytes);
|
| ~GpuImageDecodeCache() override;
|
|
|
| // ImageDecodeCache overrides.
|
| @@ -142,8 +143,9 @@ class CC_EXPORT GpuImageDecodeCache
|
| void OnImageUploadTaskCompleted(const DrawImage& image);
|
|
|
| // For testing only.
|
| - void SetCachedBytesLimitForTesting(size_t limit) {
|
| + void SetAllByteLimitsForTesting(size_t limit) {
|
| cached_bytes_limit_ = limit;
|
| + max_working_set_bytes_ = limit;
|
| }
|
| size_t GetBytesUsedForTesting() const { return bytes_used_; }
|
| size_t GetNumCacheEntriesForTesting() const {
|
| @@ -292,10 +294,11 @@ class CC_EXPORT GpuImageDecodeCache
|
| // to ref-count or to orphaned status.
|
| void OwnershipChanged(const DrawImage& draw_image, ImageData* image_data);
|
|
|
| - // Ensures that the cache can hold an element of |required_size|, freeing
|
| - // unreferenced cache entries if necessary to make room.
|
| + // Ensures that the working set can hold an element of |required_size|,
|
| + // freeing unreferenced cache entries to make room.
|
| bool EnsureCapacity(size_t required_size);
|
| - bool CanFitSize(size_t size) const;
|
| + bool CanFitInWorkingSet(size_t size) const;
|
| + bool CanFitInCache(size_t size) const;
|
| bool ExceedsPreferredCount() const;
|
|
|
| void DecodeImageIfNecessary(const DrawImage& draw_image,
|
| @@ -337,8 +340,9 @@ class CC_EXPORT GpuImageDecodeCache
|
| using InUseCache = std::unordered_map<InUseCacheKey, InUseCacheEntry>;
|
| InUseCache in_use_cache_;
|
|
|
| - const size_t normal_max_gpu_image_bytes_;
|
| - size_t cached_bytes_limit_ = normal_max_gpu_image_bytes_;
|
| + size_t max_working_set_bytes_;
|
| + const size_t normal_max_cache_bytes_;
|
| + size_t cached_bytes_limit_ = normal_max_cache_bytes_;
|
| size_t bytes_used_ = 0;
|
| base::MemoryState memory_state_ = base::MemoryState::NORMAL;
|
|
|
|
|