Add Apps.AppListSearchQueryLength UMA histogram.
[chromium-blink-merge.git] / cc / test / fake_layer_tree_host.cc
blob428753dc09d440b192bcf376571e2fac878af1a4
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 namespace cc {
8 FakeLayerTreeHost::FakeLayerTreeHost(FakeLayerTreeHostClient* client,
9 LayerTreeHost::InitParams* params)
10 : LayerTreeHost(params),
11 client_(client),
12 host_impl_(*params->settings, &proxy_, &manager_, nullptr),
13 needs_commit_(false) {
14 client_->SetLayerTreeHost(this);
17 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create(
18 FakeLayerTreeHostClient* client) {
19 LayerTreeSettings settings;
20 settings.verify_property_trees = true;
21 return Create(client, settings);
24 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create(
25 FakeLayerTreeHostClient* client,
26 const LayerTreeSettings& settings) {
27 LayerTreeHost::InitParams params;
28 params.client = client;
29 params.settings = &settings;
30 return make_scoped_ptr(new FakeLayerTreeHost(client, &params));
33 FakeLayerTreeHost::~FakeLayerTreeHost() {
34 client_->SetLayerTreeHost(NULL);
37 void FakeLayerTreeHost::SetNeedsCommit() { needs_commit_ = true; }
39 LayerImpl* FakeLayerTreeHost::CommitAndCreateLayerImplTree() {
40 scoped_ptr<LayerImpl> old_root_layer_impl = active_tree()->DetachLayerTree();
42 scoped_ptr<LayerImpl> layer_impl = TreeSynchronizer::SynchronizeTrees(
43 root_layer(), old_root_layer_impl.Pass(), active_tree());
44 TreeSynchronizer::PushProperties(root_layer(), layer_impl.get());
46 active_tree()->SetRootLayer(layer_impl.Pass());
47 return active_tree()->root_layer();
50 } // namespace cc