| 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 ff7bb03827ea8f7d2f391d4f7fc6cbcd6d7427cd..974f4a291853f5bbf79bb64dc29e6292e6f06dcb 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,11 +34,10 @@ namespace proto {
|
| class CompositorMessage;
|
| } // namespace proto
|
|
|
| -class CompositorStateDeserializer;
|
| class ContextProvider;
|
| class CopyOutputRequest;
|
| class Layer;
|
| -class LayerTreeHost;
|
| +class LayerTreeHostInProcess;
|
| class LayerTreeSettings;
|
| class LocalFrameid;
|
| class Surface;
|
| @@ -83,13 +82,15 @@ 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;
|
|
|
| - virtual void SetVisible(bool visible);
|
| + void SetVisible(bool visible);
|
| + bool IsVisible() const;
|
|
|
| // Requests a copy of the compositor frame.
|
| // Setting |flush_pending_update| to true ensures that if a frame update on
|
| @@ -101,7 +102,7 @@ class BlimpCompositor : public cc::LayerTreeHostClient,
|
| // Called to forward the compositor message from the remote server
|
| // LayerTreeHost of the render widget for this compositor.
|
| // virtual for testing.
|
| - virtual void OnCompositorMessageReceived(
|
| + void OnCompositorMessageReceived(
|
| std::unique_ptr<cc::proto::CompositorMessage> message);
|
|
|
| scoped_refptr<cc::Layer> layer() const { return layer_; }
|
| @@ -110,9 +111,11 @@ class BlimpCompositor : public cc::LayerTreeHostClient,
|
| // the compositor thread.
|
| const base::WeakPtr<cc::InputHandler>& GetInputHandler();
|
|
|
| - private:
|
| - friend class BlimpCompositorForTesting;
|
| - class FrameTrackingSwapPromise;
|
| + cc::CompositorStateDeserializer* compositor_state_deserializer_for_testing() {
|
| + return compositor_state_deserializer_.get();
|
| + }
|
| +
|
| + bool HasPendingFrameUpdateFromEngine() const;
|
|
|
| // LayerTreeHostClient implementation.
|
| void WillBeginMainFrame() override {}
|
| @@ -124,7 +127,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.
|
| @@ -135,6 +138,20 @@ 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:
|
| + class FrameTrackingSwapPromise;
|
| +
|
| // RemoteProtoChannel implementation.
|
| void SetProtoReceiver(ProtoReceiver* receiver) override;
|
| void SendCompositorProto(const cc::proto::CompositorMessage& proto) override;
|
| @@ -149,11 +166,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);
|
|
|
| @@ -172,10 +184,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();
|
| @@ -184,9 +192,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.
|
| @@ -204,7 +212,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.
|
| @@ -255,6 +263,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);
|
|
|