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

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

Issue 2726343004: cc: Optimize decode scheduling for checker-images. (Closed)
Patch Set: fixed tile iteration 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_TILE_H_ 5 #ifndef CC_TILES_TILE_H_
6 #define CC_TILES_TILE_H_ 6 #define CC_TILES_TILE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "cc/paint/draw_image.h"
13 #include "cc/raster/tile_task.h" 14 #include "cc/raster/tile_task.h"
14 #include "cc/tiles/tile_draw_info.h" 15 #include "cc/tiles/tile_draw_info.h"
15 #include "ui/gfx/geometry/rect.h" 16 #include "ui/gfx/geometry/rect.h"
16 #include "ui/gfx/geometry/size.h" 17 #include "ui/gfx/geometry/size.h"
17 18
18 namespace cc { 19 namespace cc {
19 20
20 class PictureLayerTiling; 21 class PictureLayerTiling;
21 class TileManager; 22 class TileManager;
22 23
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 107
107 bool HasRasterTask() const { return !!raster_task_.get(); } 108 bool HasRasterTask() const { return !!raster_task_.get(); }
108 109
109 void set_solid_color_analysis_performed(bool performed) { 110 void set_solid_color_analysis_performed(bool performed) {
110 is_solid_color_analysis_performed_ = performed; 111 is_solid_color_analysis_performed_ = performed;
111 } 112 }
112 bool is_solid_color_analysis_performed() const { 113 bool is_solid_color_analysis_performed() const {
113 return is_solid_color_analysis_performed_; 114 return is_solid_color_analysis_performed_;
114 } 115 }
115 116
117 void SetImageAnalysisResult(
118 std::vector<DrawImage> images_to_decode_before_raster,
119 std::vector<sk_sp<const SkImage>> images_to_checker);
120 bool is_image_analysis_performed() const {
121 return is_image_analysis_performed_;
122 }
123 const std::vector<DrawImage>& images_to_decode_before_raster() const {
124 return images_to_decode_before_raster_;
125 }
126 const std::vector<sk_sp<const SkImage>>& images_to_checker() const {
127 return images_to_checker_;
128 }
129
130 bool set_raster_task_scheduled_with_checker_images(bool has_checker_images) {
131 bool previous_raster_task_scheduled_with_checker_images =
132 raster_task_scheduled_with_checker_images_;
133 raster_task_scheduled_with_checker_images_ = has_checker_images;
134 return previous_raster_task_scheduled_with_checker_images;
135 }
136 bool raster_task_scheduled_with_checker_images() const {
137 return raster_task_scheduled_with_checker_images_;
138 }
139
116 const PictureLayerTiling* tiling() const { return tiling_; } 140 const PictureLayerTiling* tiling() const { return tiling_; }
117 void set_tiling(const PictureLayerTiling* tiling) { tiling_ = tiling; } 141 void set_tiling(const PictureLayerTiling* tiling) { tiling_ = tiling; }
118 142
119 private: 143 private:
120 friend class TileManager; 144 friend class TileManager;
121 friend class FakeTileManager; 145 friend class FakeTileManager;
122 friend class FakePictureLayerImpl; 146 friend class FakePictureLayerImpl;
123 147
124 // Methods called by by tile manager. 148 // Methods called by by tile manager.
125 Tile(TileManager* tile_manager, 149 Tile(TileManager* tile_manager,
126 const CreateInfo& info, 150 const CreateInfo& info,
127 int layer_id, 151 int layer_id,
128 int source_frame_number, 152 int source_frame_number,
129 int flags); 153 int flags);
130 154
131 TileManager* const tile_manager_; 155 TileManager* const tile_manager_;
132 const PictureLayerTiling* tiling_; 156 const PictureLayerTiling* tiling_;
133 const gfx::Rect content_rect_; 157 const gfx::Rect content_rect_;
134 const gfx::Rect enclosing_layer_rect_; 158 const gfx::Rect enclosing_layer_rect_;
135 const float contents_scale_; 159 const float contents_scale_;
136 160
161 // Image analysis is used partitions the images in a tile into 2 sets:
162 // 1) The images for which the decode must be available *before* the
163 // rasterization of a tile can be started.
164 // 2) The images which are checkered, i.e., will be skipped when rasterizing
165 // this tile.
166 // Note that these sets are only valid for tiles that are considered for
167 // rasterization with images. For instance, for low resolution tiles, all
168 // images are skipped.
169 bool is_image_analysis_performed_ = false;
170 std::vector<DrawImage> images_to_decode_before_raster_;
vmpstr 2017/04/18 00:20:00 Don't put this here, because it might be very memo
171 std::vector<sk_sp<const SkImage>> images_to_checker_;
172
137 TileDrawInfo draw_info_; 173 TileDrawInfo draw_info_;
138 174
139 const int layer_id_; 175 const int layer_id_;
140 const int source_frame_number_; 176 const int source_frame_number_;
141 const int flags_; 177 const int flags_;
142 const int tiling_i_index_; 178 const int tiling_i_index_;
143 const int tiling_j_index_; 179 const int tiling_j_index_;
144 bool required_for_activation_ : 1; 180 bool required_for_activation_ : 1;
145 bool required_for_draw_ : 1; 181 bool required_for_draw_ : 1;
146 bool is_solid_color_analysis_performed_ : 1; 182 bool is_solid_color_analysis_performed_ : 1;
147 183
148 Id id_; 184 Id id_;
149 185
150 // The rect bounding the changes in this Tile vs the previous tile it 186 // The rect bounding the changes in this Tile vs the previous tile it
151 // replaced. 187 // replaced.
152 gfx::Rect invalidated_content_rect_; 188 gfx::Rect invalidated_content_rect_;
153 // The |id_| of the Tile that was invalidated and replaced by this tile. 189 // The |id_| of the Tile that was invalidated and replaced by this tile.
154 Id invalidated_id_; 190 Id invalidated_id_;
155 191
156 unsigned scheduled_priority_; 192 unsigned scheduled_priority_;
193
194 // Set to true if there is a raster task scheduled for this tile that will
195 // rasterize a resource with checker images.
196 bool raster_task_scheduled_with_checker_images_ = false;
157 scoped_refptr<TileTask> raster_task_; 197 scoped_refptr<TileTask> raster_task_;
158 198
159 DISALLOW_COPY_AND_ASSIGN(Tile); 199 DISALLOW_COPY_AND_ASSIGN(Tile);
160 }; 200 };
161 201
162 } // namespace cc 202 } // namespace cc
163 203
164 #endif // CC_TILES_TILE_H_ 204 #endif // CC_TILES_TILE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698