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

Unified Diff: cc/layers/layer_impl.cc

Issue 1734063003: Share animations from compositor to main thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: worked on review comments Created 4 years, 10 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/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index aa34a8d3a715f9adaddfe1d26ed702515f60423a..9b46aa5511669e44bb0874080fa991d4bbe02079 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -14,6 +14,7 @@
#include "base/strings/stringprintf.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_argument.h"
+#include "cc/animation/animation_host.h"
#include "cc/animation/animation_registrar.h"
#include "cc/animation/mutable_properties.h"
#include "cc/base/math_util.h"
@@ -499,6 +500,26 @@ scoped_ptr<LayerImpl> LayerImpl::CreateLayerImpl(LayerTreeImpl* tree_impl) {
return LayerImpl::Create(tree_impl, layer_id_, scroll_offset_);
}
+void LayerImpl::set_main_thread_scrolling_reasons(
+ uint32_t main_thread_scrolling_reasons) {
+ if (main_thread_scrolling_reasons_ == main_thread_scrolling_reasons)
+ return;
+
+ if (main_thread_scrolling_reasons &
+ MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects &&
+ layer_tree_impl()) {
+ if (layer_tree_impl()->ScrollOffsetIsAnimatingOnImplOnly(this)) {
+ layer_tree_impl()->animation_host()->ScrollAnimationAbort(
+ true /* needs_completion */);
+ } else if (layer_animation_controller()) {
+ layer_animation_controller()->AbortAnimations(
+ TargetProperty::SCROLL_OFFSET);
+ }
+ }
+
+ main_thread_scrolling_reasons_ = main_thread_scrolling_reasons;
+}
+
void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
layer->SetTransformOrigin(transform_origin_);
layer->SetBackgroundColor(background_color_);

Powered by Google App Engine
This is Rietveld 408576698