| 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" |
| 11 #include "cc/layer_impl.h" | 11 #include "cc/layer_impl.h" |
| 12 #include "cc/proxy.h" | 12 #include "cc/proxy.h" |
| 13 #include "cc/single_thread_proxy.h" | 13 #include "cc/single_thread_proxy.h" |
| 14 #include "cc/test/animation_test_common.h" | 14 #include "cc/test/animation_test_common.h" |
| 15 #include "cc/test/fake_proxy.h" | 15 #include "cc/test/fake_proxy.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 using namespace WebKitTests; | 18 using namespace WebKitTests; |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 class MockLayerImpl : public LayerImpl { | 23 class MockLayerImpl : public LayerImpl { |
| 24 public: | 24 public: |
| 25 static scoped_ptr<MockLayerImpl> create(int layerId) | 25 static scoped_ptr<MockLayerImpl> create(LayerTreeHostImpl* hostImpl, int lay
erId) |
| 26 { | 26 { |
| 27 return make_scoped_ptr(new MockLayerImpl(layerId)); | 27 return make_scoped_ptr(new MockLayerImpl(hostImpl, layerId)); |
| 28 } | 28 } |
| 29 virtual ~MockLayerImpl() | 29 virtual ~MockLayerImpl() |
| 30 { | 30 { |
| 31 if (m_layerImplDestructionList) | 31 if (m_layerImplDestructionList) |
| 32 m_layerImplDestructionList->push_back(id()); | 32 m_layerImplDestructionList->push_back(id()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 void setLayerImplDestructionList(std::vector<int>* list) { m_layerImplDestru
ctionList = list; } | 35 void setLayerImplDestructionList(std::vector<int>* list) { m_layerImplDestru
ctionList = list; } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 MockLayerImpl(int layerId) | 38 MockLayerImpl(LayerTreeHostImpl* hostImpl, int layerId) |
| 39 : LayerImpl(layerId) | 39 : LayerImpl(hostImpl, layerId) |
| 40 , m_layerImplDestructionList(0) | 40 , m_layerImplDestructionList(0) |
| 41 { | 41 { |
| 42 } | 42 } |
| 43 | 43 |
| 44 std::vector<int>* m_layerImplDestructionList; | 44 std::vector<int>* m_layerImplDestructionList; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class MockLayer : public Layer { | 47 class MockLayer : public Layer { |
| 48 public: | 48 public: |
| 49 static scoped_refptr<MockLayer> create(std::vector<int>* layerImplDestructio
nList) | 49 static scoped_refptr<MockLayer> create(std::vector<int>* layerImplDestructio
nList) |
| 50 { | 50 { |
| 51 return make_scoped_refptr(new MockLayer(layerImplDestructionList)); | 51 return make_scoped_refptr(new MockLayer(layerImplDestructionList)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual scoped_ptr<LayerImpl> createLayerImpl() OVERRIDE | 54 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeHostImpl* hostImpl) O
VERRIDE |
| 55 { | 55 { |
| 56 return MockLayerImpl::create(m_layerId).PassAs<LayerImpl>(); | 56 return MockLayerImpl::create(hostImpl, m_layerId).PassAs<LayerImpl>(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual void pushPropertiesTo(LayerImpl* layerImpl) OVERRIDE | 59 virtual void pushPropertiesTo(LayerImpl* layerImpl) OVERRIDE |
| 60 { | 60 { |
| 61 Layer::pushPropertiesTo(layerImpl); | 61 Layer::pushPropertiesTo(layerImpl); |
| 62 | 62 |
| 63 MockLayerImpl* mockLayerImpl = static_cast<MockLayerImpl*>(layerImpl); | 63 MockLayerImpl* mockLayerImpl = static_cast<MockLayerImpl*>(layerImpl); |
| 64 mockLayerImpl->setLayerImplDestructionList(m_layerImplDestructionList); | 64 mockLayerImpl->setLayerImplDestructionList(m_layerImplDestructionList); |
| 65 } | 65 } |
| 66 | 66 |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer
AnimationController())->synchronizedAnimations()); | 400 EXPECT_FALSE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layer
AnimationController())->synchronizedAnimations()); |
| 401 | 401 |
| 402 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees
(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); | 402 scoped_ptr<LayerImpl> layerImplTreeRoot = TreeSynchronizer::synchronizeTrees
(layerTreeRoot.get(), scoped_ptr<LayerImpl>(), hostImpl.get()); |
| 403 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(),
layerImplTreeRoot.Pass(), hostImpl.get()); | 403 layerImplTreeRoot = TreeSynchronizer::synchronizeTrees(layerTreeRoot.get(),
layerImplTreeRoot.Pass(), hostImpl.get()); |
| 404 | 404 |
| 405 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA
nimationController())->synchronizedAnimations()); | 405 EXPECT_TRUE(static_cast<FakeLayerAnimationController*>(layerTreeRoot->layerA
nimationController())->synchronizedAnimations()); |
| 406 } | 406 } |
| 407 | 407 |
| 408 } // namespace | 408 } // namespace |
| 409 } // namespace cc | 409 } // namespace cc |
| OLD | NEW |