| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/test/fake_layer_tree_host.h" | 5 #include "cc/test/fake_layer_tree_host.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "cc/animation/animation_host.h" | 8 #include "cc/animation/animation_host.h" |
| 9 #include "cc/layers/layer.h" | 9 #include "cc/layers/layer.h" |
| 10 #include "cc/test/fake_image_serialization_processor.h" | 10 #include "cc/test/fake_image_serialization_processor.h" |
| 11 #include "cc/test/test_task_graph_runner.h" | 11 #include "cc/test/test_task_graph_runner.h" |
| 12 #include "cc/trees/layer_tree.h" | 12 #include "cc/trees/layer_tree.h" |
| 13 | 13 |
| 14 namespace cc { | 14 namespace cc { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 class FakeLayerTree : public LayerTree { | 18 class FakeLayerTree : public LayerTree { |
| 19 public: | 19 public: |
| 20 FakeLayerTree(std::unique_ptr<AnimationHost> animation_host, | 20 FakeLayerTree(std::unique_ptr<AnimationHost> animation_host, |
| 21 LayerTreeHost* layer_tree_host) | 21 LayerTreeHost* layer_tree_host) |
| 22 : LayerTree(std::move(animation_host), layer_tree_host) {} | 22 : LayerTree(std::move(animation_host), layer_tree_host) {} |
| 23 | 23 |
| 24 void SetNeedsFullTreeSync() override {} | 24 void SetNeedsFullTreeSync() override {} |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 FakeLayerTreeHost::FakeLayerTreeHost(FakeLayerTreeHostClient* client, | 29 FakeLayerTreeHost::FakeLayerTreeHost(FakeLayerTreeHostClient* client, |
| 30 LayerTreeHost::InitParams* params, | 30 LayerTreeHostInProcess::InitParams* params, |
| 31 CompositorMode mode) | 31 CompositorMode mode) |
| 32 : LayerTreeHost( | 32 : LayerTreeHostInProcess( |
| 33 params, | 33 params, |
| 34 mode, | 34 mode, |
| 35 base::MakeUnique<FakeLayerTree>(std::move(params->animation_host), | 35 base::MakeUnique<FakeLayerTree>(std::move(params->animation_host), |
| 36 this)), | 36 this)), |
| 37 client_(client), | 37 client_(client), |
| 38 host_impl_(*params->settings, | 38 host_impl_(*params->settings, |
| 39 &task_runner_provider_, | 39 &task_runner_provider_, |
| 40 &manager_, | 40 &manager_, |
| 41 params->task_graph_runner), | 41 params->task_graph_runner), |
| 42 needs_commit_(false) { | 42 needs_commit_(false) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 63 const LayerTreeSettings& settings) { | 63 const LayerTreeSettings& settings) { |
| 64 return Create(client, task_graph_runner, settings, | 64 return Create(client, task_graph_runner, settings, |
| 65 CompositorMode::SINGLE_THREADED); | 65 CompositorMode::SINGLE_THREADED); |
| 66 } | 66 } |
| 67 | 67 |
| 68 std::unique_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( | 68 std::unique_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( |
| 69 FakeLayerTreeHostClient* client, | 69 FakeLayerTreeHostClient* client, |
| 70 TestTaskGraphRunner* task_graph_runner, | 70 TestTaskGraphRunner* task_graph_runner, |
| 71 const LayerTreeSettings& settings, | 71 const LayerTreeSettings& settings, |
| 72 CompositorMode mode) { | 72 CompositorMode mode) { |
| 73 LayerTreeHost::InitParams params; | 73 LayerTreeHostInProcess::InitParams params; |
| 74 params.client = client; | 74 params.client = client; |
| 75 params.settings = &settings; | 75 params.settings = &settings; |
| 76 params.task_graph_runner = task_graph_runner; | 76 params.task_graph_runner = task_graph_runner; |
| 77 params.animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 77 params.animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
| 78 return base::WrapUnique(new FakeLayerTreeHost(client, ¶ms, mode)); | 78 return base::WrapUnique(new FakeLayerTreeHost(client, ¶ms, mode)); |
| 79 } | 79 } |
| 80 | 80 |
| 81 std::unique_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( | 81 std::unique_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( |
| 82 FakeLayerTreeHostClient* client, | 82 FakeLayerTreeHostClient* client, |
| 83 TestTaskGraphRunner* task_graph_runner, | 83 TestTaskGraphRunner* task_graph_runner, |
| 84 const LayerTreeSettings& settings, | 84 const LayerTreeSettings& settings, |
| 85 CompositorMode mode, | 85 CompositorMode mode, |
| 86 ImageSerializationProcessor* image_serialization_processor) { | 86 ImageSerializationProcessor* image_serialization_processor) { |
| 87 LayerTreeHost::InitParams params; | 87 LayerTreeHostInProcess::InitParams params; |
| 88 params.client = client; | 88 params.client = client; |
| 89 params.settings = &settings; | 89 params.settings = &settings; |
| 90 params.task_graph_runner = task_graph_runner; | 90 params.task_graph_runner = task_graph_runner; |
| 91 params.image_serialization_processor = image_serialization_processor; | 91 params.image_serialization_processor = image_serialization_processor; |
| 92 params.animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 92 params.animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
| 93 return base::WrapUnique(new FakeLayerTreeHost(client, ¶ms, mode)); | 93 return base::WrapUnique(new FakeLayerTreeHost(client, ¶ms, mode)); |
| 94 } | 94 } |
| 95 | 95 |
| 96 FakeLayerTreeHost::~FakeLayerTreeHost() { | 96 FakeLayerTreeHost::~FakeLayerTreeHost() { |
| 97 client_->SetLayerTreeHost(NULL); | 97 client_->SetLayerTreeHost(NULL); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 pending_tree()->SetPropertyTrees(property_trees()); | 130 pending_tree()->SetPropertyTrees(property_trees()); |
| 131 TreeSynchronizer::PushLayerProperties(root_layer()->GetLayerTree(), | 131 TreeSynchronizer::PushLayerProperties(root_layer()->GetLayerTree(), |
| 132 pending_tree()); | 132 pending_tree()); |
| 133 layer_tree_->animation_host()->PushPropertiesTo(host_impl_.animation_host()); | 133 layer_tree_->animation_host()->PushPropertiesTo(host_impl_.animation_host()); |
| 134 | 134 |
| 135 pending_tree()->UpdatePropertyTreeScrollOffset(property_trees()); | 135 pending_tree()->UpdatePropertyTreeScrollOffset(property_trees()); |
| 136 return pending_tree()->root_layer_for_testing(); | 136 return pending_tree()->root_layer_for_testing(); |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace cc | 139 } // namespace cc |
| OLD | NEW |