| 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/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 #include "cc/trees/mutator_host.h" | 13 #include "cc/trees/mutator_host.h" |
| 14 | 14 |
| 15 namespace cc { | 15 namespace cc { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class FakeLayerTree : public LayerTree { | 19 class FakeLayerTree : public LayerTree { |
| 20 public: | 20 public: |
| 21 FakeLayerTree(MutatorHost* mutator_host, LayerTreeHost* layer_tree_host) | 21 FakeLayerTree(MutatorHost* mutator_host, LayerTreeHost* layer_tree_host) |
| 22 : LayerTree(mutator_host, layer_tree_host) {} | 22 : LayerTree(mutator_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 LayerTreeHostInProcess::InitParams* params, | 30 LayerTreeHost::InitParams* params, |
| 31 CompositorMode mode) | 31 CompositorMode mode) |
| 32 : LayerTreeHostInProcess( | 32 : LayerTreeHost( |
| 33 params, | 33 params, |
| 34 mode, | 34 mode, |
| 35 base::MakeUnique<FakeLayerTree>(params->mutator_host, this)), | 35 base::MakeUnique<FakeLayerTree>(params->mutator_host, this)), |
| 36 client_(client), | 36 client_(client), |
| 37 host_impl_(*params->settings, | 37 host_impl_(*params->settings, |
| 38 &task_runner_provider_, | 38 &task_runner_provider_, |
| 39 params->task_graph_runner), | 39 params->task_graph_runner), |
| 40 needs_commit_(false) { | 40 needs_commit_(false) { |
| 41 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner = | 41 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner = |
| 42 mode == CompositorMode::THREADED ? base::ThreadTaskRunnerHandle::Get() | 42 mode == CompositorMode::THREADED ? base::ThreadTaskRunnerHandle::Get() |
| (...skipping 20 matching lines...) Expand all Loading... |
| 63 return Create(client, task_graph_runner, mutator_host, settings, | 63 return Create(client, task_graph_runner, mutator_host, settings, |
| 64 CompositorMode::SINGLE_THREADED); | 64 CompositorMode::SINGLE_THREADED); |
| 65 } | 65 } |
| 66 | 66 |
| 67 std::unique_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( | 67 std::unique_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( |
| 68 FakeLayerTreeHostClient* client, | 68 FakeLayerTreeHostClient* client, |
| 69 TestTaskGraphRunner* task_graph_runner, | 69 TestTaskGraphRunner* task_graph_runner, |
| 70 MutatorHost* mutator_host, | 70 MutatorHost* mutator_host, |
| 71 const LayerTreeSettings& settings, | 71 const LayerTreeSettings& settings, |
| 72 CompositorMode mode) { | 72 CompositorMode mode) { |
| 73 LayerTreeHostInProcess::InitParams params; | 73 LayerTreeHost::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.mutator_host = mutator_host; | 77 params.mutator_host = mutator_host; |
| 78 return base::WrapUnique(new FakeLayerTreeHost(client, ¶ms, mode)); | 78 return base::WrapUnique(new FakeLayerTreeHost(client, ¶ms, mode)); |
| 79 } | 79 } |
| 80 | 80 |
| 81 FakeLayerTreeHost::~FakeLayerTreeHost() { | 81 FakeLayerTreeHost::~FakeLayerTreeHost() { |
| 82 client_->SetLayerTreeHost(NULL); | 82 client_->SetLayerTreeHost(NULL); |
| 83 } | 83 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 TreeSynchronizer::PushLayerProperties(root_layer()->GetLayerTree(), | 117 TreeSynchronizer::PushLayerProperties(root_layer()->GetLayerTree(), |
| 118 pending_tree()); | 118 pending_tree()); |
| 119 layer_tree_->mutator_host()->PushPropertiesTo(host_impl_.mutator_host()); | 119 layer_tree_->mutator_host()->PushPropertiesTo(host_impl_.mutator_host()); |
| 120 | 120 |
| 121 pending_tree()->property_trees()->scroll_tree.PushScrollUpdatesFromMainThread( | 121 pending_tree()->property_trees()->scroll_tree.PushScrollUpdatesFromMainThread( |
| 122 property_trees(), pending_tree()); | 122 property_trees(), pending_tree()); |
| 123 return pending_tree()->root_layer_for_testing(); | 123 return pending_tree()->root_layer_for_testing(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace cc | 126 } // namespace cc |
| OLD | NEW |