| 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_proxy.h" | 9 #include "cc/test/fake_impl_proxy.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 | 18 |
| 19 class FakeLayerTreeHost : public LayerTreeHost { | 19 class FakeLayerTreeHost : public LayerTreeHost { |
| 20 public: | 20 public: |
| 21 static scoped_ptr<FakeLayerTreeHost> Create(); | 21 static scoped_ptr<FakeLayerTreeHost> Create(FakeLayerTreeHostClient* client); |
| 22 | |
| 23 static scoped_ptr<FakeLayerTreeHost> Create( | 22 static scoped_ptr<FakeLayerTreeHost> Create( |
| 23 FakeLayerTreeHostClient* client, |
| 24 const LayerTreeSettings& settings); | 24 const LayerTreeSettings& settings); |
| 25 | 25 |
| 26 virtual ~FakeLayerTreeHost() {} | 26 virtual ~FakeLayerTreeHost(); |
| 27 | 27 |
| 28 virtual void SetNeedsCommit() OVERRIDE; | 28 virtual void SetNeedsCommit() OVERRIDE; |
| 29 virtual void SetNeedsFullTreeSync() OVERRIDE {} | 29 virtual void SetNeedsFullTreeSync() OVERRIDE {} |
| 30 | 30 |
| 31 using LayerTreeHost::SetRootLayer; | 31 using LayerTreeHost::SetRootLayer; |
| 32 using LayerTreeHost::root_layer; | 32 using LayerTreeHost::root_layer; |
| 33 | 33 |
| 34 LayerImpl* CommitAndCreateLayerImplTree(); | 34 LayerImpl* CommitAndCreateLayerImplTree(); |
| 35 | 35 |
| 36 FakeLayerTreeHostImpl* host_impl() { return &host_impl_; } | 36 FakeLayerTreeHostImpl* host_impl() { return &host_impl_; } |
| 37 LayerTreeImpl* active_tree() { return host_impl_.active_tree(); } | 37 LayerTreeImpl* active_tree() { return host_impl_.active_tree(); } |
| 38 | 38 |
| 39 using LayerTreeHost::ScheduleMicroBenchmark; | 39 using LayerTreeHost::ScheduleMicroBenchmark; |
| 40 using LayerTreeHost::SendMessageToMicroBenchmark; | 40 using LayerTreeHost::SendMessageToMicroBenchmark; |
| 41 using LayerTreeHost::SetOutputSurfaceLostForTesting; | 41 using LayerTreeHost::SetOutputSurfaceLostForTesting; |
| 42 using LayerTreeHost::InitializeSingleThreaded; | 42 using LayerTreeHost::InitializeSingleThreaded; |
| 43 using LayerTreeHost::InitializeForTesting; | 43 using LayerTreeHost::InitializeForTesting; |
| 44 void UpdateLayers(ResourceUpdateQueue* queue) { | 44 void UpdateLayers(ResourceUpdateQueue* queue) { |
| 45 LayerTreeHost::UpdateLayers(queue); | 45 LayerTreeHost::UpdateLayers(queue); |
| 46 } | 46 } |
| 47 | 47 |
| 48 MicroBenchmarkController* GetMicroBenchmarkController() { | 48 MicroBenchmarkController* GetMicroBenchmarkController() { |
| 49 return µ_benchmark_controller_; | 49 return µ_benchmark_controller_; |
| 50 } | 50 } |
| 51 | 51 |
| 52 bool needs_commit() { return needs_commit_; } | 52 bool needs_commit() { return needs_commit_; } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 FakeLayerTreeHost(LayerTreeHostClient* client, | 55 FakeLayerTreeHost(FakeLayerTreeHostClient* client, |
| 56 const LayerTreeSettings& settings); | 56 const LayerTreeSettings& settings); |
| 57 | 57 |
| 58 FakeImplProxy proxy_; | 58 FakeImplProxy proxy_; |
| 59 FakeLayerTreeHostClient* client_; |
| 59 TestSharedBitmapManager manager_; | 60 TestSharedBitmapManager manager_; |
| 60 FakeLayerTreeHostImpl host_impl_; | 61 FakeLayerTreeHostImpl host_impl_; |
| 61 bool needs_commit_; | 62 bool needs_commit_; |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 } // namespace cc | 65 } // namespace cc |
| 65 | 66 |
| 66 #endif // CC_TEST_FAKE_LAYER_TREE_HOST_H_ | 67 #endif // CC_TEST_FAKE_LAYER_TREE_HOST_H_ |
| OLD | NEW |