Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(611)

Unified Diff: cc/tiles/gpu_image_decode_cache.h

Issue 2797583002: cc: Add color space to image decode caches (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 0c788137ff7160e4b718152b51f4c98049034433..8c3230e3ca858cfc05e2e4a3dc3664314b9dd51d 100644
--- a/cc/tiles/gpu_image_decode_cache.h
+++ b/cc/tiles/gpu_image_decode_cache.h
@@ -233,10 +233,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;
@@ -266,7 +268,24 @@ class CC_EXPORT GpuImageDecodeCache
// Uniquely identifies (without collisions) a specific DrawImage for use in
// the |in_use_cache_|.
- using InUseCacheKey = uint64_t;
+ struct InUseCacheKeyHash;
+ struct InUseCacheKey {
+ static InUseCacheKey FromDrawImage(const DrawImage& draw_image);
+ bool operator==(const InUseCacheKey& other) const;
+
+ private:
+ friend struct GpuImageDecodeCache::InUseCacheKeyHash;
+ explicit InUseCacheKey(const DrawImage& draw_image);
+
+ uint32_t image_id;
+ int mip_level;
+ SkFilterQuality filter_quality;
+ gfx::ColorSpace target_color_space;
+ };
+ struct InUseCacheKeyHash {
+ size_t operator()(const InUseCacheKey&) const;
+ };
+ InUseCacheKey FromDrawImage(const DrawImage& draw_image);
vmpstr 2017/04/06 00:18:50 This is unused?
ccameron 2017/04/06 01:36:28 Oop, yes, it can be killed.
// All private functions should only be called while holding |lock_|. Some
// functions also require the |context_| lock. These are indicated by
@@ -338,7 +357,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_;

Powered by Google App Engine
This is Rietveld 408576698