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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 671653005: SetNeedsRedraw directly when updating a visible tile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pinchblurmerge-test: tweak Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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 41ee28a50f86fb0b6b935b1d5a69775c537c0858..93bf9ca781c3ad9acf33b8fb5ac849bf07ba490e 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -244,8 +244,8 @@ class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient {
DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImplTimeSourceAdapter);
};
-LayerTreeHostImpl::FrameData::FrameData()
- : contains_incomplete_tile(false), has_no_damage(false) {}
+LayerTreeHostImpl::FrameData::FrameData() : has_no_damage(false) {
+}
LayerTreeHostImpl::FrameData::~FrameData() {}
@@ -310,11 +310,11 @@ LayerTreeHostImpl::LayerTreeHostImpl(
animation_registrar_(AnimationRegistrar::Create()),
rendering_stats_instrumentation_(rendering_stats_instrumentation),
micro_benchmark_controller_(this),
- need_to_update_visible_tiles_before_draw_(false),
shared_bitmap_manager_(shared_bitmap_manager),
gpu_memory_buffer_manager_(gpu_memory_buffer_manager),
id_(id),
- requires_high_res_to_draw_(false) {
+ requires_high_res_to_draw_(false),
+ required_for_draw_tile_is_top_of_raster_queue_(false) {
DCHECK(proxy_->IsImplThread());
DidVisibilityChange(this, visible_);
animation_registrar_->set_supports_scroll_animations(
@@ -552,7 +552,6 @@ void LayerTreeHostImpl::TrackDamageForAllSurfaces(
void LayerTreeHostImpl::FrameData::AsValueInto(
base::debug::TracedValue* value) const {
- value->SetBoolean("contains_incomplete_tile", contains_incomplete_tile);
value->SetBoolean("has_no_damage", has_no_damage);
// Quad data can be quite large, so only dump render passes if we select
@@ -902,7 +901,6 @@ DrawResult LayerTreeHostImpl::CalculateRenderPasses(
if (append_quads_data.num_incomplete_tiles ||
append_quads_data.num_missing_tiles) {
- frame->contains_incomplete_tile = true;
if (RequiresHighResToDraw())
draw_result = DRAW_ABORTED_MISSING_HIGH_RES_CONTENT;
}
@@ -1119,12 +1117,11 @@ DrawResult LayerTreeHostImpl::PrepareToDraw(FrameData* frame) {
"LayerTreeHostImpl::PrepareToDraw",
"SourceFrameNumber",
active_tree_->source_frame_number());
-
- if (need_to_update_visible_tiles_before_draw_ &&
- tile_manager_ && tile_manager_->UpdateVisibleTiles()) {
- DidInitializeVisibleTile();
- }
- need_to_update_visible_tiles_before_draw_ = true;
+ // This will cause NotifyTileStateChanged() to be called for any visible tiles
+ // that completed, which will add damage to the frame for them so they appear
+ // as part of the current frame being drawn.
+ if (settings().impl_side_painting)
+ tile_manager_->UpdateVisibleTiles();
UMA_HISTOGRAM_CUSTOM_COUNTS(
"Compositing.NumActiveLayers", active_tree_->NumLayers(), 1, 400, 20);
@@ -1136,7 +1133,6 @@ DrawResult LayerTreeHostImpl::PrepareToDraw(FrameData* frame) {
frame->render_passes.clear();
frame->render_passes_by_id.clear();
frame->will_draw_layers.clear();
- frame->contains_incomplete_tile = false;
frame->has_no_damage = false;
if (active_tree_->root_layer()) {
@@ -1167,13 +1163,6 @@ void LayerTreeHostImpl::BlockNotifyReadyToActivateForTesting(bool block) {
NOTREACHED();
}
-void LayerTreeHostImpl::DidInitializeVisibleTileForTesting() {
- // Add arbitrary damage, to trigger prepare-to-draws.
- // Here, setting damage as viewport size, used only for testing.
- SetFullRootLayerDamage();
- DidInitializeVisibleTile();
-}
-
void LayerTreeHostImpl::ResetTreesForTesting() {
if (active_tree_)
active_tree_->DetachLayerTree();
@@ -1265,11 +1254,6 @@ void LayerTreeHostImpl::DidModifyTilePriorities() {
client_->SetNeedsManageTilesOnImplThread();
}
-void LayerTreeHostImpl::DidInitializeVisibleTile() {
- if (client_ && !client_->IsInsideDraw())
- client_->DidInitializeVisibleTileOnImplThread();
-}
-
void LayerTreeHostImpl::GetPictureLayerImplPairs(
std::vector<PictureLayerImpl::Pair>* layer_pairs) const {
DCHECK(layer_pairs->empty());
@@ -1308,6 +1292,13 @@ void LayerTreeHostImpl::BuildRasterQueue(RasterTilePriorityQueue* queue,
picture_layer_pairs_.clear();
GetPictureLayerImplPairs(&picture_layer_pairs_);
queue->Build(picture_layer_pairs_, tree_priority);
+
+ if (!queue->IsEmpty()) {
+ 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;
+ }
}
void LayerTreeHostImpl::BuildEvictionQueue(EvictionTilePriorityQueue* queue,
@@ -1328,6 +1319,11 @@ void LayerTreeHostImpl::NotifyReadyToActivate() {
}
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;
+
client_->NotifyReadyToDraw();
}
@@ -1347,6 +1343,13 @@ void LayerTreeHostImpl::NotifyTileStateChanged(const Tile* tile) {
if (layer_impl)
layer_impl->NotifyTileStateChanged(tile);
}
+
+ // Check for a non-null active tree to avoid doing this during shutdown.
+ if (active_tree_ && !client_->IsInsideDraw() && tile->required_for_draw()) {
vmpstr 2014/11/10 22:47:04 Is there any way to push this check into picture l
+ // The LayerImpl::NotifyTileStateChanged() should damage the layer, so this
+ // redraw will make those tiles be displayed.
+ SetNeedsRedraw();
+ }
}
void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) {
@@ -1695,6 +1698,13 @@ void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) {
UpdateCurrentBeginFrameArgs(args);
// Cache the begin impl frame interval
begin_impl_frame_interval_ = args.interval;
+
+ if (required_for_draw_tile_is_top_of_raster_queue_) {
+ // 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.
+ SetNeedsRedraw();
+ }
}
void LayerTreeHostImpl::UpdateViewportContainerSizes() {
@@ -1822,15 +1832,7 @@ void LayerTreeHostImpl::CreatePendingTree() {
TRACE_EVENT_ASYNC_BEGIN0("cc", "PendingTree:waiting", pending_tree_.get());
}
-void LayerTreeHostImpl::UpdateVisibleTiles() {
- if (tile_manager_ && tile_manager_->UpdateVisibleTiles())
- DidInitializeVisibleTile();
- need_to_update_visible_tiles_before_draw_ = false;
-}
-
void LayerTreeHostImpl::ActivateSyncTree() {
- need_to_update_visible_tiles_before_draw_ = true;
-
if (pending_tree_) {
TRACE_EVENT_ASYNC_END0("cc", "PendingTree:waiting", pending_tree_.get());
@@ -2036,7 +2038,6 @@ void LayerTreeHostImpl::CreateAndSetTileManager() {
scheduled_raster_task_limit);
UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy());
- need_to_update_visible_tiles_before_draw_ = false;
}
void LayerTreeHostImpl::CreateResourceAndRasterWorkerPool(
@@ -3038,9 +3039,6 @@ void LayerTreeHostImpl::PinchGestureEnd() {
// scales that we want when we're not inside a pinch.
active_tree_->set_needs_update_draw_properties();
SetNeedsRedraw();
- // TODO(danakj): Don't set root damage. Just updating draw properties and
- // getting new tiles rastered should be enough! crbug.com/427423
- SetFullRootLayerDamage();
}
static void CollectScrollDeltas(ScrollAndScaleSet* scroll_info,

Powered by Google App Engine
This is Rietveld 408576698