| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "blimp/client/test/compositor/blimp_compositor_with_fake_host.h" |
| 6 |
| 7 #include "cc/proto/compositor_message.pb.h" |
| 8 #include "cc/test/fake_proxy.h" |
| 9 |
| 10 namespace blimp { |
| 11 namespace client { |
| 12 |
| 13 // static |
| 14 std::unique_ptr<BlimpCompositorWithFakeHost> |
| 15 BlimpCompositorWithFakeHost::Create( |
| 16 BlimpCompositorDependencies* compositor_dependencies, |
| 17 BlimpCompositorClient* client) { |
| 18 std::unique_ptr<BlimpCompositorWithFakeHost> compositor = base::WrapUnique( |
| 19 new BlimpCompositorWithFakeHost(compositor_dependencies, client)); |
| 20 compositor->Initialize(); |
| 21 return compositor; |
| 22 } |
| 23 |
| 24 BlimpCompositorWithFakeHost::BlimpCompositorWithFakeHost( |
| 25 BlimpCompositorDependencies* compositor_dependencies, |
| 26 BlimpCompositorClient* client) |
| 27 : BlimpCompositor(compositor_dependencies, client, true) {} |
| 28 |
| 29 BlimpCompositorWithFakeHost::~BlimpCompositorWithFakeHost() = default; |
| 30 |
| 31 std::unique_ptr<cc::proto::CompositorMessage> |
| 32 BlimpCompositorWithFakeHost::CreateFakeUpdate( |
| 33 scoped_refptr<cc::Layer> root_layer) { |
| 34 std::unique_ptr<cc::proto::CompositorMessage> message = |
| 35 base::MakeUnique<cc::proto::CompositorMessage>(); |
| 36 message->set_client_state_update_ack(false); |
| 37 cc::LayerTree* layer_tree = host()->GetLayerTree(); |
| 38 layer_tree->SetRootLayer(root_layer); |
| 39 cc::proto::LayerTree* layer_tree_proto = |
| 40 message->mutable_layer_tree_host()->mutable_layer_tree(); |
| 41 layer_tree->ToProtobuf(layer_tree_proto, true); |
| 42 return message; |
| 43 } |
| 44 |
| 45 std::unique_ptr<cc::LayerTreeHostInProcess> |
| 46 BlimpCompositorWithFakeHost::CreateLayerTreeHost() { |
| 47 cc::LayerTreeSettings settings; |
| 48 std::unique_ptr<cc::FakeLayerTreeHost> host = |
| 49 cc::FakeLayerTreeHost::Create(&fake_client_, &task_graph_runner_, |
| 50 settings, cc::CompositorMode::THREADED); |
| 51 host->InitializeForTesting( |
| 52 cc::TaskRunnerProvider::Create(base::ThreadTaskRunnerHandle::Get(), |
| 53 base::ThreadTaskRunnerHandle::Get()), |
| 54 base::MakeUnique<cc::FakeProxy>()); |
| 55 fake_host_ = host.get(); |
| 56 return std::move(host); |
| 57 } |
| 58 |
| 59 } // namespace client |
| 60 } // namespace blimp |
| OLD | NEW |