| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_DISPLAY_COMPOSITOR_GPU_COMPOSITOR_FRAME_SINK_H_ | 5 #ifndef COMPONENTS_DISPLAY_COMPOSITOR_GPU_COMPOSITOR_FRAME_SINK_H_ |
| 6 #define COMPONENTS_DISPLAY_COMPOSITOR_GPU_COMPOSITOR_FRAME_SINK_H_ | 6 #define COMPONENTS_DISPLAY_COMPOSITOR_GPU_COMPOSITOR_FRAME_SINK_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "cc/ipc/display_compositor.mojom.h" | 13 #include "cc/ipc/display_compositor.mojom.h" |
| 14 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" | 14 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" |
| 15 #include "cc/surfaces/compositor_frame_sink_support.h" | 15 #include "cc/surfaces/compositor_frame_sink_support.h" |
| 16 #include "cc/surfaces/compositor_frame_sink_support_client.h" | 16 #include "cc/surfaces/compositor_frame_sink_support_client.h" |
| 17 #include "components/display_compositor/display_compositor_export.h" | 17 #include "components/display_compositor/display_compositor_export.h" |
| 18 #include "components/display_compositor/gpu_compositor_frame_sink_delegate.h" | 18 #include "components/display_compositor/gpu_compositor_frame_sink_delegate.h" |
| 19 #include "mojo/public/cpp/bindings/binding.h" | 19 #include "mojo/public/cpp/bindings/binding.h" |
| 20 | 20 |
| 21 namespace cc { | |
| 22 class Display; | |
| 23 } | |
| 24 | |
| 25 namespace display_compositor { | 21 namespace display_compositor { |
| 26 | 22 |
| 27 // Server side representation of a WindowSurface. | 23 // Server side representation of a WindowSurface. |
| 28 class DISPLAY_COMPOSITOR_EXPORT GpuCompositorFrameSink | 24 class DISPLAY_COMPOSITOR_EXPORT GpuCompositorFrameSink |
| 29 : public NON_EXPORTED_BASE(cc::CompositorFrameSinkSupportClient), | 25 : public NON_EXPORTED_BASE(cc::CompositorFrameSinkSupportClient), |
| 30 public NON_EXPORTED_BASE(cc::mojom::MojoCompositorFrameSink), | 26 public NON_EXPORTED_BASE(cc::mojom::MojoCompositorFrameSink), |
| 31 public NON_EXPORTED_BASE(cc::mojom::MojoCompositorFrameSinkPrivate) { | 27 public NON_EXPORTED_BASE(cc::mojom::MojoCompositorFrameSinkPrivate) { |
| 32 public: | 28 public: |
| 33 GpuCompositorFrameSink( | 29 GpuCompositorFrameSink( |
| 34 GpuCompositorFrameSinkDelegate* delegate, | 30 GpuCompositorFrameSinkDelegate* delegate, |
| 35 cc::SurfaceManager* surface_manager, | 31 std::unique_ptr<cc::CompositorFrameSinkSupport> support, |
| 36 const cc::FrameSinkId& frame_sink_id, | |
| 37 cc::Display* display, | |
| 38 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | 32 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, |
| 39 cc::mojom::MojoCompositorFrameSinkClientPtr client); | 33 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
| 40 | 34 |
| 41 ~GpuCompositorFrameSink() override; | 35 ~GpuCompositorFrameSink() override; |
| 42 | 36 |
| 43 // cc::mojom::MojoCompositorFrameSink: | 37 // cc::mojom::MojoCompositorFrameSink: |
| 44 void EvictFrame() override; | 38 void EvictFrame() override; |
| 45 void SetNeedsBeginFrame(bool needs_begin_frame) override; | 39 void SetNeedsBeginFrame(bool needs_begin_frame) override; |
| 46 void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, | 40 void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, |
| 47 cc::CompositorFrame frame) override; | 41 cc::CompositorFrame frame) override; |
| 48 void Require(const cc::LocalSurfaceId& local_surface_id, | 42 void Require(const cc::LocalSurfaceId& local_surface_id, |
| 49 const cc::SurfaceSequence& sequence) override; | 43 const cc::SurfaceSequence& sequence) override; |
| 50 void Satisfy(const cc::SurfaceSequence& sequence) override; | 44 void Satisfy(const cc::SurfaceSequence& sequence) override; |
| 51 | 45 |
| 52 // cc::mojom::MojoCompositorFrameSinkPrivate: | 46 // cc::mojom::MojoCompositorFrameSinkPrivate: |
| 53 void AddChildFrameSink(const cc::FrameSinkId& child_frame_sink_id) override; | 47 void AddChildFrameSink(const cc::FrameSinkId& child_frame_sink_id) override; |
| 54 void RemoveChildFrameSink( | 48 void RemoveChildFrameSink( |
| 55 const cc::FrameSinkId& child_frame_sink_id) override; | 49 const cc::FrameSinkId& child_frame_sink_id) override; |
| 56 | 50 |
| 57 protected: | 51 protected: |
| 58 void OnClientConnectionLost(); | 52 void OnClientConnectionLost(); |
| 59 void OnPrivateConnectionLost(); | 53 void OnPrivateConnectionLost(); |
| 60 | 54 |
| 61 GpuCompositorFrameSinkDelegate* const delegate_; | 55 GpuCompositorFrameSinkDelegate* const delegate_; |
| 62 cc::CompositorFrameSinkSupport support_; | 56 std::unique_ptr<cc::CompositorFrameSinkSupport> support_; |
| 63 cc::SurfaceManager* const surface_manager_; | |
| 64 | 57 |
| 65 private: | 58 private: |
| 66 // cc::CompositorFrameSinkSupportClient implementation: | 59 // cc::CompositorFrameSinkSupportClient implementation: |
| 67 void DidReceiveCompositorFrameAck() override; | 60 void DidReceiveCompositorFrameAck() override; |
| 68 void OnBeginFrame(const cc::BeginFrameArgs& args) override; | 61 void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
| 69 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | 62 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
| 70 void WillDrawSurface() override; | 63 void WillDrawSurface() override; |
| 71 | 64 |
| 72 | |
| 73 bool client_connection_lost_ = false; | 65 bool client_connection_lost_ = false; |
| 74 bool private_connection_lost_ = false; | 66 bool private_connection_lost_ = false; |
| 75 | 67 |
| 76 cc::mojom::MojoCompositorFrameSinkClientPtr client_; | 68 cc::mojom::MojoCompositorFrameSinkClientPtr client_; |
| 77 mojo::Binding<cc::mojom::MojoCompositorFrameSinkPrivate> | 69 mojo::Binding<cc::mojom::MojoCompositorFrameSinkPrivate> |
| 78 compositor_frame_sink_private_binding_; | 70 compositor_frame_sink_private_binding_; |
| 79 | 71 |
| 80 DISALLOW_COPY_AND_ASSIGN(GpuCompositorFrameSink); | 72 DISALLOW_COPY_AND_ASSIGN(GpuCompositorFrameSink); |
| 81 }; | 73 }; |
| 82 | 74 |
| 83 } // namespace display_compositor | 75 } // namespace display_compositor |
| 84 | 76 |
| 85 #endif // COMPONENTS_DISPLAY_COMPOSITOR_GPU_COMPOSITOR_FRAME_SINK_H_ | 77 #endif // COMPONENTS_DISPLAY_COMPOSITOR_GPU_COMPOSITOR_FRAME_SINK_H_ |
| OLD | NEW |