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

Unified Diff: cc/tiles/software_image_decode_cache.h

Issue 2844273004: cc: Make images that can't possibly fit in cache not checker. (Closed)
Patch Set: 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/software_image_decode_cache.h
diff --git a/cc/tiles/software_image_decode_cache.h b/cc/tiles/software_image_decode_cache.h
index 1d3e2ac75c40d603c8a3009edfce9d0885aac908..2da980681079258e14889d56eb3f74c4b96fdb42 100644
--- a/cc/tiles/software_image_decode_cache.h
+++ b/cc/tiles/software_image_decode_cache.h
@@ -140,6 +140,7 @@ class CC_EXPORT SoftwareImageDecodeCache
void SetShouldAggressivelyFreeResources(
bool aggressively_free_resources) override {}
void ClearCache() override;
+ size_t GetMaximumMemoryLimit() const override;
// Decode the given image and store it in the cache. This is only called by an
// image decode task from a worker thread.
@@ -220,7 +221,7 @@ class CC_EXPORT SoftwareImageDecodeCache
size_t GetCurrentUsageSafe() const;
private:
- size_t limit_bytes_;
+ const size_t limit_bytes_;
base::CheckedNumeric<size_t> current_usage_bytes_;
};
@@ -306,6 +307,8 @@ class CC_EXPORT SoftwareImageDecodeCache
// The members below this comment can only be accessed if the lock is held to
// ensure that they are safe to access on multiple threads.
+ // The exception is accessing |locked_images_budget_.total_limit_bytes()|,
+ // which is const and thread safe.
Khushal 2017/04/28 00:12:53 nit: Can you make |limit_bytes_| in MemoryBudget c
Khushal 2017/04/28 00:18:46 Note to self: Look for colors other than green.
vmpstr 2017/04/28 17:18:30 Acknowledged.
base::Lock lock_;
// Decoded images and ref counts (predecode path).

Powered by Google App Engine
This is Rietveld 408576698