[telemetry] Add dtu to content/test/gpu OWNERS for upstream Telemetry changes.
[chromium-blink-merge.git] / cc / test / fake_layer_tree_host.cc
blobd323a8e19939713ec3000d3e2caa47756da28bfe
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
3 // found in the LICENSE file.
5 #include "cc/test/fake_layer_tree_host.h"
7 #include "cc/layers/layer.h"
8 #include "cc/test/test_task_graph_runner.h"
10 namespace cc {
11 FakeLayerTreeHost::FakeLayerTreeHost(FakeLayerTreeHostClient* client,
12 LayerTreeHost::InitParams* params)
13 : LayerTreeHost(params),
14 client_(client),
15 host_impl_(*params->settings,
16 &proxy_,
17 &manager_,
18 params->task_graph_runner),
19 needs_commit_(false) {
20 client_->SetLayerTreeHost(this);
23 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create(
24 FakeLayerTreeHostClient* client,
25 TestTaskGraphRunner* task_graph_runner) {
26 LayerTreeSettings settings;
27 return Create(client, task_graph_runner, settings);
30 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create(
31 FakeLayerTreeHostClient* client,
32 TestTaskGraphRunner* task_graph_runner,
33 const LayerTreeSettings& settings) {
34 LayerTreeHost::InitParams params;
35 params.client = client;
36 params.settings = &settings;
37 params.task_graph_runner = task_graph_runner;
38 return make_scoped_ptr(new FakeLayerTreeHost(client, &params));
41 FakeLayerTreeHost::~FakeLayerTreeHost() {
42 client_->SetLayerTreeHost(NULL);
45 void FakeLayerTreeHost::SetNeedsCommit() { needs_commit_ = true; }
47 LayerImpl* FakeLayerTreeHost::CommitAndCreateLayerImplTree() {
48 scoped_ptr<LayerImpl> old_root_layer_impl = active_tree()->DetachLayerTree();
50 scoped_ptr<LayerImpl> layer_impl = TreeSynchronizer::SynchronizeTrees(
51 root_layer(), old_root_layer_impl.Pass(), active_tree());
52 active_tree()->SetPropertyTrees(*property_trees());
53 TreeSynchronizer::PushProperties(root_layer(), layer_impl.get());
55 active_tree()->SetRootLayer(layer_impl.Pass());
57 if (page_scale_layer() && inner_viewport_scroll_layer()) {
58 active_tree()->SetViewportLayersFromIds(
59 overscroll_elasticity_layer() ? overscroll_elasticity_layer()->id()
60 : Layer::INVALID_ID,
61 page_scale_layer()->id(), inner_viewport_scroll_layer()->id(),
62 outer_viewport_scroll_layer() ? outer_viewport_scroll_layer()->id()
63 : Layer::INVALID_ID);
66 active_tree()->UpdatePropertyTreesForBoundsDelta();
67 return active_tree()->root_layer();
70 } // namespace cc