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

Side by Side Diff: cc/tiles/checker_image_tracker.h

Issue 2927573003: cc: Disallow img.decode images from being checker imaged. (Closed)
Patch Set: update 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/tiles/checker_image_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_TILES_CHECKER_IMAGE_TRACKER_H_ 5 #ifndef CC_TILES_CHECKER_IMAGE_TRACKER_H_
6 #define CC_TILES_CHECKER_IMAGE_TRACKER_H_ 6 #define CC_TILES_CHECKER_IMAGE_TRACKER_H_
7 7
8 #include <unordered_map> 8 #include <unordered_map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // Called when the sync tree is activated. Each call to 51 // Called when the sync tree is activated. Each call to
52 // TakeImagesToInvalidateOnSyncTree() must be followed by this when the 52 // TakeImagesToInvalidateOnSyncTree() must be followed by this when the
53 // invalidated sync tree is activated. 53 // invalidated sync tree is activated.
54 void DidActivateSyncTree(); 54 void DidActivateSyncTree();
55 55
56 // Called to reset the tracker state on navigation. This will release all 56 // Called to reset the tracker state on navigation. This will release all
57 // cached images. Setting |can_clear_decode_policy_tracking| will also result 57 // cached images. Setting |can_clear_decode_policy_tracking| will also result
58 // in re-checkering any images already decoded by the tracker. 58 // in re-checkering any images already decoded by the tracker.
59 void ClearTracker(bool can_clear_decode_policy_tracking); 59 void ClearTracker(bool can_clear_decode_policy_tracking);
60 60
61 // Informs the tracker to not checker the given image. This can be used to opt
62 // out of the checkering behavior for certain images, such as ones that were
63 // decoded using the img.decode api.
64 // Note that if the image is already being checkered, then it will continue to
65 // do so. This call is meant to be issued prior to the image appearing during
66 // raster.
67 void DisallowCheckeringForImage(const PaintImage& image);
68
61 private: 69 private:
62 enum class DecodePolicy { 70 enum class DecodePolicy {
63 // The image can be decoded asynchronously from raster. When set, the image 71 // The image can be decoded asynchronously from raster. When set, the image
64 // is always skipped during rasterization of content that includes this 72 // is always skipped during rasterization of content that includes this
65 // image until it has been decoded using the decode service. 73 // image until it has been decoded using the decode service.
66 ASYNC, 74 ASYNC,
67 // The image has been decoded asynchronously once and should now be 75 // The image has been decoded asynchronously once and should now be
68 // synchronously rasterized with the content. 76 // synchronously rasterized with the content or the image has been
69 SYNC_DECODED_ONCE, 77 // permanently vetoed from being decoded async.
70 // The image has been permanently vetoed from being decoded async. 78 SYNC
71 SYNC_PERMANENT,
72 }; 79 };
73 80
74 // Wrapper to unlock an image decode requested from the ImageController on 81 // Wrapper to unlock an image decode requested from the ImageController on
75 // destruction. 82 // destruction.
76 class ScopedDecodeHolder { 83 class ScopedDecodeHolder {
77 public: 84 public:
78 ScopedDecodeHolder(ImageController* controller, 85 ScopedDecodeHolder(ImageController* controller,
79 ImageController::ImageDecodeRequestId request_id) 86 ImageController::ImageDecodeRequestId request_id)
80 : controller_(controller), request_id_(request_id) {} 87 : controller_(controller), request_id_(request_id) {}
81 ~ScopedDecodeHolder() { controller_->UnlockImageDecode(request_id_); } 88 ~ScopedDecodeHolder() { controller_->UnlockImageDecode(request_id_); }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 base::Optional<PaintImage> outstanding_image_decode_; 123 base::Optional<PaintImage> outstanding_image_decode_;
117 124
118 // A map of ImageId to its DecodePolicy. 125 // A map of ImageId to its DecodePolicy.
119 std::unordered_map<PaintImage::Id, DecodePolicy> image_async_decode_state_; 126 std::unordered_map<PaintImage::Id, DecodePolicy> image_async_decode_state_;
120 127
121 // A map of image id to image decode request id for images to be unlocked. 128 // A map of image id to image decode request id for images to be unlocked.
122 std::unordered_map<PaintImage::Id, std::unique_ptr<ScopedDecodeHolder>> 129 std::unordered_map<PaintImage::Id, std::unique_ptr<ScopedDecodeHolder>>
123 image_id_to_decode_; 130 image_id_to_decode_;
124 131
125 base::WeakPtrFactory<CheckerImageTracker> weak_factory_; 132 base::WeakPtrFactory<CheckerImageTracker> weak_factory_;
133
134 DISALLOW_COPY_AND_ASSIGN(CheckerImageTracker);
126 }; 135 };
127 136
128 } // namespace cc 137 } // namespace cc
129 138
130 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_ 139 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_
OLDNEW
« no previous file with comments | « no previous file | cc/tiles/checker_image_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698