Chromium Code Reviews| 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_client.h" | |
| 10 #include "cc/blimp/layer_tree_host_remote.h" | |
| 11 | |
| 12 namespace gpu { | |
| 13 class GpuMemoryBufferManager; | |
| 14 } // namespace gpu | |
| 15 | |
| 16 namespace cc { | |
| 17 class CompositorStateDeserializer; | |
| 18 class FakeImageSerializationProcessor; | |
| 19 class LayerTreeHostInProcess; | |
| 20 class SharedBitmapManager; | |
| 21 class TaskGraphRunner; | |
| 22 | |
| 23 // This is a version of LayerTreeHostRemote meant to be used for tests that want | |
| 24 // to inspect the CompositorFrame produced when state updates from the remote | |
| 25 // host are used by a compositor on the client. | |
| 26 class LayerTreeHostRemoteForTesting : public LayerTreeHostRemote, | |
|
Khushal
2016/10/06 18:39:07
Also I'm hoping to use this class for Layout tests
enne (OOO)
2016/10/06 20:19:55
I think it might be worth running layout tests man
Khushal
2016/10/06 21:09:42
I'll try with a few layout tests to see how feasib
enne (OOO)
2016/10/06 21:32:18
As I said, I think running layout tests manually i
Khushal
2016/10/06 22:48:51
Sorry, that's what I meant. I'll try a few tests m
| |
| 27 public CompositorStateDeserializerClient { | |
| 28 public: | |
| 29 static std::unique_ptr<LayerTreeHostRemoteForTesting> Create( | |
| 30 LayerTreeHostClient* client, | |
| 31 std::unique_ptr<AnimationHost> animation_host, | |
| 32 LayerTreeSettings const* settings, | |
| 33 SharedBitmapManager* shared_bitmap_manager, | |
| 34 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
| 35 TaskGraphRunner* task_graph_runner, | |
| 36 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | |
| 37 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | |
| 38 | |
| 39 static std::unique_ptr<RemoteCompositorBridge> CreateRemoteCompositorBridge( | |
| 40 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner); | |
| 41 | |
| 42 ~LayerTreeHostRemoteForTesting() override; | |
| 43 | |
| 44 // LayerTreeHost interface. | |
| 45 void SetVisible(bool visible) override; | |
| 46 void SetCompositorFrameSink( | |
| 47 std::unique_ptr<CompositorFrameSink> compositor_frame_sink) override; | |
| 48 std::unique_ptr<CompositorFrameSink> ReleaseCompositorFrameSink() override; | |
| 49 void SetNeedsRedraw() override; | |
| 50 void SetNeedsRedrawRect(const gfx::Rect& damage_rect) override; | |
| 51 void SetNextCommitForcesRedraw() override; | |
| 52 void NotifyInputThrottledUntilCommit() override; | |
| 53 const base::WeakPtr<InputHandler>& GetInputHandler() const override; | |
| 54 | |
| 55 LayerTreeHostInProcess* layer_tree_host_in_process() const { | |
| 56 return layer_tree_host_in_process_.get(); | |
| 57 } | |
| 58 | |
| 59 protected: | |
| 60 explicit LayerTreeHostRemoteForTesting(InitParams* params); | |
| 61 | |
| 62 void Initialize(SharedBitmapManager* shared_bitmap_manager, | |
| 63 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
| 64 TaskGraphRunner* task_graph_runner, | |
| 65 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | |
| 66 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner, | |
| 67 std::unique_ptr<FakeImageSerializationProcessor> | |
| 68 image_serialization_processor); | |
| 69 | |
| 70 virtual std::unique_ptr<LayerTreeHostInProcess> CreateLayerTreeHostInProcess( | |
| 71 LayerTreeHostClient* client, | |
| 72 SharedBitmapManager* shared_bitmap_manager, | |
| 73 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
| 74 TaskGraphRunner* task_graph_runner, | |
| 75 const LayerTreeSettings& settings, | |
| 76 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | |
| 77 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner); | |
| 78 | |
| 79 private: | |
| 80 class LayerTreeHostInProcessClient; | |
| 81 class RemoteCompositorBridgeImpl; | |
| 82 | |
| 83 // CompositorStateDeserializerClient implementation. | |
| 84 bool ShouldRetainClientScroll(int engine_layer_id, | |
| 85 const gfx::ScrollOffset& new_offset) override; | |
| 86 bool ShouldRetainClientPageScale(float new_page_scale) override; | |
| 87 | |
| 88 // LayerTreeHostRemote interface. | |
| 89 void DispatchDrawAndSwapCallbacks() override; | |
| 90 | |
| 91 void LayerDidScroll(int engine_layer_id); | |
| 92 | |
| 93 void RemoteHostNeedsMainFrame(); | |
| 94 void ProcessRemoteCompositorUpdate( | |
| 95 std::unique_ptr<CompositorProtoState> compositor_proto_state); | |
| 96 void UpdateStateOnInProcessHost(); | |
| 97 | |
| 98 std::unique_ptr<LayerTreeHostInProcess> layer_tree_host_in_process_; | |
| 99 std::unique_ptr<CompositorStateDeserializer> compositor_state_deserializer_; | |
| 100 | |
| 101 std::unique_ptr<CompositorProtoState> pending_compositor_proto_state_; | |
| 102 | |
| 103 std::unique_ptr<LayerTreeHostInProcessClient> | |
| 104 layer_tree_host_in_process_client_; | |
| 105 | |
| 106 std::unique_ptr<FakeImageSerializationProcessor> | |
| 107 image_serialization_processor_; | |
| 108 | |
| 109 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostRemoteForTesting); | |
| 110 }; | |
| 111 | |
| 112 } // namespace cc | |
| 113 | |
| 114 #endif // CC_TEST_LAYER_TREE_HOST_REMOTE_FOR_TESTING_H_ | |
| OLD | NEW |