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

Unified Diff: cc/layers/layer.cc

Issue 1130043003: [Sketch] CC Animations: Torpedo the old intrusive animation system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@implscroll
Patch Set: Delete more (headers and animation_registrar_ leftover) Created 5 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/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 95e93ade3eaf5a77c405733c1947a07f694cc51c..4d36a859e54908d29625043ab19440f35463ba7c 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -12,11 +12,6 @@
#include "base/single_thread_task_runner.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
-#include "cc/animation/animation.h"
-#include "cc/animation/animation_events.h"
-#include "cc/animation/animation_registrar.h"
-#include "cc/animation/keyframed_animation_curve.h"
-#include "cc/animation/layer_animation_controller.h"
#include "cc/base/simple_enclosed_region.h"
#include "cc/debug/frame_viewer_instrumentation.h"
#include "cc/layers/layer_client.h"
@@ -93,11 +88,6 @@ Layer::~Layer() {
// reference to us.
DCHECK(!layer_tree_host());
- if (layer_animation_controller_) {
- layer_animation_controller_->RemoveValueObserver(this);
- layer_animation_controller_->remove_value_provider(this);
- }
-
RemoveFromScrollTree();
RemoveFromClipTree();
@@ -138,15 +128,12 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) {
replica_layer_->SetLayerTreeHost(host);
if (host) {
- RegisterForAnimations(host->animation_registrar(), host->settings());
if (host->settings().layer_transforms_should_scale_layer_contents)
reset_raster_scale_to_unknown();
}
bool has_any_animation = false;
- if (layer_animation_controller_)
- has_any_animation = layer_animation_controller_->has_any_animation();
- else if (layer_tree_host_)
+ if (layer_tree_host_)
has_any_animation = layer_tree_host_->HasAnyAnimation(this);
if (host && has_any_animation)
@@ -514,10 +501,7 @@ void Layer::SetFilters(const FilterOperations& filters) {
bool Layer::FilterIsAnimating() const {
DCHECK(layer_tree_host_);
- return layer_animation_controller_
- ? layer_animation_controller_->IsAnimatingProperty(
- Animation::FILTER)
- : layer_tree_host_->IsAnimatingFilterProperty(this);
+ return layer_tree_host_->IsAnimatingFilterProperty(this);
}
void Layer::SetBackgroundFilters(const FilterOperations& filters) {
@@ -538,23 +522,12 @@ void Layer::SetOpacity(float opacity) {
bool Layer::OpacityIsAnimating() const {
DCHECK(layer_tree_host_);
- return layer_animation_controller_
- ? layer_animation_controller_->IsAnimatingProperty(
- Animation::OPACITY)
- : layer_tree_host_->IsAnimatingOpacityProperty(this);
+ return layer_tree_host_->IsAnimatingOpacityProperty(this);
}
bool Layer::HasPotentiallyRunningOpacityAnimation() const {
- if (layer_animation_controller_) {
- if (Animation* animation =
- layer_animation_controller()->GetAnimation(Animation::OPACITY)) {
- return !animation->is_finished();
- }
- return false;
- } else {
- DCHECK(layer_tree_host_);
- return layer_tree_host_->HasPotentiallyRunningOpacityAnimation(this);
- }
+ DCHECK(layer_tree_host_);
+ return layer_tree_host_->HasPotentiallyRunningOpacityAnimation(this);
}
bool Layer::OpacityCanAnimateOnImplThread() const {
@@ -739,38 +712,22 @@ void Layer::SetTransformOrigin(const gfx::Point3F& transform_origin) {
bool Layer::AnimationsPreserveAxisAlignment() const {
DCHECK(layer_tree_host_);
- return layer_animation_controller_
- ? layer_animation_controller_->AnimationsPreserveAxisAlignment()
- : layer_tree_host_->AnimationsPreserveAxisAlignment(this);
+ return layer_tree_host_->AnimationsPreserveAxisAlignment(this);
}
bool Layer::TransformIsAnimating() const {
DCHECK(layer_tree_host_);
- return layer_animation_controller_
- ? layer_animation_controller_->IsAnimatingProperty(
- Animation::TRANSFORM)
- : layer_tree_host_->IsAnimatingTransformProperty(this);
+ return layer_tree_host_->IsAnimatingTransformProperty(this);
}
bool Layer::HasPotentiallyRunningTransformAnimation() const {
- if (layer_animation_controller_) {
- if (Animation* animation =
- layer_animation_controller()->GetAnimation(Animation::TRANSFORM)) {
- return !animation->is_finished();
- }
- return false;
- } else {
- DCHECK(layer_tree_host_);
- return layer_tree_host_->HasPotentiallyRunningTransformAnimation(this);
- }
+ DCHECK(layer_tree_host_);
+ return layer_tree_host_->HasPotentiallyRunningTransformAnimation(this);
}
bool Layer::ScrollOffsetAnimationWasInterrupted() const {
DCHECK(layer_tree_host_);
- return layer_animation_controller_
- ? layer_animation_controller_
- ->scroll_offset_animation_was_interrupted()
- : layer_tree_host_->ScrollOffsetAnimationWasInterrupted(this);
+ return layer_tree_host_->ScrollOffsetAnimationWasInterrupted(this);
}
void Layer::SetScrollParent(Layer* parent) {
@@ -1233,10 +1190,6 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
layer->SetStackingOrderChanged(stacking_order_changed_);
- if (layer->layer_animation_controller() && layer_animation_controller_)
- layer_animation_controller_->PushAnimationUpdatesTo(
- layer->layer_animation_controller());
-
if (frame_timing_requests_dirty_) {
layer->PassFrameTimingRequests(&frame_timing_requests_);
frame_timing_requests_dirty_ = false;
@@ -1390,97 +1343,9 @@ void Layer::OnTransformAnimated(const gfx::Transform& transform) {
}
}
-void Layer::OnScrollOffsetAnimated(const gfx::ScrollOffset& scroll_offset) {
- // Do nothing. Scroll deltas will be sent from the compositor thread back
- // to the main thread in the same manner as during non-animated
- // compositor-driven scrolling.
-}
-
-void Layer::OnAnimationWaitingForDeletion() {
- // Animations are only deleted during PushProperties.
- SetNeedsPushProperties();
-}
-
-bool Layer::IsActive() const {
- return true;
-}
-
-bool Layer::AddAnimation(scoped_ptr <Animation> animation) {
- if (!layer_animation_controller_ ||
- !layer_animation_controller_->animation_registrar())
- return false;
-
- if (animation->target_property() == Animation::SCROLL_OFFSET &&
- !layer_animation_controller_->animation_registrar()
- ->supports_scroll_animations())
- return false;
-
- UMA_HISTOGRAM_BOOLEAN("Renderer.AnimationAddedToOrphanLayer",
- !layer_tree_host_);
- layer_animation_controller_->AddAnimation(animation.Pass());
- SetNeedsCommit();
- return true;
-}
-
-void Layer::PauseAnimation(int animation_id, double time_offset) {
- DCHECK(layer_animation_controller_);
- layer_animation_controller_->PauseAnimation(
- animation_id, base::TimeDelta::FromSecondsD(time_offset));
- SetNeedsCommit();
-}
-
-void Layer::RemoveAnimation(int animation_id) {
- DCHECK(layer_animation_controller_);
- layer_animation_controller_->RemoveAnimation(animation_id);
- SetNeedsCommit();
-}
-
-void Layer::RemoveAnimation(int animation_id,
- Animation::TargetProperty property) {
- DCHECK(layer_animation_controller_);
- layer_animation_controller_->RemoveAnimation(animation_id, property);
- SetNeedsCommit();
-}
-
-void Layer::SetLayerAnimationControllerForTest(
- scoped_refptr<LayerAnimationController> controller) {
- DCHECK(layer_animation_controller_);
- layer_animation_controller_->RemoveValueObserver(this);
- layer_animation_controller_ = controller;
- layer_animation_controller_->AddValueObserver(this);
- SetNeedsCommit();
-}
-
bool Layer::HasActiveAnimation() const {
DCHECK(layer_tree_host_);
- return layer_animation_controller_
- ? layer_animation_controller_->HasActiveAnimation()
- : layer_tree_host_->HasActiveAnimation(this);
-}
-
-void Layer::RegisterForAnimations(AnimationRegistrar* registrar,
- const LayerTreeSettings& settings) {
- if (!settings.use_compositor_animation_timelines &&
- !layer_animation_controller_) {
- layer_animation_controller_ = LayerAnimationController::Create(layer_id_);
- layer_animation_controller_->AddValueObserver(this);
- layer_animation_controller_->set_value_provider(this);
- }
-
- if (layer_animation_controller_)
- layer_animation_controller_->SetAnimationRegistrar(registrar);
-}
-
-void Layer::AddLayerAnimationEventObserver(
- LayerAnimationEventObserver* animation_observer) {
- DCHECK(layer_animation_controller_);
- layer_animation_controller_->AddEventObserver(animation_observer);
-}
-
-void Layer::RemoveLayerAnimationEventObserver(
- LayerAnimationEventObserver* animation_observer) {
- DCHECK(layer_animation_controller_);
- layer_animation_controller_->RemoveEventObserver(animation_observer);
+ return layer_tree_host_->HasActiveAnimation(this);
}
SimpleEnclosedRegion Layer::VisibleContentOpaqueRegion() const {
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698