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

Side by Side Diff: cc/layer.cc

Issue 12334041: Enable accelerated animations for orphaned layers (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Also test LTH with no registrar Created 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/layer_animation_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layer.h" 5 #include "cc/layer.h"
6 6
7 #include "cc/animation.h" 7 #include "cc/animation.h"
8 #include "cc/animation_events.h" 8 #include "cc/animation_events.h"
9 #include "cc/layer_animation_controller.h" 9 #include "cc/layer_animation_controller.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 m_transform = transform; 753 m_transform = transform;
754 } 754 }
755 755
756 bool Layer::IsActive() const 756 bool Layer::IsActive() const
757 { 757 {
758 return true; 758 return true;
759 } 759 }
760 760
761 bool Layer::addAnimation(scoped_ptr <Animation> animation) 761 bool Layer::addAnimation(scoped_ptr <Animation> animation)
762 { 762 {
763 // WebCore currently assumes that accelerated animations will start soon 763 if (!m_layerAnimationController->animationRegistrar())
764 // after the animation is added. However we cannot guarantee that if we do
765 // not have a layerTreeHost that will setNeedsCommit().
766 // Unfortunately, the fix below to guarantee correctness causes performance
767 // regressions on Android, since Android has shipped for a long time
768 // with all animations accelerated. For this reason, we will live with
769 // this bug only on Android until the bug is fixed.
770 // http://crbug.com/129683
771 #if !defined(OS_ANDROID)
772 if (!m_layerTreeHost)
773 return false; 764 return false;
774 765
775 if (!m_layerTreeHost->settings().acceleratedAnimationEnabled)
776 return false;
777 #endif
778
779 m_layerAnimationController->addAnimation(animation.Pass()); 766 m_layerAnimationController->addAnimation(animation.Pass());
780 setNeedsCommit(); 767 setNeedsCommit();
781 return true; 768 return true;
782 } 769 }
783 770
784 void Layer::pauseAnimation(int animationId, double timeOffset) 771 void Layer::pauseAnimation(int animationId, double timeOffset)
785 { 772 {
786 m_layerAnimationController->pauseAnimation(animationId, timeOffset); 773 m_layerAnimationController->pauseAnimation(animationId, timeOffset);
787 setNeedsCommit(); 774 setNeedsCommit();
788 } 775 }
(...skipping 26 matching lines...) Expand all
815 addLayerAnimationEventObserver(m_layerAnimationController.get()); 802 addLayerAnimationEventObserver(m_layerAnimationController.get());
816 setNeedsCommit(); 803 setNeedsCommit();
817 } 804 }
818 805
819 scoped_refptr<LayerAnimationController> Layer::releaseLayerAnimationController() 806 scoped_refptr<LayerAnimationController> Layer::releaseLayerAnimationController()
820 { 807 {
821 m_layerAnimationController->removeObserver(this); 808 m_layerAnimationController->removeObserver(this);
822 scoped_refptr<LayerAnimationController> toReturn = m_layerAnimationControlle r; 809 scoped_refptr<LayerAnimationController> toReturn = m_layerAnimationControlle r;
823 m_layerAnimationController = LayerAnimationController::create(id()); 810 m_layerAnimationController = LayerAnimationController::create(id());
824 m_layerAnimationController->addObserver(this); 811 m_layerAnimationController->addObserver(this);
812 m_layerAnimationController->setAnimationRegistrar(toReturn->animationRegistr ar());
825 return toReturn; 813 return toReturn;
826 } 814 }
827 815
828 bool Layer::hasActiveAnimation() const 816 bool Layer::hasActiveAnimation() const
829 { 817 {
830 return m_layerAnimationController->hasActiveAnimation(); 818 return m_layerAnimationController->hasActiveAnimation();
831 } 819 }
832 820
833 void Layer::notifyAnimationStarted(const AnimationEvent& event, double wallClock Time) 821 void Layer::notifyAnimationStarted(const AnimationEvent& event, double wallClock Time)
834 { 822 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 { 854 {
867 return 0; 855 return 0;
868 } 856 }
869 857
870 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped _refptr<Layer> >::iterator, void*) 858 void sortLayers(std::vector<scoped_refptr<Layer> >::iterator, std::vector<scoped _refptr<Layer> >::iterator, void*)
871 { 859 {
872 // Currently we don't use z-order to decide what to paint, so there's no nee d to actually sort Layers. 860 // Currently we don't use z-order to decide what to paint, so there's no nee d to actually sort Layers.
873 } 861 }
874 862
875 } // namespace cc 863 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layer_animation_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698