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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 1895873006: compositor-worker: Initialize CW machinery plumbing to compositor and fire CW rAF callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary scope Created 4 years, 8 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 03004e1e01ce05195352a7d79bc7d883a3f797b7..cc22befad714435b5a7f69bfb4543666ab3a327b 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -462,6 +462,8 @@ void LayerTreeHostImpl::AnimateInternal(bool active_tree) {
did_animate |= AnimateTopControls(monotonic_time);
if (active_tree) {
+ did_animate |= Mutate(monotonic_time);
+
// Animating stuff can change the root scroll offset, so inform the
// synchronous input handler.
UpdateRootLayerStateForSynchronousInputHandler();
@@ -473,6 +475,20 @@ void LayerTreeHostImpl::AnimateInternal(bool active_tree) {
}
}
+bool LayerTreeHostImpl::Mutate(base::TimeTicks monotonic_time) {
+ if (!mutator_)
+ return false;
+ TRACE_EVENT0("compositor-worker", "LayerTreeHostImpl::Mutate");
+ if (mutator_->Mutate(monotonic_time))
+ client_->SetNeedsOneBeginImplFrameOnImplThread();
+ return true;
+}
+
+void LayerTreeHostImpl::SetNeedsMutate() {
+ TRACE_EVENT0("compositor-worker", "LayerTreeHostImpl::SetNeedsMutate");
+ client_->SetNeedsOneBeginImplFrameOnImplThread();
+}
+
bool LayerTreeHostImpl::PrepareTiles() {
if (!tile_priorities_dirty_)
return false;
@@ -2006,6 +2022,7 @@ void LayerTreeHostImpl::ActivateSyncTree() {
// If we commit to the active tree directly, this is already done during
// commit.
ActivateAnimations();
+ Mutate(CurrentBeginFrameArgs().frame_time);
} else {
active_tree_->ProcessUIResourceRequestQueue();
}
@@ -2272,9 +2289,12 @@ void LayerTreeHostImpl::PostFrameTimingEvents(
}
void LayerTreeHostImpl::SetLayerTreeMutator(LayerTreeMutator* mutator) {
+ if (mutator == mutator_)
+ return;
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
"LayerTreeHostImpl::SetLayerTreeMutator");
mutator_ = mutator;
+ mutator_->SetClient(this);
}
void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() {
@@ -3130,6 +3150,9 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
UpdateRootLayerStateForSynchronousInputHandler();
}
+ // Update compositor worker mutations which may respond to scrolling.
+ Mutate(CurrentBeginFrameArgs().frame_time);
+
return scroll_result;
}
@@ -3877,8 +3900,11 @@ void LayerTreeHostImpl::SetTreeLayerScrollOffsetMutated(
return;
LayerImpl* layer = tree->LayerById(layer_id);
- if (layer)
+ if (layer) {
layer->OnScrollOffsetAnimated(scroll_offset);
+ // Run mutation callbacks to respond to updated scroll offset.
+ Mutate(CurrentBeginFrameArgs().frame_time);
+ }
}
void LayerTreeHostImpl::TreeLayerTransformIsPotentiallyAnimatingChanged(

Powered by Google App Engine
This is Rietveld 408576698