Chromium Code Reviews| Index: blimp/client/core/compositor/blimp_compositor.h |
| diff --git a/blimp/client/core/compositor/blimp_compositor.h b/blimp/client/core/compositor/blimp_compositor.h |
| index cf14c64cfae17b9ba522bb774b7ffebf771c1e44..934cc08b9b204fdcd6837e99665893cf0a331196 100644 |
| --- a/blimp/client/core/compositor/blimp_compositor.h |
| +++ b/blimp/client/core/compositor/blimp_compositor.h |
| @@ -13,7 +13,7 @@ |
| #include "base/threading/thread_checker.h" |
| #include "blimp/client/core/compositor/blimp_compositor_frame_sink_proxy.h" |
| #include "blimp/client/public/compositor/compositor_dependencies.h" |
| -#include "cc/blimp/compositor_state_deserializer_client.h" |
| +#include "cc/blimp/compositor_state_deserializer.h" |
| #include "cc/surfaces/surface_factory_client.h" |
| #include "cc/trees/layer_tree_host.h" |
| #include "cc/trees/layer_tree_host_client.h" |
| @@ -34,10 +34,9 @@ namespace proto { |
| class CompositorMessage; |
| } // namespace proto |
| -class CompositorStateDeserializer; |
| class ContextProvider; |
| class Layer; |
| -class LayerTreeHost; |
| +class LayerTreeHostInProcess; |
| class LayerTreeSettings; |
| class LocalFrameid; |
| class Surface; |
| @@ -82,9 +81,10 @@ class BlimpCompositor : public cc::LayerTreeHostClient, |
| public cc::SurfaceFactoryClient, |
| public cc::CompositorStateDeserializerClient { |
| public: |
| - BlimpCompositor(BlimpCompositorDependencies* compositor_dependencies, |
| - BlimpCompositorClient* client, |
| - bool use_threaded_layer_tree_host); |
| + static std::unique_ptr<BlimpCompositor> Create( |
| + BlimpCompositorDependencies* compositor_dependencies, |
| + BlimpCompositorClient* client, |
| + bool use_threaded_layer_tree_host); |
| ~BlimpCompositor() override; |
| @@ -107,8 +107,9 @@ class BlimpCompositor : public cc::LayerTreeHostClient, |
| // the compositor thread. |
| const base::WeakPtr<cc::InputHandler>& GetInputHandler(); |
| - private: |
| - friend class BlimpCompositorForTesting; |
| + cc::CompositorStateDeserializer* compositor_state_deserializer_for_testing() { |
| + return compositor_state_deserializer_.get(); |
| + } |
|
kuzminruslan
2016/10/30 13:18:40
perhaps forgotten private
Khushal
2016/10/31 23:00:27
I'm actually making it public because the tests ne
|
| // LayerTreeHostClient implementation. |
| void WillBeginMainFrame() override {} |
| @@ -120,7 +121,7 @@ class BlimpCompositor : public cc::LayerTreeHostClient, |
| const gfx::Vector2dF& outer_delta, |
| const gfx::Vector2dF& elastic_overscroll_delta, |
| float page_scale, |
| - float top_controls_delta) override {} |
| + float top_controls_delta) override; |
| void RequestNewCompositorFrameSink() override; |
| void DidInitializeCompositorFrameSink() override; |
| // TODO(khushalsagar): Need to handle context initialization failures. |
| @@ -131,6 +132,18 @@ class BlimpCompositor : public cc::LayerTreeHostClient, |
| void DidReceiveCompositorFrameAck() override {} |
| void DidCompletePageScaleAnimation() override {} |
| + // CompositorStateDeserializerClient implementation. |
| + void DidUpdateLocalState() override; |
| + |
| + protected: |
| + BlimpCompositor(BlimpCompositorDependencies* compositor_dependencies, |
| + BlimpCompositorClient* client, |
| + bool use_threaded_layer_tree_host); |
| + |
| + void Initialize(); |
| + virtual std::unique_ptr<cc::LayerTreeHostInProcess> CreateLayerTreeHost(); |
| + |
| + private: |
| // RemoteProtoChannel implementation. |
| void SetProtoReceiver(ProtoReceiver* receiver) override; |
| void SendCompositorProto(const cc::proto::CompositorMessage& proto) override; |
| @@ -145,11 +158,6 @@ class BlimpCompositor : public cc::LayerTreeHostClient, |
| void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
| void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override {} |
| - // CompositorStateDeserializerClient implementation. |
| - bool ShouldRetainClientScroll(int engine_layer_id, |
| - const gfx::ScrollOffset& new_offset) override; |
| - bool ShouldRetainClientPageScale(float new_page_scale) override; |
| - |
| void HandleCompositorMessageToImpl( |
| std::unique_ptr<cc::proto::CompositorMessage> message); |
| @@ -168,10 +176,6 @@ class BlimpCompositor : public cc::LayerTreeHostClient, |
| // RenderWidgetHostViewAndroid. |
| void DestroyDelegatedContent(); |
| - // Helper method to build the internal CC LayerTreeHost instance from |
| - // |message|. |
| - void CreateLayerTreeHost(); |
| - |
| // Helper method to destroy the internal CC LayerTreeHost instance and all its |
| // associated state. |
| void DestroyLayerTreeHost(); |
| @@ -185,9 +189,9 @@ class BlimpCompositor : public cc::LayerTreeHostClient, |
| // frame should be started. |
| void SubmitCompositorFrameAck(); |
| - // Called when the local copy of the layer with |engine_layer_id| on the |
| - // engine was scrolled on the compositor thread. |
| - void LayerScrolled(int engine_layer_id); |
| + // Sends an update to the engine if the state on the client was modified and |
| + // an ack for a previous update sent is not pending. |
| + void FlushClientState(); |
| // Set to true if we are using a LayerTreeHostInProcess to process frame |
| // updates from the engine. |
| @@ -199,7 +203,7 @@ class BlimpCompositor : public cc::LayerTreeHostClient, |
| cc::FrameSinkId frame_sink_id_; |
| - std::unique_ptr<cc::LayerTreeHost> host_; |
| + std::unique_ptr<cc::LayerTreeHostInProcess> host_; |
| // The SurfaceFactory is bound to the lifetime of the |proxy_client_|. When |
| // detached, the surface factory will be destroyed. |
| @@ -245,6 +249,14 @@ class BlimpCompositor : public cc::LayerTreeHostClient, |
| std::unique_ptr<cc::CompositorStateDeserializer> |
| compositor_state_deserializer_; |
| + // Set to true if the compositor state on the client was modified on the impl |
| + // thread and an update needs to be sent to the engine. |
| + bool client_state_dirty_ = false; |
| + |
| + // Set to true if a client state update was sent to the engine and an ack for |
| + // this update from the engine is pending. |
| + bool client_state_update_ack_pending_ = false; |
| + |
| base::WeakPtrFactory<BlimpCompositor> weak_ptr_factory_; |
| DISALLOW_COPY_AND_ASSIGN(BlimpCompositor); |