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

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

Issue 2668873002: cc: Add checker-imaging support to TileManager. (Closed)
Patch Set: all tests Created 3 years, 10 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_TILES_CHECKER_IMAGE_TRACKER_H_
6 #define CC_TILES_CHECKER_IMAGE_TRACKER_H_
7
8 #include <unordered_map>
9 #include <vector>
10
11 #include "cc/base/cc_export.h"
12 #include "cc/playback/image_id.h"
13 #include "cc/tiles/image_controller.h"
14 #include "third_party/skia/include/core/SkImage.h"
15
16 namespace cc {
17
18 class CC_EXPORT CheckerImageTrackerClient {
19 public:
20 virtual ~CheckerImageTrackerClient() = default;
21
22 virtual void NeedsInvalidationForCheckerImagedTiles() = 0;
23 };
24
25 class CC_EXPORT CheckerImageTracker {
vmpstr 2017/02/13 22:49:31 Can you make a class comment here describing the f
Khushal 2017/02/14 05:10:22 Done.
26 public:
27 CheckerImageTracker(ImageController* image_controller,
28 CheckerImageTrackerClient* client,
29 bool enable_checker_imaging);
30 ~CheckerImageTracker();
31
32 // Given the |images| for a tile, filters the images which will be deferred
33 // asynchronously using the image decoded service, eliminating them from
34 // |images| adds them to the |checkered_images| set, so they can be skipped
35 // during the rasterization of this tile.
36 // The entries remaining in |images| are for images for which a cached decode
37 // from the image decode service is available, or which must be decoded before
38 // before this tile can be rasterized.
39 void FilterImagesForCheckeringForTile(std::vector<DrawImage>* images,
40 ImageIdFlatSet* checkered_images,
41 WhichTree tree);
42
43 // Returns the set of images to invalidate on the sync tree.
44 const std::unordered_set<ImageId>& TakeImagesToInvalidateOnSyncTree();
45
46 void DidActivateSyncTree();
47
48 private:
49 void DidFinishImageDecode(ImageId image_id,
50 ImageController::ImageDecodeRequestId request_id);
51
52 // Returns true if the decode for |image| will be deferred to the image decode
53 // service and it should be be skipped during raster.
54 bool ShouldCheckerImage(const sk_sp<const SkImage>& image,
55 WhichTree tree) const;
56
57 void ScheduleImageDecodeIfNecessary(const sk_sp<const SkImage> image);
58
59 ImageController* image_controller_;
60 CheckerImageTrackerClient* client_;
61 const bool enable_checker_imaging_;
62
63 // A set of images which have been decoded and are pending invalidation for
64 // raster on the checkered tiles.
65 ImageIdSet images_pending_invalidation_;
66
67 // A set of images which were invalidated on the current sync tree.
68 ImageIdSet invalidated_images_on_current_sync_tree_;
69
70 // A set of images which are currently pending decode from the image decode
71 // service.
72 // TODO(khushalsagar): This should be a queue that gets re-built each time we
73 // do a PrepareTiles? See crbug.com/689184.
74 ImageIdSet pending_image_decodes_;
75
76 // A set of images which have been decoded at least once from the
77 // ImageDecodeService and should not be checkered again.
78 // TODO(khushalsagar): Limit the size of this set.
79 ImageIdSet images_decoded_once_;
80
81 // A map of image id to image decode request id for images to be unlocked.
82 std::unordered_map<ImageId, ImageController::ImageDecodeRequestId>
83 image_id_to_decode_request_id_;
84
85 base::WeakPtrFactory<CheckerImageTracker> weak_factory_;
86 };
87
88 } // namespace cc
89
90 #endif // CC_TILES_CHECKER_IMAGE_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698