| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/tree_synchronizer.h" | 5 #include "cc/tree_synchronizer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "cc/layer.h" | 9 #include "cc/layer.h" |
| 10 #include "cc/layer_animation_controller.h" | 10 #include "cc/layer_animation_controller.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 , m_layerImplDestructionList(layerImplDestructionList) | 68 , m_layerImplDestructionList(layerImplDestructionList) |
| 69 { | 69 { |
| 70 } | 70 } |
| 71 virtual ~MockLayer() { } | 71 virtual ~MockLayer() { } |
| 72 | 72 |
| 73 std::vector<int>* m_layerImplDestructionList; | 73 std::vector<int>* m_layerImplDestructionList; |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 class FakeLayerAnimationController : public LayerAnimationController { | 76 class FakeLayerAnimationController : public LayerAnimationController { |
| 77 public: | 77 public: |
| 78 static scoped_refptr<LayerAnimationController> create() | 78 static scoped_ptr<FakeLayerAnimationController> create(LayerAnimationControl
lerClient* client) |
| 79 { | 79 { |
| 80 return static_cast<LayerAnimationController*>(new FakeLayerAnimationCont
roller); | 80 return make_scoped_ptr(new FakeLayerAnimationController(client)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool synchronizedAnimations() const { return m_synchronizedAnimations; } | 83 bool synchronizedAnimations() const { return m_synchronizedAnimations; } |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 FakeLayerAnimationController() | 86 explicit FakeLayerAnimationController(LayerAnimationControllerClient* client
) |
| 87 : LayerAnimationController() | 87 : LayerAnimationController(client) |
| 88 , m_synchronizedAnimations(false) | 88 , m_synchronizedAnimations(false) |
| 89 { } | 89 { |
| 90 | 90 } |
| 91 virtual ~FakeLayerAnimationController() { } | |
| 92 | 91 |
| 93 virtual void pushAnimationUpdatesTo(LayerAnimationController* controllerImpl
) | 92 virtual void pushAnimationUpdatesTo(LayerAnimationController* controllerImpl
) |
| 94 { | 93 { |
| 95 LayerAnimationController::pushAnimationUpdatesTo(controllerImpl); | 94 LayerAnimationController::pushAnimationUpdatesTo(controllerImpl); |
| 96 m_synchronizedAnimations = true; | 95 m_synchronizedAnimations = true; |
| 97 } | 96 } |
| 98 | 97 |
| 99 bool m_synchronizedAnimations; | 98 bool m_synchronizedAnimations; |
| 100 }; | 99 }; |
| 101 | 100 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 385 |
| 387 TEST(TreeSynchronizerTest, synchronizeAnimations) | 386 TEST(TreeSynchronizerTest, synchronizeAnimations) |
| 388 { | 387 { |
| 389 LayerTreeSettings settings; | 388 LayerTreeSettings settings; |
| 390 FakeProxy proxy(scoped_ptr<Thread>(NULL)); | 389 FakeProxy proxy(scoped_ptr<Thread>(NULL)); |
| 391 DebugScopedSetImplThread impl(&proxy); | 390 DebugScopedSetImplThread impl(&proxy); |
| 392 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings,
0, &proxy); | 391 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings,
0, &proxy); |
| 393 | 392 |
| 394 scoped_refptr<Layer> layerTreeRoot = Layer::create(); | 393 scoped_refptr<Layer> layerTreeRoot = Layer::create(); |
| 395 | 394 |
| 396 layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::cre
ate()); | 395 FakeLayerAnimationControllerClient dummy; |
| 396 layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::cre
ate(&dummy).PassAs<LayerAnimationController>()); |
| 397 | 397 |
| 398 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer
AnimationController())->synchronizedAnimations()); | 398 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer
AnimationController())->synchronizedAnimations()); |
| 399 | 399 |
| 400 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees
(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); | 400 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees
(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); |
| 401 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(),
layerImplTreeRoot.Pass(), hostImpl.get()); | 401 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(),
layerImplTreeRoot.Pass(), hostImpl.get()); |
| 402 | 402 |
| 403 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA
nimationController())->synchronizedAnimations()); | 403 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA
nimationController())->synchronizedAnimations()); |
| 404 } | 404 } |
| 405 | 405 |
| 406 } // namespace | 406 } // namespace |
| 407 } // namespace cc | 407 } // namespace cc |
| OLD | NEW |