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 c80c5a9b43ccca53b1b67e760c27fc7d29e213f0..60c36c909e61e8c496c3d782153f593ab140c6b4 100644 |
--- a/cc/tiles/gpu_image_decode_cache.h |
+++ b/cc/tiles/gpu_image_decode_cache.h |
@@ -232,10 +232,12 @@ class CC_EXPORT GpuImageDecodeCache |
struct ImageData : public base::RefCounted<ImageData> { |
ImageData(DecodedDataMode mode, |
size_t size, |
+ const gfx::ColorSpace& target_color_space, |
const SkImage::DeferredTextureImageUsageParams& upload_params); |
const DecodedDataMode mode; |
const size_t size; |
+ gfx::ColorSpace target_color_space; |
bool is_at_raster = false; |
SkImage::DeferredTextureImageUsageParams upload_params; |
@@ -265,7 +267,17 @@ class CC_EXPORT GpuImageDecodeCache |
// Uniquely identifies (without collisions) a specific DrawImage for use in |
// the |in_use_cache_|. |
- using InUseCacheKey = uint64_t; |
+ struct InUseCacheKey { |
ericrk
2017/04/04 02:38:04
I don't think we ever access the internals of this
ccameron
2017/04/04 06:41:10
Done.
|
+ explicit InUseCacheKey(const DrawImage& draw_image); |
vmpstr
2017/04/04 01:16:43
Can you use a similar pattern as in the software c
ccameron
2017/04/04 06:41:10
Done.
|
+ bool operator==(const InUseCacheKey& other) const; |
+ uint32_t image_id; |
+ int mip_level; |
+ SkFilterQuality filter_quality; |
+ gfx::ColorSpace target_color_space; |
ericrk
2017/04/04 02:38:04
This looks really big (close to 100 bytes) - I sor
ccameron
2017/04/04 06:41:10
I'm surprised that this is a performance-critical
ericrk
2017/04/04 16:28:40
I was actually more concerned about the memory cos
vmpstr
2017/04/04 17:30:08
I don't feel strongly about this. I think we do en
|
+ }; |
+ struct InUseCacheKeyHash { |
+ size_t operator()(const InUseCacheKey&) const; |
+ }; |
// All private functions should only be called while holding |lock_|. Some |
// functions also require the |context_| lock. These are indicated by |
@@ -337,7 +349,8 @@ class CC_EXPORT GpuImageDecodeCache |
// |in_use_cache_| represents the in-use (short-lived) cache. Entries are |
// cleaned up as soon as their ref count reaches zero. |
- using InUseCache = std::unordered_map<InUseCacheKey, InUseCacheEntry>; |
+ using InUseCache = |
+ std::unordered_map<InUseCacheKey, InUseCacheEntry, InUseCacheKeyHash>; |
InUseCache in_use_cache_; |
size_t max_working_set_bytes_; |