| 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>, |
| 36 const cc::FrameSinkId& frame_sink_id, | |
| 37 std::unique_ptr<cc::Display> display, | |
| 38 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, | |
| 39 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | 32 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, |
| 40 cc::mojom::MojoCompositorFrameSinkClientPtr client); | 33 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
| 41 | 34 |
| 42 ~GpuCompositorFrameSink() override; | 35 ~GpuCompositorFrameSink() override; |
| 43 | 36 |
| 44 // cc::mojom::MojoCompositorFrameSink: | 37 // cc::mojom::MojoCompositorFrameSink: |
| 45 void EvictFrame() override; | 38 void EvictFrame() override; |
| 46 void SetNeedsBeginFrame(bool needs_begin_frame) override; | 39 void SetNeedsBeginFrame(bool needs_begin_frame) override; |
| 47 void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, | 40 void SubmitCompositorFrame(const cc::LocalSurfaceId& local_surface_id, |
| 48 cc::CompositorFrame frame) override; | 41 cc::CompositorFrame frame) override; |
| 49 void Require(const cc::LocalSurfaceId& local_surface_id, | 42 void Require(const cc::LocalSurfaceId& local_surface_id, |
| 50 const cc::SurfaceSequence& sequence) override; | 43 const cc::SurfaceSequence& sequence) override; |
| 51 void Satisfy(const cc::SurfaceSequence& sequence) override; | 44 void Satisfy(const cc::SurfaceSequence& sequence) override; |
| 52 | 45 |
| 53 // cc::mojom::MojoCompositorFrameSinkPrivate: | 46 // cc::mojom::MojoCompositorFrameSinkPrivate: |
| 54 void AddChildFrameSink(const cc::FrameSinkId& child_frame_sink_id) override; | 47 void AddChildFrameSink(const cc::FrameSinkId& child_frame_sink_id) override; |
| 55 void RemoveChildFrameSink( | 48 void RemoveChildFrameSink( |
| 56 const cc::FrameSinkId& child_frame_sink_id) override; | 49 const cc::FrameSinkId& child_frame_sink_id) override; |
| 57 | 50 |
| 58 protected: | 51 protected: |
| 59 void OnClientConnectionLost(); | 52 void OnClientConnectionLost(); |
| 60 void OnPrivateConnectionLost(); | 53 void OnPrivateConnectionLost(); |
| 61 | 54 |
| 62 GpuCompositorFrameSinkDelegate* const delegate_; | 55 GpuCompositorFrameSinkDelegate* const delegate_; |
| 63 cc::CompositorFrameSinkSupport support_; | 56 std::unique_ptr<cc::CompositorFrameSinkSupport> support_; |
| 64 cc::SurfaceManager* const surface_manager_; | |
| 65 | 57 |
| 66 private: | 58 private: |
| 67 // cc::CompositorFrameSinkSupportClient implementation: | 59 // cc::CompositorFrameSinkSupportClient implementation: |
| 68 void DidReceiveCompositorFrameAck() override; | 60 void DidReceiveCompositorFrameAck() override; |
| 69 void OnBeginFrame(const cc::BeginFrameArgs& args) override; | 61 void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
| 70 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | 62 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
| 71 void WillDrawSurface() override; | 63 void WillDrawSurface() override; |
| 72 | 64 |
| 73 | |
| 74 bool client_connection_lost_ = false; | 65 bool client_connection_lost_ = false; |
| 75 bool private_connection_lost_ = false; | 66 bool private_connection_lost_ = false; |
| 76 | 67 |
| 77 cc::mojom::MojoCompositorFrameSinkClientPtr client_; | 68 cc::mojom::MojoCompositorFrameSinkClientPtr client_; |
| 78 mojo::Binding<cc::mojom::MojoCompositorFrameSinkPrivate> | 69 mojo::Binding<cc::mojom::MojoCompositorFrameSinkPrivate> |
| 79 compositor_frame_sink_private_binding_; | 70 compositor_frame_sink_private_binding_; |
| 80 | 71 |
| 81 DISALLOW_COPY_AND_ASSIGN(GpuCompositorFrameSink); | 72 DISALLOW_COPY_AND_ASSIGN(GpuCompositorFrameSink); |
| 82 }; | 73 }; |
| 83 | 74 |
| 84 } // namespace display_compositor | 75 } // namespace display_compositor |
| 85 | 76 |
| 86 #endif // COMPONENTS_DISPLAY_COMPOSITOR_GPU_COMPOSITOR_FRAME_SINK_H_ | 77 #endif // COMPONENTS_DISPLAY_COMPOSITOR_GPU_COMPOSITOR_FRAME_SINK_H_ |
| OLD | NEW |