| 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 8063831fb1575121e71c8afd68a2533747b9efa4..4e39345775e662c062fd2d27c4abc87b58b8d13e 100644
|
| --- a/cc/trees/layer_tree_host_impl.cc
|
| +++ b/cc/trees/layer_tree_host_impl.cc
|
| @@ -326,7 +326,8 @@ void LayerTreeHostImpl::CommitComplete() {
|
| sync_tree()->UpdateDrawProperties(update_lcd_text);
|
| // Start working on newly created tiles immediately if needed.
|
| if (tile_manager_ && tile_priorities_dirty_) {
|
| - PrepareTiles();
|
| + bool for_commit = true;
|
| + client_->SetNeedsPrepareTilesOnImplThread(for_commit);
|
| } else {
|
| NotifyReadyToActivate();
|
|
|
| @@ -408,6 +409,12 @@ void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) {
|
| }
|
|
|
| void LayerTreeHostImpl::PrepareTiles() {
|
| + bool update_lcd_text = false;
|
| + if (pending_tree_)
|
| + pending_tree_->UpdateDrawProperties(update_lcd_text);
|
| + if (active_tree_)
|
| + active_tree_->UpdateDrawProperties(update_lcd_text);
|
| +
|
| if (!tile_manager_)
|
| return;
|
| if (!tile_priorities_dirty_)
|
| @@ -415,8 +422,6 @@ void LayerTreeHostImpl::PrepareTiles() {
|
|
|
| tile_priorities_dirty_ = false;
|
| tile_manager_->PrepareTiles(global_tile_state_);
|
| -
|
| - client_->DidPrepareTiles();
|
| }
|
|
|
| void LayerTreeHostImpl::StartPageScaleAnimation(
|
| @@ -792,6 +797,7 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses(
|
|
|
| const DrawMode draw_mode = GetDrawMode();
|
|
|
| + int num_layers_missing_raster_source = 0;
|
| int num_missing_tiles = 0;
|
| int num_incomplete_tiles = 0;
|
| bool have_copy_request = false;
|
| @@ -874,10 +880,16 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses(
|
| rendering_stats_instrumentation_->AddCheckerboardedVisibleContentArea(
|
| append_quads_data.checkerboarded_visible_content_area);
|
|
|
| + if (!append_quads_data.raster_source_covers_visible_high_res_tiles)
|
| + num_layers_missing_raster_source++;
|
| +
|
| num_missing_tiles += append_quads_data.num_missing_tiles;
|
| num_incomplete_tiles += append_quads_data.num_incomplete_tiles;
|
|
|
| if (append_quads_data.num_missing_tiles) {
|
| + // TODO(brianderson): Figure out what to do in this case and
|
| + // differentiate and prioritize scroll wheel, touch scroll, and
|
| + // animations.
|
| bool layer_has_animating_transform =
|
| it->screen_space_transform_is_animating() ||
|
| it->draw_transform_is_animating();
|
| @@ -886,24 +898,28 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses(
|
| }
|
| }
|
|
|
| - if (have_missing_animated_tiles)
|
| - draw_result = DRAW_ABORTED_CHECKERBOARD_ANIMATIONS;
|
| -
|
| - // When we require high res to draw, abort the draw (almost) always. This does
|
| - // not cause the scheduler to do a main frame, instead it will continue to try
|
| - // drawing until we finally complete, so the copy request will not be lost.
|
| - // TODO(weiliangc): Remove RequiresHighResToDraw. crbug.com/469175
|
| - if (num_incomplete_tiles || num_missing_tiles) {
|
| - if (RequiresHighResToDraw())
|
| - draw_result = DRAW_ABORTED_MISSING_HIGH_RES_CONTENT;
|
| - }
|
| -
|
| - // When this capability is set we don't have control over the surface the
|
| - // compositor draws to, so even though the frame may not be complete, the
|
| - // previous frame has already been potentially lost, so an incomplete frame is
|
| - // better than nothing, so this takes highest precidence.
|
| - if (output_surface_->capabilities().draw_and_swap_full_viewport_every_frame)
|
| + if (output_surface_->capabilities().draw_and_swap_full_viewport_every_frame) {
|
| + // When this capability is set we don't have control over the surface the
|
| + // compositor draws to, so even though the frame may not be complete, the
|
| + // previous frame has already been potentially lost, so an incomplete frame
|
| + // is
|
| + // better than nothing, so this takes highest precidence.
|
| + // TODO(brianderson): Use a forced draw instead of lying about the draw
|
| + // result.
|
| draw_result = DRAW_SUCCESS;
|
| + } else if (num_layers_missing_raster_source) {
|
| + TRACE_EVENT_INSTANT0("cc", "Raster missing source.",
|
| + TRACE_EVENT_SCOPE_THREAD);
|
| + draw_result = DRAW_ABORTED_MISSING_RASTER_SOURCE;
|
| + } else if (num_missing_tiles) {
|
| + TRACE_EVENT_INSTANT0("cc", "Raster missing output.",
|
| + TRACE_EVENT_SCOPE_THREAD);
|
| + draw_result = DRAW_ABORTED_MISSING_RASTER_OUTPUT_ANY_RES;
|
| + } else if (num_incomplete_tiles) {
|
| + TRACE_EVENT_INSTANT0("cc", "Raster missing high res.",
|
| + TRACE_EVENT_SCOPE_THREAD);
|
| + draw_result = DRAW_ABORTED_MISSING_RASTER_OUTPUT_HIGH_RES;
|
| + }
|
|
|
| #if DCHECK_IS_ON()
|
| for (const auto& render_pass : frame->render_passes) {
|
| @@ -1222,7 +1238,8 @@ void LayerTreeHostImpl::DidModifyTilePriorities() {
|
| DCHECK(settings_.impl_side_painting);
|
| // Mark priorities as dirty and schedule a PrepareTiles().
|
| tile_priorities_dirty_ = true;
|
| - client_->SetNeedsPrepareTilesOnImplThread();
|
| + bool for_commit = false;
|
| + client_->SetNeedsPrepareTilesOnImplThread(for_commit);
|
| }
|
|
|
| scoped_ptr<RasterTilePriorityQueue> LayerTreeHostImpl::BuildRasterQueue(
|
| @@ -1670,7 +1687,7 @@ void LayerTreeHostImpl::UpdateTreeResourcesForGpuRasterizationIfNeeded() {
|
| // We have released tilings for both active and pending tree.
|
| // We would not have any content to draw until the pending tree is activated.
|
| // Prevent the active tree from drawing until activation.
|
| - SetRequiresHighResToDraw();
|
| + SetRequiresHighResToDraw(true);
|
|
|
| tree_resources_for_gpu_rasterization_dirty_ = false;
|
| }
|
| @@ -1682,7 +1699,7 @@ LayerTreeHostImpl::GetRendererCapabilities() const {
|
| }
|
|
|
| bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) {
|
| - ResetRequiresHighResToDraw();
|
| + SetRequiresHighResToDraw(false);
|
| if (frame.has_no_damage) {
|
| active_tree()->BreakSwapPromises(SwapPromise::SWAP_FAILS);
|
| return false;
|
| @@ -1944,15 +1961,10 @@ void LayerTreeHostImpl::SetVisible(bool visible) {
|
| // If we just became visible, we have to ensure that we draw high res tiles,
|
| // to prevent checkerboard/low res flashes.
|
| if (visible_)
|
| - SetRequiresHighResToDraw();
|
| + SetRequiresHighResToDraw(true);
|
| else
|
| EvictAllUIResources();
|
|
|
| - // Evict tiles immediately if invisible since this tab may never get another
|
| - // draw or timer tick.
|
| - if (!visible_)
|
| - PrepareTiles();
|
| -
|
| if (!renderer_)
|
| return;
|
|
|
| @@ -2248,7 +2260,7 @@ bool LayerTreeHostImpl::InitializeRenderer(
|
| // There will not be anything to draw here, so set high res
|
| // to avoid checkerboards, typically when we are recovering
|
| // from lost context.
|
| - SetRequiresHighResToDraw();
|
| + SetRequiresHighResToDraw(true);
|
|
|
| return true;
|
| }
|
|
|