| 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 "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "cc/animation/animation_host.h" | 9 #include "cc/animation/animation_host.h" |
| 10 #include "cc/layers/layer.h" | 10 #include "cc/layers/layer.h" |
| 11 #include "cc/test/fake_image_serialization_processor.h" | |
| 12 #include "cc/test/test_task_graph_runner.h" | 11 #include "cc/test/test_task_graph_runner.h" |
| 13 #include "cc/trees/layer_tree.h" | 12 #include "cc/trees/layer_tree.h" |
| 14 #include "cc/trees/mutator_host.h" | 13 #include "cc/trees/mutator_host.h" |
| 15 | 14 |
| 16 namespace cc { | 15 namespace cc { |
| 17 | 16 |
| 18 namespace { | 17 namespace { |
| 19 | 18 |
| 20 class FakeLayerTree : public LayerTree { | 19 class FakeLayerTree : public LayerTree { |
| 21 public: | 20 public: |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 const LayerTreeSettings& settings, | 71 const LayerTreeSettings& settings, |
| 73 CompositorMode mode) { | 72 CompositorMode mode) { |
| 74 LayerTreeHostInProcess::InitParams params; | 73 LayerTreeHostInProcess::InitParams params; |
| 75 params.client = client; | 74 params.client = client; |
| 76 params.settings = &settings; | 75 params.settings = &settings; |
| 77 params.task_graph_runner = task_graph_runner; | 76 params.task_graph_runner = task_graph_runner; |
| 78 params.mutator_host = mutator_host; | 77 params.mutator_host = mutator_host; |
| 79 return base::WrapUnique(new FakeLayerTreeHost(client, ¶ms, mode)); | 78 return base::WrapUnique(new FakeLayerTreeHost(client, ¶ms, mode)); |
| 80 } | 79 } |
| 81 | 80 |
| 82 std::unique_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( | |
| 83 FakeLayerTreeHostClient* client, | |
| 84 TestTaskGraphRunner* task_graph_runner, | |
| 85 MutatorHost* mutator_host, | |
| 86 const LayerTreeSettings& settings, | |
| 87 CompositorMode mode, | |
| 88 ImageSerializationProcessor* image_serialization_processor) { | |
| 89 LayerTreeHostInProcess::InitParams params; | |
| 90 params.client = client; | |
| 91 params.settings = &settings; | |
| 92 params.task_graph_runner = task_graph_runner; | |
| 93 params.image_serialization_processor = image_serialization_processor; | |
| 94 params.mutator_host = mutator_host; | |
| 95 return base::WrapUnique(new FakeLayerTreeHost(client, ¶ms, mode)); | |
| 96 } | |
| 97 | |
| 98 FakeLayerTreeHost::~FakeLayerTreeHost() { | 81 FakeLayerTreeHost::~FakeLayerTreeHost() { |
| 99 client_->SetLayerTreeHost(NULL); | 82 client_->SetLayerTreeHost(NULL); |
| 100 } | 83 } |
| 101 | 84 |
| 102 void FakeLayerTreeHost::SetNeedsCommit() { needs_commit_ = true; } | 85 void FakeLayerTreeHost::SetNeedsCommit() { needs_commit_ = true; } |
| 103 | 86 |
| 104 LayerImpl* FakeLayerTreeHost::CommitAndCreateLayerImplTree() { | 87 LayerImpl* FakeLayerTreeHost::CommitAndCreateLayerImplTree() { |
| 105 TreeSynchronizer::SynchronizeTrees(root_layer(), active_tree()); | 88 TreeSynchronizer::SynchronizeTrees(root_layer(), active_tree()); |
| 106 active_tree()->SetPropertyTrees(property_trees()); | 89 active_tree()->SetPropertyTrees(property_trees()); |
| 107 TreeSynchronizer::PushLayerProperties(root_layer()->GetLayerTree(), | 90 TreeSynchronizer::PushLayerProperties(root_layer()->GetLayerTree(), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 134 TreeSynchronizer::PushLayerProperties(root_layer()->GetLayerTree(), | 117 TreeSynchronizer::PushLayerProperties(root_layer()->GetLayerTree(), |
| 135 pending_tree()); | 118 pending_tree()); |
| 136 layer_tree_->mutator_host()->PushPropertiesTo(host_impl_.mutator_host()); | 119 layer_tree_->mutator_host()->PushPropertiesTo(host_impl_.mutator_host()); |
| 137 | 120 |
| 138 pending_tree()->property_trees()->scroll_tree.PushScrollUpdatesFromMainThread( | 121 pending_tree()->property_trees()->scroll_tree.PushScrollUpdatesFromMainThread( |
| 139 property_trees(), pending_tree()); | 122 property_trees(), pending_tree()); |
| 140 return pending_tree()->root_layer_for_testing(); | 123 return pending_tree()->root_layer_for_testing(); |
| 141 } | 124 } |
| 142 | 125 |
| 143 } // namespace cc | 126 } // namespace cc |
| OLD | NEW |