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..39450c67a5929798468c7635e9843426b271df4b |
| --- /dev/null |
| +++ b/services/ui/ws/compositor_frame_sink_client_binding.h |
| @@ -0,0 +1,59 @@ |
| +// 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. |
| +class CompositorFrameSinkClientBinding { |
|
Fady Samuel
2017/05/18 17:03:57
Back to my earlier question. Maybe this can implem
Alex Z.
2017/05/18 17:36:19
Yes, I'm working on it.
Alex Z.
2017/05/18 18:00:34
Done.
|
| + public: |
| + virtual ~CompositorFrameSinkClientBinding() = default; |
| + |
| + virtual void SetNeedsBeginFrame(bool needs_begin_frame) = 0; |
| + virtual void SubmitCompositorFrame(cc::CompositorFrame frame) = 0; |
| + virtual void BeginFrameDidNotSwap(const cc::BeginFrameAck& ack) = 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; |
| + void BeginFrameDidNotSwap(const cc::BeginFrameAck& ack) 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_ |