cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / cc / test / fake_layer_tree_host.h
blob8874ff41f2500c4972250ab1fb9876d84e4cd4bf
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 #ifndef CC_TEST_FAKE_LAYER_TREE_HOST_H_
6 #define CC_TEST_FAKE_LAYER_TREE_HOST_H_
8 #include "cc/test/fake_impl_proxy.h"
9 #include "cc/test/fake_layer_tree_host_client.h"
10 #include "cc/test/fake_layer_tree_host_impl.h"
11 #include "cc/trees/layer_tree_host.h"
12 #include "cc/trees/layer_tree_impl.h"
13 #include "cc/trees/tree_synchronizer.h"
15 namespace cc {
17 class FakeLayerTreeHost : protected LayerTreeHost {
18 public:
19 static scoped_ptr<FakeLayerTreeHost> Create() {
20 static FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
21 static LayerTreeSettings settings;
22 return make_scoped_ptr(new FakeLayerTreeHost(&client, settings));
25 static scoped_ptr<FakeLayerTreeHost> Create(
26 const LayerTreeSettings& settings) {
27 static FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D);
28 return make_scoped_ptr(new FakeLayerTreeHost(&client, settings));
31 virtual ~FakeLayerTreeHost() {}
33 virtual void SetNeedsCommit() OVERRIDE {}
34 virtual void SetNeedsFullTreeSync() OVERRIDE {}
36 using LayerTreeHost::SetRootLayer;
37 using LayerTreeHost::root_layer;
39 LayerImpl* CommitAndCreateLayerImplTree() {
40 scoped_ptr<LayerImpl> old_root_layer_impl =
41 active_tree()->DetachLayerTree();
43 scoped_ptr<LayerImpl> layer_impl =
44 TreeSynchronizer::SynchronizeTrees(
45 root_layer(),
46 old_root_layer_impl.Pass(),
47 active_tree());
48 TreeSynchronizer::PushProperties(root_layer(), layer_impl.get());
50 active_tree()->SetRootLayer(layer_impl.Pass());
51 return active_tree()->root_layer();
54 FakeLayerTreeHostImpl* host_impl() { return &host_impl_; }
55 LayerTreeImpl* active_tree() { return host_impl_.active_tree(); }
57 private:
58 FakeLayerTreeHost(LayerTreeHostClient* client,
59 const LayerTreeSettings& settings)
60 : LayerTreeHost(client, settings),
61 host_impl_(settings, &proxy_) {}
63 FakeImplProxy proxy_;
64 FakeLayerTreeHostImpl host_impl_;
67 } // namespace cc
69 #endif // CC_TEST_FAKE_LAYER_TREE_HOST_H_