Chromium Code Reviews| 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 SERVICES_UI_SURFACES_GPU_COMPOSITOR_FRAME_SINK_H_ | 5 #ifndef SERVICES_UI_SURFACES_GPU_COMPOSITOR_FRAME_SINK_H_ |
| 6 #define SERVICES_UI_SURFACES_GPU_COMPOSITOR_FRAME_SINK_H_ | 6 #define SERVICES_UI_SURFACES_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/mojo_compositor_frame_sink.mojom.h" | 14 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h" |
| 14 #include "cc/surfaces/compositor_frame_sink_support.h" | 15 #include "cc/surfaces/compositor_frame_sink_support.h" |
| 15 #include "cc/surfaces/compositor_frame_sink_support_client.h" | 16 #include "cc/surfaces/compositor_frame_sink_support_client.h" |
| 16 #include "mojo/public/cpp/bindings/binding.h" | 17 #include "mojo/public/cpp/bindings/binding.h" |
| 18 #include "ui/gfx/color_space.h" | |
|
Fady Samuel
2016/12/16 17:18:19
Forward declaration preferred.
Alex Z.
2016/12/19 19:27:47
Done.
| |
| 19 #include "ui/gfx/geometry/size.h" | |
|
Fady Samuel
2016/12/16 17:18:19
Forward declaration preferred.
Alex Z.
2016/12/19 19:27:47
Done.
| |
| 20 #include "ui/gfx/mojo/color_space.mojom.h" | |
|
Fady Samuel
2016/12/16 17:18:19
Forward declaration preferred.
Alex Z.
2016/12/19 19:27:47
Done.
| |
| 17 | 21 |
| 18 namespace cc { | 22 namespace cc { |
| 19 class Display; | 23 class Display; |
| 20 } | 24 } |
| 21 | 25 |
| 22 namespace ui { | 26 namespace ui { |
| 23 | 27 |
| 24 class DisplayCompositor; | 28 class DisplayCompositor; |
| 25 | 29 |
| 26 // Server side representation of a WindowSurface. | 30 // Server side representation of a WindowSurface. |
| 27 class GpuCompositorFrameSink | 31 class GpuCompositorFrameSink : public cc::CompositorFrameSinkSupportClient, |
|
kylechar
2016/12/16 17:08:32
Just thinking out loud here but there is the norma
sadrul
2016/12/16 17:12:05
+1
| |
| 28 : public cc::CompositorFrameSinkSupportClient, | 32 public cc::mojom::MojoCompositorFrameSink, |
| 29 public cc::mojom::MojoCompositorFrameSink, | 33 public cc::mojom::MojoCompositorFrameSinkPrivate, |
| 30 public cc::mojom::MojoCompositorFrameSinkPrivate { | 34 public cc::mojom::DisplayPrivate { |
| 31 public: | 35 public: |
| 32 GpuCompositorFrameSink( | 36 GpuCompositorFrameSink( |
| 33 DisplayCompositor* display_compositor, | 37 DisplayCompositor* display_compositor, |
| 34 const cc::FrameSinkId& frame_sink_id, | 38 const cc::FrameSinkId& frame_sink_id, |
| 35 std::unique_ptr<cc::Display> display, | 39 std::unique_ptr<cc::Display> display, |
| 36 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, | 40 std::unique_ptr<cc::BeginFrameSource> begin_frame_source, |
| 37 cc::mojom::MojoCompositorFrameSinkRequest request, | 41 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 38 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, | 42 cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request, |
| 39 cc::mojom::MojoCompositorFrameSinkClientPtr client); | 43 cc::mojom::MojoCompositorFrameSinkClientPtr client, |
| 44 cc::mojom::DisplayPrivateRequest display_request); | |
| 40 | 45 |
| 41 ~GpuCompositorFrameSink() override; | 46 ~GpuCompositorFrameSink() override; |
| 42 | 47 |
| 43 // cc::mojom::MojoCompositorFrameSink: | 48 // cc::mojom::MojoCompositorFrameSink: |
| 44 void EvictFrame() override; | 49 void EvictFrame() override; |
| 45 void SetNeedsBeginFrame(bool needs_begin_frame) override; | 50 void SetNeedsBeginFrame(bool needs_begin_frame) override; |
| 46 void SubmitCompositorFrame(const cc::LocalFrameId& local_frame_id, | 51 void SubmitCompositorFrame(const cc::LocalFrameId& local_frame_id, |
| 47 cc::CompositorFrame frame) override; | 52 cc::CompositorFrame frame) override; |
| 48 void AddSurfaceReferences( | 53 void AddSurfaceReferences( |
| 49 const std::vector<cc::SurfaceReference>& references) override; | 54 const std::vector<cc::SurfaceReference>& references) override; |
| 50 void RemoveSurfaceReferences( | 55 void RemoveSurfaceReferences( |
| 51 const std::vector<cc::SurfaceReference>& references) override; | 56 const std::vector<cc::SurfaceReference>& references) override; |
| 52 void Require(const cc::LocalFrameId& local_frame_id, | 57 void Require(const cc::LocalFrameId& local_frame_id, |
| 53 const cc::SurfaceSequence& sequence) override; | 58 const cc::SurfaceSequence& sequence) override; |
| 54 void Satisfy(const cc::SurfaceSequence& sequence) override; | 59 void Satisfy(const cc::SurfaceSequence& sequence) override; |
| 55 | 60 |
| 56 // cc::mojom::MojoCompositorFrameSinkPrivate: | 61 // cc::mojom::MojoCompositorFrameSinkPrivate: |
| 57 void AddChildFrameSink(const cc::FrameSinkId& child_frame_sink_id) override; | 62 void AddChildFrameSink(const cc::FrameSinkId& child_frame_sink_id) override; |
| 58 void RemoveChildFrameSink( | 63 void RemoveChildFrameSink( |
| 59 const cc::FrameSinkId& child_frame_sink_id) override; | 64 const cc::FrameSinkId& child_frame_sink_id) override; |
| 60 | 65 |
| 66 // cc::mojom::DisplayPrivate: | |
| 67 void SetDisplayVisible(bool visible) override; | |
| 68 void ResizeDisplay(const gfx::Size& size) override; | |
| 69 void SetDisplayColorSpace(const gfx::ColorSpace& color_space) override; | |
| 70 void SetOutputIsSecure(bool secure) override; | |
| 71 | |
| 61 private: | 72 private: |
| 62 // cc::CompositorFrameSinkSupportClient implementation: | 73 // cc::CompositorFrameSinkSupportClient implementation: |
| 63 void DidReceiveCompositorFrameAck() override; | 74 void DidReceiveCompositorFrameAck() override; |
| 64 void OnBeginFrame(const cc::BeginFrameArgs& args) override; | 75 void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
| 65 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; | 76 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
| 66 void WillDrawSurface() override; | 77 void WillDrawSurface() override; |
| 67 | 78 |
| 68 void OnClientConnectionLost(); | 79 void OnClientConnectionLost(); |
| 69 void OnPrivateConnectionLost(); | 80 void OnPrivateConnectionLost(); |
| 70 | 81 |
| 71 DisplayCompositor* const display_compositor_; | 82 DisplayCompositor* const display_compositor_; |
| 72 | 83 |
| 73 cc::CompositorFrameSinkSupport support_; | 84 cc::CompositorFrameSinkSupport support_; |
| 74 | 85 |
| 75 bool client_connection_lost_ = false; | 86 bool client_connection_lost_ = false; |
| 76 bool private_connection_lost_ = false; | 87 bool private_connection_lost_ = false; |
| 77 | 88 |
| 78 cc::mojom::MojoCompositorFrameSinkClientPtr client_; | 89 cc::mojom::MojoCompositorFrameSinkClientPtr client_; |
| 79 mojo::Binding<cc::mojom::MojoCompositorFrameSink> binding_; | 90 mojo::Binding<cc::mojom::MojoCompositorFrameSink> binding_; |
| 80 mojo::Binding<cc::mojom::MojoCompositorFrameSinkPrivate> private_binding_; | 91 mojo::Binding<cc::mojom::MojoCompositorFrameSinkPrivate> private_binding_; |
| 92 mojo::Binding<cc::mojom::DisplayPrivate> display_binding_; | |
| 81 | 93 |
| 82 DISALLOW_COPY_AND_ASSIGN(GpuCompositorFrameSink); | 94 DISALLOW_COPY_AND_ASSIGN(GpuCompositorFrameSink); |
| 83 }; | 95 }; |
| 84 | 96 |
| 85 } // namespace ui | 97 } // namespace ui |
| 86 | 98 |
| 87 #endif // SERVICES_UI_SURFACES_GPU_COMPOSITOR_FRAME_SINK_H_ | 99 #endif // SERVICES_UI_SURFACES_GPU_COMPOSITOR_FRAME_SINK_H_ |
| OLD | NEW |