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

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: Make NotifyAnimationTakeover pure virtual 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..f4b211a7d8e41967005323e7b4df0787b8ee2016 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(
ajuma 2016/02/26 23:56:54 Shouldn't this be only if the animations are impl-
ymalik 2016/02/29 16:31:09 Yes, you're right. I am removing it though, since
+ TargetProperty::SCROLL_OFFSET, true /* needs_completion */);
+ }
+ }
+
+ 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