[Android] Introduce new UMA action for when user copies Image URL from context menu
[chromium-blink-merge.git] / cc / test / fake_layer_tree_host.cc
blob220b556fcf98ff34d92a07977dc40384e5389b7b
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 settings.verify_property_trees = true;
28 return Create(client, task_graph_runner, settings);
31 scoped_ptr<FakeLayerTreeHost> FakeLayerTreeHost::Create(
32 FakeLayerTreeHostClient* client,
33 TestTaskGraphRunner* task_graph_runner,
34 const LayerTreeSettings& settings) {
35 LayerTreeHost::InitParams params;
36 params.client = client;
37 params.settings = &settings;
38 params.task_graph_runner = task_graph_runner;
39 return make_scoped_ptr(new FakeLayerTreeHost(client, &params));
42 FakeLayerTreeHost::~FakeLayerTreeHost() {
43 client_->SetLayerTreeHost(NULL);
46 void FakeLayerTreeHost::SetNeedsCommit() { needs_commit_ = true; }
48 LayerImpl* FakeLayerTreeHost::CommitAndCreateLayerImplTree() {
49 scoped_ptr<LayerImpl> old_root_layer_impl = active_tree()->DetachLayerTree();
51 scoped_ptr<LayerImpl> layer_impl = TreeSynchronizer::SynchronizeTrees(
52 root_layer(), old_root_layer_impl.Pass(), active_tree());
53 active_tree()->SetPropertyTrees(*property_trees());
54 TreeSynchronizer::PushProperties(root_layer(), layer_impl.get());
56 active_tree()->SetRootLayer(layer_impl.Pass());
58 if (page_scale_layer() && inner_viewport_scroll_layer()) {
59 active_tree()->SetViewportLayersFromIds(
60 overscroll_elasticity_layer() ? overscroll_elasticity_layer()->id()
61 : Layer::INVALID_ID,
62 page_scale_layer()->id(), inner_viewport_scroll_layer()->id(),
63 outer_viewport_scroll_layer() ? outer_viewport_scroll_layer()->id()
64 : Layer::INVALID_ID);
67 active_tree()->UpdatePropertyTreesForBoundsDelta();
68 return active_tree()->root_layer();
71 } // namespace cc