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

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: Include WebCompositorMutatorClient from WebLayerTreeView to allow unique_ptr usage. Created 4 years, 7 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5c81223191013df75bb431a674d0a0c5ab8b6b15..0b1101174e19a4e003d35e425383c902a1f21bd5 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -468,6 +468,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();
@@ -479,6 +481,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;
@@ -2014,6 +2030,10 @@ void LayerTreeHostImpl::ActivateSyncTree() {
// If we commit to the active tree directly, this is already done during
// commit.
ActivateAnimations();
+
+ // Compositor worker operates on the active tree so we have to run again
+ // after activation.
+ Mutate(CurrentBeginFrameArgs().frame_time);
} else {
active_tree_->ProcessUIResourceRequestQueue();
}
@@ -2269,10 +2289,14 @@ void LayerTreeHostImpl::CreateResourceAndRasterBufferProvider(
settings_.renderer_settings.preferred_tile_format);
}
-void LayerTreeHostImpl::SetLayerTreeMutator(LayerTreeMutator* mutator) {
+void LayerTreeHostImpl::SetLayerTreeMutator(
+ std::unique_ptr<LayerTreeMutator> mutator) {
+ if (mutator == mutator_)
+ return;
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
"LayerTreeHostImpl::SetLayerTreeMutator");
- mutator_ = mutator;
+ mutator_ = std::move(mutator);
+ mutator_->SetClient(this);
}
void LayerTreeHostImpl::CleanUpTileManagerAndUIResources() {
@@ -3134,6 +3158,9 @@ InputHandlerScrollResult LayerTreeHostImpl::ScrollBy(
UpdateRootLayerStateForSynchronousInputHandler();
}
+ // Update compositor worker mutations which may respond to scrolling.
+ Mutate(CurrentBeginFrameArgs().frame_time);
+
return scroll_result;
}
@@ -3881,8 +3908,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);
+ }
}
bool LayerTreeHostImpl::AnimationsPreserveAxisAlignment(
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698