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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 : LayerTreeHost( | 32 : LayerTreeHost( |
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) { |
43 renderer_capabilities_set(false) { | |
44 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner = | 43 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner = |
45 mode == CompositorMode::THREADED ? base::ThreadTaskRunnerHandle::Get() | 44 mode == CompositorMode::THREADED ? base::ThreadTaskRunnerHandle::Get() |
46 : nullptr; | 45 : nullptr; |
47 SetTaskRunnerProviderForTesting(TaskRunnerProvider::Create( | 46 SetTaskRunnerProviderForTesting(TaskRunnerProvider::Create( |
48 base::ThreadTaskRunnerHandle::Get(), impl_task_runner)); | 47 base::ThreadTaskRunnerHandle::Get(), impl_task_runner)); |
49 client_->SetLayerTreeHost(this); | 48 client_->SetLayerTreeHost(this); |
50 } | 49 } |
51 | 50 |
52 std::unique_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( | 51 std::unique_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( |
53 FakeLayerTreeHostClient* client, | 52 FakeLayerTreeHostClient* client, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 params.task_graph_runner = task_graph_runner; | 90 params.task_graph_runner = task_graph_runner; |
92 params.image_serialization_processor = image_serialization_processor; | 91 params.image_serialization_processor = image_serialization_processor; |
93 params.animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); | 92 params.animation_host = AnimationHost::CreateForTesting(ThreadInstance::MAIN); |
94 return base::WrapUnique(new FakeLayerTreeHost(client, ¶ms, mode)); | 93 return base::WrapUnique(new FakeLayerTreeHost(client, ¶ms, mode)); |
95 } | 94 } |
96 | 95 |
97 FakeLayerTreeHost::~FakeLayerTreeHost() { | 96 FakeLayerTreeHost::~FakeLayerTreeHost() { |
98 client_->SetLayerTreeHost(NULL); | 97 client_->SetLayerTreeHost(NULL); |
99 } | 98 } |
100 | 99 |
101 const RendererCapabilities& FakeLayerTreeHost::GetRendererCapabilities() const { | |
102 if (renderer_capabilities_set) | |
103 return renderer_capabilities; | |
104 return LayerTreeHost::GetRendererCapabilities(); | |
105 } | |
106 | |
107 void FakeLayerTreeHost::SetNeedsCommit() { needs_commit_ = true; } | 100 void FakeLayerTreeHost::SetNeedsCommit() { needs_commit_ = true; } |
108 | 101 |
109 LayerImpl* FakeLayerTreeHost::CommitAndCreateLayerImplTree() { | 102 LayerImpl* FakeLayerTreeHost::CommitAndCreateLayerImplTree() { |
110 TreeSynchronizer::SynchronizeTrees(root_layer(), active_tree()); | 103 TreeSynchronizer::SynchronizeTrees(root_layer(), active_tree()); |
111 active_tree()->SetPropertyTrees(property_trees()); | 104 active_tree()->SetPropertyTrees(property_trees()); |
112 TreeSynchronizer::PushLayerProperties(root_layer()->GetLayerTree(), | 105 TreeSynchronizer::PushLayerProperties(root_layer()->GetLayerTree(), |
113 active_tree()); | 106 active_tree()); |
114 layer_tree_->animation_host()->PushPropertiesTo(host_impl_.animation_host()); | 107 layer_tree_->animation_host()->PushPropertiesTo(host_impl_.animation_host()); |
115 | 108 |
116 active_tree()->UpdatePropertyTreeScrollOffset(property_trees()); | 109 active_tree()->UpdatePropertyTreeScrollOffset(property_trees()); |
(...skipping 20 matching lines...) Expand all Loading... |
137 pending_tree()->SetPropertyTrees(property_trees()); | 130 pending_tree()->SetPropertyTrees(property_trees()); |
138 TreeSynchronizer::PushLayerProperties(root_layer()->GetLayerTree(), | 131 TreeSynchronizer::PushLayerProperties(root_layer()->GetLayerTree(), |
139 pending_tree()); | 132 pending_tree()); |
140 layer_tree_->animation_host()->PushPropertiesTo(host_impl_.animation_host()); | 133 layer_tree_->animation_host()->PushPropertiesTo(host_impl_.animation_host()); |
141 | 134 |
142 pending_tree()->UpdatePropertyTreeScrollOffset(property_trees()); | 135 pending_tree()->UpdatePropertyTreeScrollOffset(property_trees()); |
143 return pending_tree()->root_layer_for_testing(); | 136 return pending_tree()->root_layer_for_testing(); |
144 } | 137 } |
145 | 138 |
146 } // namespace cc | 139 } // namespace cc |
OLD | NEW |