Chromium Code Reviews| Index: cc/trees/layer_tree_host_impl.cc |
| diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc |
| index 43513e79f4d9b370bcd386e9ab86c7493c888fee..91994adabc296e56bbe31eb28b5277562d8a883d 100644 |
| --- a/cc/trees/layer_tree_host_impl.cc |
| +++ b/cc/trees/layer_tree_host_impl.cc |
| @@ -229,7 +229,7 @@ LayerTreeHostImpl::LayerTreeHostImpl( |
| gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
| id_(id), |
| requires_high_res_to_draw_(false), |
| - required_for_draw_tile_is_top_of_raster_queue_(false) { |
| + is_likely_to_require_a_draw_(false) { |
| DCHECK(proxy_->IsImplThread()); |
| DidVisibilityChange(this, visible_); |
| animation_registrar_->set_supports_scroll_animations( |
| @@ -1200,23 +1200,8 @@ scoped_ptr<RasterTilePriorityQueue> LayerTreeHostImpl::BuildRasterQueue( |
| TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildRasterQueue"); |
| picture_layer_pairs_.clear(); |
| GetPictureLayerImplPairs(&picture_layer_pairs_, true); |
| - scoped_ptr<RasterTilePriorityQueue> queue(RasterTilePriorityQueue::Create( |
| - picture_layer_pairs_, tree_priority, type)); |
| - |
| - if (!queue->IsEmpty()) { |
| - // Only checking the Top() tile here isn't a definite answer that there is |
| - // or isn't something required for draw in this raster queue. It's just a |
| - // heuristic to let us hit the common case and proactively tell the |
| - // scheduler that we expect to draw within each vsync until we get all the |
| - // tiles ready to draw. If we happen to miss a required for draw tile here, |
| - // then we will miss telling the scheduler each frame that we intend to draw |
| - // so it may make worse scheduling decisions. |
| - required_for_draw_tile_is_top_of_raster_queue_ = |
| - queue->Top()->required_for_draw(); |
| - } else { |
| - required_for_draw_tile_is_top_of_raster_queue_ = false; |
| - } |
| - return queue; |
| + return RasterTilePriorityQueue::Create(picture_layer_pairs_, tree_priority, |
| + type); |
| } |
| scoped_ptr<EvictionTilePriorityQueue> LayerTreeHostImpl::BuildEvictionQueue( |
| @@ -1229,6 +1214,15 @@ scoped_ptr<EvictionTilePriorityQueue> LayerTreeHostImpl::BuildEvictionQueue( |
| return queue; |
| } |
| +void LayerTreeHostImpl::SetIsLikelyToRequireADraw( |
| + bool is_likely_to_require_a_draw) { |
|
vmpstr
2015/01/26 22:08:35
Since we're updating this only in certain cases, d
|
| + // Proactively tell the scheduler that we expect to draw within each vsync |
| + // until we get all the tiles ready to draw. If we happen to miss a required |
| + // for draw tile here, then we will miss telling the scheduler each frame that |
| + // we intend to draw so it may make worse scheduling decisions. |
| + is_likely_to_require_a_draw_ = is_likely_to_require_a_draw; |
| +} |
| + |
| const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers() |
| const { |
| return picture_layers_; |
| @@ -1242,7 +1236,7 @@ void LayerTreeHostImpl::NotifyReadyToDraw() { |
| // Tiles that are ready will cause NotifyTileStateChanged() to be called so we |
| // don't need to schedule a draw here. Just stop WillBeginImplFrame() from |
| // causing optimistic requests to draw a frame. |
| - required_for_draw_tile_is_top_of_raster_queue_ = false; |
| + is_likely_to_require_a_draw_ = false; |
| client_->NotifyReadyToDraw(); |
| } |
| @@ -1612,7 +1606,7 @@ void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
| // Cache the begin impl frame interval |
| begin_impl_frame_interval_ = args.interval; |
| - if (required_for_draw_tile_is_top_of_raster_queue_) { |
| + if (is_likely_to_require_a_draw_) { |
| // Optimistically schedule a draw, as a tile required for draw is at the top |
| // of the current raster queue. This will let us expect the tile to complete |
| // and draw it within the impl frame we are beginning now. |