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. 4 5 #include "cc/test/fake_layer_tree_host.h" 6 7 namespace cc { 8 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)); 13 } 14 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)); 19 } 20 21 void FakeLayerTreeHost::SetNeedsCommit() { needs_commit_ = true; } 22 23 LayerImpl* FakeLayerTreeHost::CommitAndCreateLayerImplTree() { 24 scoped_ptr<LayerImpl> old_root_layer_impl = active_tree()->DetachLayerTree(); 25 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()); 29 30 active_tree()->SetRootLayer(layer_impl.Pass()); 31 return active_tree()->root_layer(); 32 } 33 34 } // namespace cc 35