Chromium Code Reviews| Index: services/ui/ws/compositor_frame_sink_client_binding.h |
| diff --git a/services/ui/ws/compositor_frame_sink_client_binding.h b/services/ui/ws/compositor_frame_sink_client_binding.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3d1b76fda415e1d4b9e2b529451487e3b160bd95 |
| --- /dev/null |
| +++ b/services/ui/ws/compositor_frame_sink_client_binding.h |
| @@ -0,0 +1,58 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef SERVICES_UI_WS_COMPOSITOR_FRAME_SINK_CLIENT_BINDING_H_ |
| +#define SERVICES_UI_WS_COMPOSITOR_FRAME_SINK_CLIENT_BINDING_H_ |
| + |
| +#include "base/macros.h" |
| +#include "cc/ipc/frame_sink_manager.mojom.h" |
| +#include "cc/ipc/mojo_compositor_frame_sink.mojom.h" |
| +#include "cc/surfaces/local_surface_id_allocator.h" |
| +#include "mojo/public/cpp/bindings/binding.h" |
| + |
| +namespace ui { |
| +namespace ws { |
| + |
| +// CompositorFrameSinkClientBinding manages the binding between a FrameGenerator |
| +// and its MojoCompositorFrameSink. CompositorFrameSinkClientBinding exists so |
| +// that a mock implementation of MojoCompositorFrameSink can be injected for |
| +// tests. FrameGenerator owns its associated CompositorFrameSinkClientBinding. |
| +// TODO(staraz): DisplayClientCompositorFrameSink implements |
| +// CompositorFrameSinkClientBinding |
| +class CompositorFrameSinkClientBinding { |
|
Fady Samuel
2017/05/17 20:33:04
What if this implements cc::mojom::MojoCompositorF
Alex Z.
2017/05/17 20:52:01
Would it be weird if there is a MojoCFS implementa
Alex Z.
2017/05/17 21:20:24
A few more concerns:
ClientBinding starts to seem
Fady Samuel
2017/05/18 11:55:27
Not at all. The InterfacePtr probably also impleme
Fady Samuel
2017/05/18 11:55:27
Yea, we store the LocalSurfaceId in both places (c
|
| + public: |
| + virtual ~CompositorFrameSinkClientBinding() = default; |
| + virtual void SubmitCompositorFrame(cc::CompositorFrame frame) = 0; |
| + virtual void SetNeedsBeginFrame(bool needs_begin_frame) = 0; |
| +}; |
| + |
| +// Bindings implementation of CompositorFrameSinkClientBinding. |
| +class DefaultCompositorFrameSinkClientBinding |
| + : public CompositorFrameSinkClientBinding { |
| + public: |
| + DefaultCompositorFrameSinkClientBinding( |
| + cc::mojom::MojoCompositorFrameSinkClient* sink_client, |
| + cc::mojom::MojoCompositorFrameSinkClientRequest sink_client_request, |
| + cc::mojom::MojoCompositorFrameSinkAssociatedPtr compositor_frame_sink, |
| + cc::mojom::DisplayPrivateAssociatedPtr display_private); |
| + ~DefaultCompositorFrameSinkClientBinding() override; |
| + |
| + // CompositorFrameSinkClientBinding implementation: |
| + void SubmitCompositorFrame(cc::CompositorFrame frame) override; |
| + void SetNeedsBeginFrame(bool needs_begin_frame) override; |
| + |
| + private: |
| + mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_; |
| + cc::mojom::DisplayPrivateAssociatedPtr display_private_; |
| + cc::mojom::MojoCompositorFrameSinkAssociatedPtr compositor_frame_sink_; |
| + cc::LocalSurfaceId local_surface_id_; |
| + cc::LocalSurfaceIdAllocator id_allocator_; |
| + gfx::Size last_submitted_frame_size_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DefaultCompositorFrameSinkClientBinding); |
| +}; |
| +} |
| +} |
| + |
| +#endif // SERVICES_UI_WS_COMPOSITOR_FRAME_SINK_CLIENT_BINDING_H_ |