OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_TEST_FAKE_LAYER_TREE_HOST_H_ | 5 #ifndef CC_TEST_FAKE_LAYER_TREE_HOST_H_ |
6 #define CC_TEST_FAKE_LAYER_TREE_HOST_H_ | 6 #define CC_TEST_FAKE_LAYER_TREE_HOST_H_ |
7 | 7 |
8 #include "cc/debug/micro_benchmark_controller.h" | 8 #include "cc/debug/micro_benchmark_controller.h" |
9 #include "cc/test/fake_impl_task_runner_provider.h" | 9 #include "cc/test/fake_impl_task_runner_provider.h" |
10 #include "cc/test/fake_layer_tree_host_client.h" | 10 #include "cc/test/fake_layer_tree_host_client.h" |
11 #include "cc/test/fake_layer_tree_host_impl.h" | 11 #include "cc/test/fake_layer_tree_host_impl.h" |
12 #include "cc/test/test_shared_bitmap_manager.h" | 12 #include "cc/test/test_shared_bitmap_manager.h" |
13 #include "cc/trees/layer_tree_host.h" | 13 #include "cc/trees/layer_tree_host.h" |
14 #include "cc/trees/layer_tree_impl.h" | 14 #include "cc/trees/layer_tree_impl.h" |
15 #include "cc/trees/tree_synchronizer.h" | 15 #include "cc/trees/tree_synchronizer.h" |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 class TestTaskGraphRunner; | 18 class TestTaskGraphRunner; |
19 | 19 |
20 class FakeLayerTreeHost : public LayerTreeHost { | 20 class FakeLayerTreeHost : public LayerTreeHost { |
21 public: | 21 public: |
22 static scoped_ptr<FakeLayerTreeHost> Create( | 22 static scoped_ptr<FakeLayerTreeHost> Create( |
23 FakeLayerTreeHostClient* client, | 23 FakeLayerTreeHostClient* client, |
24 TestTaskGraphRunner* task_graph_runner); | 24 TestTaskGraphRunner* task_graph_runner); |
25 static scoped_ptr<FakeLayerTreeHost> Create( | 25 static scoped_ptr<FakeLayerTreeHost> Create( |
26 FakeLayerTreeHostClient* client, | 26 FakeLayerTreeHostClient* client, |
27 TestTaskGraphRunner* task_graph_runner, | 27 TestTaskGraphRunner* task_graph_runner, |
28 const LayerTreeSettings& settings); | 28 const LayerTreeSettings& settings); |
| 29 static scoped_ptr<FakeLayerTreeHost> Create( |
| 30 FakeLayerTreeHostClient* client, |
| 31 TestTaskGraphRunner* task_graph_runner, |
| 32 const LayerTreeSettings& settings, |
| 33 CompositorMode mode); |
29 | 34 |
30 ~FakeLayerTreeHost() override; | 35 ~FakeLayerTreeHost() override; |
31 | 36 |
32 const RendererCapabilities& GetRendererCapabilities() const override; | 37 const RendererCapabilities& GetRendererCapabilities() const override; |
33 void SetNeedsCommit() override; | 38 void SetNeedsCommit() override; |
34 void SetNeedsUpdateLayers() override {} | 39 void SetNeedsUpdateLayers() override {} |
35 void SetNeedsFullTreeSync() override {} | 40 void SetNeedsFullTreeSync() override {} |
36 | 41 |
37 using LayerTreeHost::SetRootLayer; | 42 using LayerTreeHost::SetRootLayer; |
38 using LayerTreeHost::root_layer; | 43 using LayerTreeHost::root_layer; |
39 | 44 |
40 LayerImpl* CommitAndCreateLayerImplTree(); | 45 LayerImpl* CommitAndCreateLayerImplTree(); |
41 | 46 |
42 FakeLayerTreeHostImpl* host_impl() { return &host_impl_; } | 47 FakeLayerTreeHostImpl* host_impl() { return &host_impl_; } |
43 LayerTreeImpl* active_tree() { return host_impl_.active_tree(); } | 48 LayerTreeImpl* active_tree() { return host_impl_.active_tree(); } |
44 | 49 |
45 using LayerTreeHost::ScheduleMicroBenchmark; | 50 using LayerTreeHost::ScheduleMicroBenchmark; |
46 using LayerTreeHost::SendMessageToMicroBenchmark; | 51 using LayerTreeHost::SendMessageToMicroBenchmark; |
47 using LayerTreeHost::SetOutputSurfaceLostForTesting; | 52 using LayerTreeHost::SetOutputSurfaceLostForTesting; |
48 using LayerTreeHost::InitializeSingleThreaded; | 53 using LayerTreeHost::InitializeSingleThreaded; |
49 using LayerTreeHost::InitializeForTesting; | 54 using LayerTreeHost::InitializeForTesting; |
| 55 using LayerTreeHost::RecordGpuRasterizationHistogram; |
| 56 |
50 void UpdateLayers() { LayerTreeHost::UpdateLayers(); } | 57 void UpdateLayers() { LayerTreeHost::UpdateLayers(); } |
51 | 58 |
52 MicroBenchmarkController* GetMicroBenchmarkController() { | 59 MicroBenchmarkController* GetMicroBenchmarkController() { |
53 return µ_benchmark_controller_; | 60 return µ_benchmark_controller_; |
54 } | 61 } |
55 | 62 |
56 bool needs_commit() { return needs_commit_; } | 63 bool needs_commit() { return needs_commit_; } |
57 | 64 |
58 void set_renderer_capabilities(const RendererCapabilities& capabilities) { | 65 void set_renderer_capabilities(const RendererCapabilities& capabilities) { |
59 renderer_capabilities_set = true; | 66 renderer_capabilities_set = true; |
60 renderer_capabilities = capabilities; | 67 renderer_capabilities = capabilities; |
61 } | 68 } |
62 | 69 |
63 protected: | 70 protected: |
64 FakeLayerTreeHost(FakeLayerTreeHostClient* client, | 71 FakeLayerTreeHost(FakeLayerTreeHostClient* client, |
65 LayerTreeHost::InitParams* params); | 72 LayerTreeHost::InitParams* params, |
| 73 CompositorMode mode); |
66 | 74 |
67 private: | 75 private: |
68 FakeImplTaskRunnerProvider task_runner_provider_; | 76 FakeImplTaskRunnerProvider task_runner_provider_; |
69 FakeLayerTreeHostClient* client_; | 77 FakeLayerTreeHostClient* client_; |
70 TestSharedBitmapManager manager_; | 78 TestSharedBitmapManager manager_; |
71 FakeLayerTreeHostImpl host_impl_; | 79 FakeLayerTreeHostImpl host_impl_; |
72 bool needs_commit_; | 80 bool needs_commit_; |
73 | 81 |
74 bool renderer_capabilities_set; | 82 bool renderer_capabilities_set; |
75 RendererCapabilities renderer_capabilities; | 83 RendererCapabilities renderer_capabilities; |
76 }; | 84 }; |
77 | 85 |
78 } // namespace cc | 86 } // namespace cc |
79 | 87 |
80 #endif // CC_TEST_FAKE_LAYER_TREE_HOST_H_ | 88 #endif // CC_TEST_FAKE_LAYER_TREE_HOST_H_ |
OLD | NEW |