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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 16871016: cc: Use BeginFrameArgs (Closed) Base URL: http://git.chromium.org/chromium/src.git@bfargs2
Patch Set: Add an --enable-deadline-scheduler commandline flag. Created 7 years, 4 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 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 936bd47671c11db707fa32423bf9f0001c33f537..7519413f547b45ea7c424650ce7a604149ad26e1 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -171,6 +171,7 @@ LayerTreeHostImpl::LayerTreeHostImpl(
RenderingStatsInstrumentation* rendering_stats_instrumentation)
: client_(client),
proxy_(proxy),
+ output_surface_lost_(true),
input_handler_client_(NULL),
did_lock_scrolling_layer_(false),
should_bubble_scrolls_(false),
@@ -253,7 +254,11 @@ void LayerTreeHostImpl::CommitComplete() {
pending_tree_->set_needs_update_draw_properties();
pending_tree_->UpdateDrawProperties();
// Start working on newly created tiles immediately if needed.
- ManageTiles();
+ if (!manage_tiles_needed_)
+ client_->NotifyReadyToActivate();
+ else
+ ManageTiles();
+
} else {
active_tree_->set_needs_update_draw_properties();
}
@@ -1084,10 +1089,7 @@ void LayerTreeHostImpl::DidInitializeVisibleTile() {
}
void LayerTreeHostImpl::NotifyReadyToActivate() {
- if (pending_tree_) {
- need_to_update_visible_tiles_before_draw_ = true;
- ActivatePendingTree();
- }
+ client_->NotifyReadyToActivate();
}
bool LayerTreeHostImpl::ShouldClearRootRenderPass() const {
@@ -1338,7 +1340,7 @@ const RendererCapabilities& LayerTreeHostImpl::GetRendererCapabilities() const {
}
bool LayerTreeHostImpl::SwapBuffers(const LayerTreeHostImpl::FrameData& frame) {
- if (frame.has_no_damage)
+ if (frame.has_no_damage || output_surface_lost_)
return false;
renderer_->SwapBuffers();
active_tree_->ClearLatencyInfo();
@@ -1381,6 +1383,7 @@ void LayerTreeHostImpl::DidLoseOutputSurface() {
// TODO(jamesr): The renderer_ check is needed to make some of the
// LayerTreeHostContextTest tests pass, but shouldn't be necessary (or
// important) in production. We should adjust the test to not need this.
+ output_surface_lost_ = true;
if (renderer_)
client_->DidLoseOutputSurfaceOnImplThread();
}
@@ -1475,6 +1478,8 @@ void LayerTreeHostImpl::ActivatePendingTree() {
CHECK(pending_tree_);
TRACE_EVENT_ASYNC_END0("cc", "PendingTree", pending_tree_.get());
+ need_to_update_visible_tiles_before_draw_ = true;
+
active_tree_->SetRootLayerScrollOffsetDelegate(NULL);
active_tree_->PushPersistedState(pending_tree_.get());
if (pending_tree_->needs_full_tree_sync()) {
@@ -1503,6 +1508,10 @@ void LayerTreeHostImpl::ActivatePendingTree() {
root_layer_scroll_offset_delegate_);
active_tree_->DidBecomeActive();
+ client_->DidActivatePendingTree();
+ if (!tree_activation_callback_.is_null())
+ tree_activation_callback_.Run();
+
// Reduce wasted memory now that unlinked resources are guaranteed not
// to be used.
client_->ReduceWastedContentsTextureMemoryOnImplThread();
@@ -1519,10 +1528,6 @@ void LayerTreeHostImpl::ActivatePendingTree() {
stats.main_stats.paint_time + stats.main_stats.record_time +
stats.impl_stats.rasterize_time_for_now_bins_on_pending_tree);
}
-
- client_->DidActivatePendingTree();
- if (!tree_activation_callback_.is_null())
- tree_activation_callback_.Run();
}
void LayerTreeHostImpl::SetVisible(bool visible) {
@@ -1630,6 +1635,7 @@ bool LayerTreeHostImpl::InitializeRenderer(
tile_manager_.reset();
resource_provider_.reset();
output_surface_.reset();
+ output_surface_lost_ = true;
if (!output_surface->BindToClient(this))
return false;
@@ -1675,6 +1681,7 @@ bool LayerTreeHostImpl::InitializeRenderer(
resource_provider_ = resource_provider.Pass();
output_surface_ = output_surface.Pass();
+ output_surface_lost_ = false;
client_->OnCanDrawStateChanged(CanDraw());
@@ -2245,6 +2252,7 @@ void LayerTreeHostImpl::AnimatePageScale(base::TimeTicks time) {
active_tree_->SetPageScaleDelta(
page_scale_animation_->PageScaleFactorAtTime(monotonic_time) /
active_tree_->page_scale_factor());
+
gfx::Vector2dF next_scroll =
page_scale_animation_->ScrollOffsetAtTime(monotonic_time);

Powered by Google App Engine
This is Rietveld 408576698