| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 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 #ifndef CC_TEST_LAYER_TREE_HOST_REMOTE_FOR_TESTING_H_ | |
| 6 #define CC_TEST_LAYER_TREE_HOST_REMOTE_FOR_TESTING_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "cc/blimp/compositor_state_deserializer.h" | |
| 10 #include "cc/blimp/layer_tree_host_remote.h" | |
| 11 | |
| 12 namespace cc { | |
| 13 | |
| 14 class AnimationHost; | |
| 15 class CompositorProtoState; | |
| 16 class FakeImageSerializationProcessor; | |
| 17 class LayerTreeHostInProcess; | |
| 18 class MutatorHost; | |
| 19 class TaskGraphRunner; | |
| 20 | |
| 21 // This is a version of LayerTreeHostRemote meant to be used for tests that want | |
| 22 // to inspect the CompositorFrame produced when state updates from the remote | |
| 23 // host are used by a compositor on the client. | |
| 24 class LayerTreeHostRemoteForTesting : public LayerTreeHostRemote, | |
| 25 public CompositorStateDeserializerClient { | |
| 26 public: | |
| 27 static std::unique_ptr<LayerTreeHostRemoteForTesting> Create( | |
| 28 LayerTreeHostClient* client, | |
| 29 MutatorHost* mutator_host, | |
| 30 LayerTreeSettings const* settings, | |
| 31 TaskGraphRunner* task_graph_runner, | |
| 32 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | |
| 33 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | |
| 34 | |
| 35 static std::unique_ptr<RemoteCompositorBridge> CreateRemoteCompositorBridge( | |
| 36 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); | |
| 37 | |
| 38 ~LayerTreeHostRemoteForTesting() override; | |
| 39 | |
| 40 // LayerTreeHost interface. | |
| 41 void SetVisible(bool visible) override; | |
| 42 void SetCompositorFrameSink( | |
| 43 std::unique_ptr<CompositorFrameSink> compositor_frame_sink) override; | |
| 44 std::unique_ptr<CompositorFrameSink> ReleaseCompositorFrameSink() override; | |
| 45 void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override; | |
| 46 void SetNextCommitForcesRedraw() override; | |
| 47 void NotifyInputThrottledUntilCommit() override; | |
| 48 const base::WeakPtr<InputHandler>& GetInputHandler() const override; | |
| 49 | |
| 50 LayerTreeHostInProcess* layer_tree_host_in_process() const { | |
| 51 return layer_tree_host_in_process_.get(); | |
| 52 } | |
| 53 | |
| 54 protected: | |
| 55 explicit LayerTreeHostRemoteForTesting(InitParams* params); | |
| 56 | |
| 57 void Initialize(TaskGraphRunner* task_graph_runner, | |
| 58 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | |
| 59 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | |
| 60 std::unique_ptr<FakeImageSerializationProcessor> | |
| 61 image_serialization_processor); | |
| 62 | |
| 63 virtual std::unique_ptr<LayerTreeHostInProcess> CreateLayerTreeHostInProcess( | |
| 64 LayerTreeHostClient* client, | |
| 65 TaskGraphRunner* task_graph_runner, | |
| 66 const LayerTreeSettings& settings, | |
| 67 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | |
| 68 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | |
| 69 MutatorHost* mutator_host); | |
| 70 | |
| 71 private: | |
| 72 class LayerTreeHostInProcessClient; | |
| 73 class RemoteCompositorBridgeImpl; | |
| 74 | |
| 75 // CompositorStateDeserializerClient implementation. | |
| 76 void DidUpdateLocalState() override; | |
| 77 | |
| 78 // LayerTreeHostRemote interface. | |
| 79 void DispatchDrawAndSubmitCallbacks() override; | |
| 80 | |
| 81 void BeginRemoteMainFrame(); | |
| 82 | |
| 83 void RemoteHostNeedsMainFrame(); | |
| 84 void ProcessRemoteCompositorUpdate( | |
| 85 std::unique_ptr<CompositorProtoState> compositor_proto_state); | |
| 86 | |
| 87 std::unique_ptr<LayerTreeHostInProcess> layer_tree_host_in_process_; | |
| 88 std::unique_ptr<AnimationHost> animation_host_; | |
| 89 std::unique_ptr<CompositorStateDeserializer> compositor_state_deserializer_; | |
| 90 | |
| 91 bool client_state_dirty_ = false; | |
| 92 | |
| 93 std::unique_ptr<LayerTreeHostInProcessClient> | |
| 94 layer_tree_host_in_process_client_; | |
| 95 | |
| 96 std::unique_ptr<FakeImageSerializationProcessor> | |
| 97 image_serialization_processor_; | |
| 98 | |
| 99 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostRemoteForTesting); | |
| 100 }; | |
| 101 | |
| 102 } // namespace cc | |
| 103 | |
| 104 #endif // CC_TEST_LAYER_TREE_HOST_REMOTE_FOR_TESTING_H_ | |
| OLD | NEW |