| 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 "cc/test/test_task_graph_runner.h" |
| 8 |
| 7 namespace cc { | 9 namespace cc { |
| 8 FakeLayerTreeHost::FakeLayerTreeHost(FakeLayerTreeHostClient* client, | 10 FakeLayerTreeHost::FakeLayerTreeHost(FakeLayerTreeHostClient* client, |
| 9 LayerTreeHost::InitParams* params) | 11 LayerTreeHost::InitParams* params) |
| 10 : LayerTreeHost(params), | 12 : LayerTreeHost(params), |
| 11 client_(client), | 13 client_(client), |
| 12 host_impl_(*params->settings, &proxy_, &manager_, nullptr), | 14 host_impl_(*params->settings, |
| 15 &proxy_, |
| 16 &manager_, |
| 17 params->task_graph_runner), |
| 13 needs_commit_(false) { | 18 needs_commit_(false) { |
| 14 client_->SetLayerTreeHost(this); | 19 client_->SetLayerTreeHost(this); |
| 15 } | 20 } |
| 16 | 21 |
| 17 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( | 22 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( |
| 18 FakeLayerTreeHostClient* client) { | 23 FakeLayerTreeHostClient* client, |
| 24 TestTaskGraphRunner* task_graph_runner) { |
| 19 LayerTreeSettings settings; | 25 LayerTreeSettings settings; |
| 20 return Create(client, settings); | 26 return Create(client, task_graph_runner, settings); |
| 21 } | 27 } |
| 22 | 28 |
| 23 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( | 29 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create( |
| 24 FakeLayerTreeHostClient* client, | 30 FakeLayerTreeHostClient* client, |
| 31 TestTaskGraphRunner* task_graph_runner, |
| 25 const LayerTreeSettings& settings) { | 32 const LayerTreeSettings& settings) { |
| 26 LayerTreeHost::InitParams params; | 33 LayerTreeHost::InitParams params; |
| 27 params.client = client; | 34 params.client = client; |
| 28 params.settings = &settings; | 35 params.settings = &settings; |
| 36 params.task_graph_runner = task_graph_runner; |
| 29 return make_scoped_ptr(new FakeLayerTreeHost(client, ¶ms)); | 37 return make_scoped_ptr(new FakeLayerTreeHost(client, ¶ms)); |
| 30 } | 38 } |
| 31 | 39 |
| 32 FakeLayerTreeHost::~FakeLayerTreeHost() { | 40 FakeLayerTreeHost::~FakeLayerTreeHost() { |
| 33 client_->SetLayerTreeHost(NULL); | 41 client_->SetLayerTreeHost(NULL); |
| 34 } | 42 } |
| 35 | 43 |
| 36 void FakeLayerTreeHost::SetNeedsCommit() { needs_commit_ = true; } | 44 void FakeLayerTreeHost::SetNeedsCommit() { needs_commit_ = true; } |
| 37 | 45 |
| 38 LayerImpl* FakeLayerTreeHost::CommitAndCreateLayerImplTree() { | 46 LayerImpl* FakeLayerTreeHost::CommitAndCreateLayerImplTree() { |
| 39 scoped_ptr<LayerImpl> old_root_layer_impl = active_tree()->DetachLayerTree(); | 47 scoped_ptr<LayerImpl> old_root_layer_impl = active_tree()->DetachLayerTree(); |
| 40 | 48 |
| 41 scoped_ptr<LayerImpl> layer_impl = TreeSynchronizer::SynchronizeTrees( | 49 scoped_ptr<LayerImpl> layer_impl = TreeSynchronizer::SynchronizeTrees( |
| 42 root_layer(), old_root_layer_impl.Pass(), active_tree()); | 50 root_layer(), old_root_layer_impl.Pass(), active_tree()); |
| 43 active_tree()->SetPropertyTrees(*property_trees()); | 51 active_tree()->SetPropertyTrees(*property_trees()); |
| 44 TreeSynchronizer::PushProperties(root_layer(), layer_impl.get()); | 52 TreeSynchronizer::PushProperties(root_layer(), layer_impl.get()); |
| 45 | 53 |
| 46 active_tree()->SetRootLayer(layer_impl.Pass()); | 54 active_tree()->SetRootLayer(layer_impl.Pass()); |
| 47 return active_tree()->root_layer(); | 55 return active_tree()->root_layer(); |
| 48 } | 56 } |
| 49 | 57 |
| 50 } // namespace cc | 58 } // namespace cc |
| OLD | NEW |