Chromium Code Reviews| OLD | NEW |
|---|---|
| 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_PICTURE_LAYER_TILING_SET_H_ | 5 #ifndef CC_TILES_PICTURE_LAYER_TILING_SET_H_ |
| 6 #define CC_TILES_PICTURE_LAYER_TILING_SET_H_ | 6 #define CC_TILES_PICTURE_LAYER_TILING_SET_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <set> | 10 #include <set> |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 struct TilingRange { | 35 struct TilingRange { |
| 36 TilingRange(size_t start, size_t end) : start(start), end(end) {} | 36 TilingRange(size_t start, size_t end) : start(start), end(end) {} |
| 37 | 37 |
| 38 size_t start; | 38 size_t start; |
| 39 size_t end; | 39 size_t end; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 static std::unique_ptr<PictureLayerTilingSet> Create( | 42 static std::unique_ptr<PictureLayerTilingSet> Create( |
| 43 WhichTree tree, | 43 WhichTree tree, |
| 44 PictureLayerTilingClient* client, | 44 PictureLayerTilingClient* client, |
| 45 size_t tiling_interest_area_padding, | 45 int tiling_interest_area_padding, |
| 46 float skewport_target_time_in_seconds, | 46 float skewport_target_time_in_seconds, |
| 47 int skewport_extrapolation_limit_in_content); | 47 int skewport_extrapolation_limit_in_screen_pixels); |
| 48 | 48 |
| 49 ~PictureLayerTilingSet(); | 49 ~PictureLayerTilingSet(); |
| 50 | 50 |
| 51 const PictureLayerTilingClient* client() const { return client_; } | 51 const PictureLayerTilingClient* client() const { return client_; } |
| 52 | 52 |
| 53 void CleanUpTilings(float min_acceptable_high_res_scale, | 53 void CleanUpTilings(float min_acceptable_high_res_scale, |
| 54 float max_acceptable_high_res_scale, | 54 float max_acceptable_high_res_scale, |
| 55 const std::vector<PictureLayerTiling*>& needed_tilings, | 55 const std::vector<PictureLayerTiling*>& needed_tilings, |
| 56 PictureLayerTilingSet* twin_set); | 56 PictureLayerTilingSet* twin_set); |
| 57 void RemoveNonIdealTilings(); | 57 void RemoveNonIdealTilings(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 // Removes all tilings with a contents scale > |maximum_scale|. | 108 // Removes all tilings with a contents scale > |maximum_scale|. |
| 109 void RemoveTilingsAboveScale(float maximum_scale); | 109 void RemoveTilingsAboveScale(float maximum_scale); |
| 110 | 110 |
| 111 // Remove all tilings. | 111 // Remove all tilings. |
| 112 void RemoveAllTilings(); | 112 void RemoveAllTilings(); |
| 113 | 113 |
| 114 // Remove all tiles; keep all tilings. | 114 // Remove all tiles; keep all tilings. |
| 115 void RemoveAllTiles(); | 115 void RemoveAllTiles(); |
| 116 | 116 |
| 117 // Update the rects and priorities for tiles based on the given information. | 117 // Update the rects and priorities for tiles based on the given information. |
| 118 // Returns true if PrepareTiles is required. | |
| 118 bool UpdateTilePriorities(const gfx::Rect& required_rect_in_layer_space, | 119 bool UpdateTilePriorities(const gfx::Rect& required_rect_in_layer_space, |
| 119 float ideal_contents_scale, | 120 float ideal_contents_scale, |
| 120 double current_frame_time_in_seconds, | 121 double current_frame_time_in_seconds, |
| 121 const Occlusion& occlusion_in_layer_space, | 122 const Occlusion& occlusion_in_layer_space, |
| 122 bool can_require_tiles_for_activation); | 123 bool can_require_tiles_for_activation); |
| 123 | 124 |
| 124 void GetAllPrioritizedTilesForTracing( | 125 void GetAllPrioritizedTilesForTracing( |
| 125 std::vector<PrioritizedTile>* prioritized_tiles) const; | 126 std::vector<PrioritizedTile>* prioritized_tiles) const; |
| 126 | 127 |
| 127 // For a given rect, iterates through tiles that can fill it. If no | 128 // For a given rect, iterates through tiles that can fill it. If no |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 Region current_region_; | 166 Region current_region_; |
| 166 Region missing_region_; | 167 Region missing_region_; |
| 167 Region::Iterator region_iter_; | 168 Region::Iterator region_iter_; |
| 168 }; | 169 }; |
| 169 | 170 |
| 170 void AsValueInto(base::trace_event::TracedValue* array) const; | 171 void AsValueInto(base::trace_event::TracedValue* array) const; |
| 171 size_t GPUMemoryUsageInBytes() const; | 172 size_t GPUMemoryUsageInBytes() const; |
| 172 | 173 |
| 173 TilingRange GetTilingRange(TilingRangeType type) const; | 174 TilingRange GetTilingRange(TilingRangeType type) const; |
| 174 | 175 |
| 175 private: | 176 protected: |
| 177 struct FrameVisibleRect { | |
| 178 FrameVisibleRect(const gfx::Rect& rect, double time_in_seconds) | |
| 179 : visible_rect_in_layer_space(rect), | |
| 180 frame_time_in_seconds(time_in_seconds) {} | |
| 181 | |
| 182 gfx::Rect visible_rect_in_layer_space; | |
| 183 double frame_time_in_seconds; | |
| 184 }; | |
| 185 | |
| 186 struct StateSinceLastTilePriorityUpdate { | |
| 187 class AutoClear { | |
|
enne (OOO)
2016/05/03 23:03:01
I kinda think a state class with an autoclear subc
vmpstr
2016/05/03 23:31:59
Acknowledged.
| |
| 188 public: | |
| 189 explicit AutoClear(StateSinceLastTilePriorityUpdate* state_to_clear) | |
| 190 : state_to_clear_(state_to_clear) {} | |
| 191 ~AutoClear() { *state_to_clear_ = StateSinceLastTilePriorityUpdate(); } | |
| 192 | |
| 193 private: | |
| 194 StateSinceLastTilePriorityUpdate* state_to_clear_; | |
| 195 }; | |
| 196 | |
| 197 StateSinceLastTilePriorityUpdate() | |
| 198 : invalidated(false), added_tilings(false) {} | |
| 199 | |
| 200 bool invalidated; | |
| 201 bool added_tilings; | |
| 202 }; | |
| 203 | |
| 176 explicit PictureLayerTilingSet( | 204 explicit PictureLayerTilingSet( |
| 177 WhichTree tree, | 205 WhichTree tree, |
| 178 PictureLayerTilingClient* client, | 206 PictureLayerTilingClient* client, |
| 179 size_t tiling_interest_area_padding, | 207 int tiling_interest_area_padding, |
| 180 float skewport_target_time_in_seconds, | 208 float skewport_target_time_in_seconds, |
| 181 int skewport_extrapolation_limit_in_content_pixels); | 209 int skewport_extrapolation_limit_in_screen_pixels); |
| 182 | 210 |
| 183 void CopyTilingsAndPropertiesFromPendingTwin( | 211 void CopyTilingsAndPropertiesFromPendingTwin( |
| 184 const PictureLayerTilingSet* pending_twin_set, | 212 const PictureLayerTilingSet* pending_twin_set, |
| 185 scoped_refptr<RasterSource> raster_source, | 213 scoped_refptr<RasterSource> raster_source, |
| 186 const Region& layer_invalidation); | 214 const Region& layer_invalidation); |
| 187 | 215 |
| 188 // Remove one tiling. | 216 // Remove one tiling. |
| 189 void Remove(PictureLayerTiling* tiling); | 217 void Remove(PictureLayerTiling* tiling); |
| 190 void VerifyTilings(const PictureLayerTilingSet* pending_twin_set) const; | 218 void VerifyTilings(const PictureLayerTilingSet* pending_twin_set) const; |
| 191 | 219 |
| 220 bool TilingsNeedUpdate(const gfx::Rect& required_rect_in_layer_space, | |
| 221 double current_frame_time_in_Seconds); | |
| 222 gfx::Rect ComputeSkewport(const gfx::Rect& visible_rect_in_layer_space, | |
| 223 double current_frame_time_in_seconds, | |
| 224 float ideal_contents_scale); | |
| 225 gfx::Rect ComputeSoonBorderRect(const gfx::Rect& visible_rect_in_layer_space, | |
| 226 float ideal_contents_scale); | |
| 227 void UpdatePriorityRects(const gfx::Rect& visible_rect_in_layer_space, | |
| 228 double current_frame_time_in_seconds, | |
| 229 float ideal_contents_scale); | |
| 230 | |
| 192 std::vector<std::unique_ptr<PictureLayerTiling>> tilings_; | 231 std::vector<std::unique_ptr<PictureLayerTiling>> tilings_; |
| 193 | 232 |
| 194 const size_t tiling_interest_area_padding_; | 233 const int tiling_interest_area_padding_; |
| 195 const float skewport_target_time_in_seconds_; | 234 const float skewport_target_time_in_seconds_; |
| 196 const int skewport_extrapolation_limit_in_content_pixels_; | 235 const int skewport_extrapolation_limit_in_screen_pixels_; |
| 197 WhichTree tree_; | 236 WhichTree tree_; |
| 198 PictureLayerTilingClient* client_; | 237 PictureLayerTilingClient* client_; |
| 238 // State saved for computing velocities based on finite differences. | |
| 239 // .front() of the list refers to the most recent FrameVisibleRect. | |
| 240 std::list<FrameVisibleRect> visible_rect_history_; | |
| 241 StateSinceLastTilePriorityUpdate state_since_last_tile_priority_update_; | |
| 242 | |
| 243 scoped_refptr<RasterSource> raster_source_; | |
| 244 | |
| 245 gfx::Rect visible_rect_in_layer_space_; | |
| 246 gfx::Rect skewport_in_layer_space_; | |
| 247 gfx::Rect soon_border_rect_in_layer_space_; | |
| 248 gfx::Rect eventually_rect_in_layer_space_; | |
| 199 | 249 |
| 200 friend class Iterator; | 250 friend class Iterator; |
| 251 | |
| 252 private: | |
| 201 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); | 253 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); |
| 202 }; | 254 }; |
| 203 | 255 |
| 204 } // namespace cc | 256 } // namespace cc |
| 205 | 257 |
| 206 #endif // CC_TILES_PICTURE_LAYER_TILING_SET_H_ | 258 #endif // CC_TILES_PICTURE_LAYER_TILING_SET_H_ |
| OLD | NEW |