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"
9 scoped_ptr
<FakeLayerTreeHost
> FakeLayerTreeHost::Create() {
10 static FakeLayerTreeHostClient
client(FakeLayerTreeHostClient::DIRECT_3D
);
11 static LayerTreeSettings settings
;
12 return make_scoped_ptr(new FakeLayerTreeHost(&client
, settings
));
15 scoped_ptr
<FakeLayerTreeHost
> FakeLayerTreeHost::Create(
16 const LayerTreeSettings
& settings
) {
17 static FakeLayerTreeHostClient
client(FakeLayerTreeHostClient::DIRECT_3D
);
18 return make_scoped_ptr(new FakeLayerTreeHost(&client
, settings
));
21 void FakeLayerTreeHost::SetNeedsCommit() { needs_commit_
= true; }
23 LayerImpl
* FakeLayerTreeHost::CommitAndCreateLayerImplTree() {
24 scoped_ptr
<LayerImpl
> old_root_layer_impl
= active_tree()->DetachLayerTree();
26 scoped_ptr
<LayerImpl
> layer_impl
= TreeSynchronizer::SynchronizeTrees(
27 root_layer(), old_root_layer_impl
.Pass(), active_tree());
28 TreeSynchronizer::PushProperties(root_layer(), layer_impl
.get());
30 active_tree()->SetRootLayer(layer_impl
.Pass());
31 return active_tree()->root_layer();