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