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

Unified Diff: cc/tiles/checker_image_tracker.h

Issue 2924233002: cc: Move pre-decodes to background worker. (Closed)
Patch Set: export Created 3 years, 6 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/checker_image_tracker.h
diff --git a/cc/tiles/checker_image_tracker.h b/cc/tiles/checker_image_tracker.h
index 335050c6b9df5ec861be30f2f6b58f852bbebf07..563ba48ee4af883bcb6bf6eb697b6f703c71ea69 100644
--- a/cc/tiles/checker_image_tracker.h
+++ b/cc/tiles/checker_image_tracker.h
@@ -33,6 +33,22 @@ class CC_EXPORT CheckerImageTrackerClient {
// sync tree until the previous tree is activated.
class CC_EXPORT CheckerImageTracker {
public:
+ enum DecodeType : int {
vmpstr 2017/06/22 16:57:57 Can you comment why you're specifying int explicit
Khushal 2017/06/22 20:11:51 Done.
+ // Priority for images on tiles being rasterized (visible or pre-paint).
+ kRaster = 0,
+ // Lowest priority for images on tiles in pre-decode region. These are tiles
+ // which are beyond the pre-paint region, but have their images decoded.
+ kPreDecode = 1,
+
+ kLast = kPreDecode
+ };
+
+ struct CC_EXPORT ImageDecodeRequest {
+ ImageDecodeRequest(PaintImage paint_image, DecodeType type);
+ PaintImage paint_image;
+ DecodeType type;
+ };
+
CheckerImageTracker(ImageController* image_controller,
CheckerImageTrackerClient* client,
bool enable_checker_imaging);
@@ -42,9 +58,16 @@ class CC_EXPORT CheckerImageTracker {
// service and it should be be skipped during raster.
bool ShouldCheckerImage(const DrawImage& image, WhichTree tree);
- using ImageDecodeQueue = std::vector<PaintImage>;
+ // Provides a prioritized queue of images to decode.
+ using ImageDecodeQueue = std::vector<ImageDecodeRequest>;
void ScheduleImageDecodeQueue(ImageDecodeQueue image_decode_queue);
+ // Disables scheduling any decode work by the tracker.
+ void SetNoDecodesAllowed();
+
+ // The max decode priority type that is allowed to run.
+ void SetMaxDecodePriorityAllowed(DecodeType decode_type);
+
// Returns the set of images to invalidate on the sync tree.
const PaintImageIdFlatSet& TakeImagesToInvalidateOnSyncTree();
@@ -66,7 +89,16 @@ class CC_EXPORT CheckerImageTracker {
// raster.
void DisallowCheckeringForImage(const PaintImage& image);
+ int decode_priority_allowed_for_testing() const {
+ return decode_priority_allowed_;
+ }
+ bool no_decodes_allowed_for_testing() const {
+ return decode_priority_allowed_ == kNoDecodeAllowedPriority;
+ }
+
private:
+ const int kNoDecodeAllowedPriority = -1;
vmpstr 2017/06/22 16:57:57 static
Khushal 2017/06/22 20:11:51 Done.
+
enum class DecodePolicy {
// The image can be decoded asynchronously from raster. When set, the image
// is always skipped during rasterization of content that includes this
@@ -130,6 +162,9 @@ class CC_EXPORT CheckerImageTracker {
// dependent on these images.
ImageDecodeQueue image_decode_queue_;
+ // The max decode type that is allowed to run, if decodes are allowed to run.
+ int decode_priority_allowed_ = kNoDecodeAllowedPriority;
+
// The currently outstanding image decode that has been scheduled with the
// decode service. There can be only one outstanding decode at a time.
base::Optional<PaintImage> outstanding_image_decode_;

Powered by Google App Engine
This is Rietveld 408576698