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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 , m_layerImplDestructionList(layerImplDestructionList) | 69 , m_layerImplDestructionList(layerImplDestructionList) |
70 { | 70 { |
71 } | 71 } |
72 virtual ~MockLayer() { } | 72 virtual ~MockLayer() { } |
73 | 73 |
74 std::vector<int>* m_layerImplDestructionList; | 74 std::vector<int>* m_layerImplDestructionList; |
75 }; | 75 }; |
76 | 76 |
77 class FakeLayerAnimationController : public LayerAnimationController { | 77 class FakeLayerAnimationController : public LayerAnimationController { |
78 public: | 78 public: |
79 static scoped_ptr<FakeLayerAnimationController> create(LayerAnimationControl
lerClient* client) | 79 static scoped_refptr<LayerAnimationController> create() |
80 { | 80 { |
81 return make_scoped_ptr(new FakeLayerAnimationController(client)); | 81 return static_cast<LayerAnimationController*>(new FakeLayerAnimationCont
roller); |
82 } | 82 } |
83 | 83 |
84 bool synchronizedAnimations() const { return m_synchronizedAnimations; } | 84 bool synchronizedAnimations() const { return m_synchronizedAnimations; } |
85 | 85 |
86 private: | 86 private: |
87 explicit FakeLayerAnimationController(LayerAnimationControllerClient* client
) | 87 FakeLayerAnimationController() |
88 : LayerAnimationController(client) | 88 : LayerAnimationController(1) |
89 , m_synchronizedAnimations(false) | 89 , m_synchronizedAnimations(false) |
90 { | 90 { } |
91 } | 91 |
| 92 virtual ~FakeLayerAnimationController() { } |
92 | 93 |
93 virtual void pushAnimationUpdatesTo(LayerAnimationController* controllerImpl
) | 94 virtual void pushAnimationUpdatesTo(LayerAnimationController* controllerImpl
) |
94 { | 95 { |
95 LayerAnimationController::pushAnimationUpdatesTo(controllerImpl); | 96 LayerAnimationController::pushAnimationUpdatesTo(controllerImpl); |
96 m_synchronizedAnimations = true; | 97 m_synchronizedAnimations = true; |
97 } | 98 } |
98 | 99 |
99 bool m_synchronizedAnimations; | 100 bool m_synchronizedAnimations; |
100 }; | 101 }; |
101 | 102 |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 364 |
364 TEST_F(TreeSynchronizerTest, synchronizeAnimations) | 365 TEST_F(TreeSynchronizerTest, synchronizeAnimations) |
365 { | 366 { |
366 LayerTreeSettings settings; | 367 LayerTreeSettings settings; |
367 FakeProxy proxy(scoped_ptr<Thread>(NULL)); | 368 FakeProxy proxy(scoped_ptr<Thread>(NULL)); |
368 DebugScopedSetImplThread impl(&proxy); | 369 DebugScopedSetImplThread impl(&proxy); |
369 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings,
0, &proxy); | 370 scoped_ptr<LayerTreeHostImpl> hostImpl = LayerTreeHostImpl::create(settings,
0, &proxy); |
370 | 371 |
371 scoped_refptr<Layer> layerTreeRoot = Layer::create(); | 372 scoped_refptr<Layer> layerTreeRoot = Layer::create(); |
372 | 373 |
373 FakeLayerAnimationControllerClient dummy; | 374 layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::cre
ate()); |
374 layerTreeRoot->setLayerAnimationController(FakeLayerAnimationController::cre
ate(&dummy).PassAs<LayerAnimationController>()); | |
375 | 375 |
376 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer
AnimationController())->synchronizedAnimations()); | 376 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer
AnimationController())->synchronizedAnimations()); |
377 | 377 |
378 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees
(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree()); | 378 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees
(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), m_hostImpl.activeTree()); |
379 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(),
layerImplTreeRoot.Pass(), m_hostImpl.activeTree()); | 379 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(),
layerImplTreeRoot.Pass(), m_hostImpl.activeTree()); |
380 | 380 |
381 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA
nimationController())->synchronizedAnimations()); | 381 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA
nimationController())->synchronizedAnimations()); |
382 } | 382 } |
383 | 383 |
384 } // namespace | 384 } // namespace |
385 } // namespace cc | 385 } // namespace cc |
OLD | NEW |