Chromium Code Reviews| Index: services/ui/ws/display_client_compositor_frame_sink.h |
| diff --git a/services/ui/ws/display_client_compositor_frame_sink.h b/services/ui/ws/display_client_compositor_frame_sink.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..843295a0a79c7b7c69661d234c529befab07d256 |
| --- /dev/null |
| +++ b/services/ui/ws/display_client_compositor_frame_sink.h |
| @@ -0,0 +1,72 @@ |
| +// 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_PUBLIC_CPP_DISPLAY_CLIENT_COMPOSITOR_FRAME_SINK_H_ |
| +#define SERVICES_UI_PUBLIC_CPP_DISPLAY_CLIENT_COMPOSITOR_FRAME_SINK_H_ |
| + |
| +#include "cc/ipc/display_compositor.mojom.h" |
| +#include "cc/ipc/mojo_compositor_frame_sink.mojom.h" |
| +#include "cc/output/compositor_frame_sink.h" |
| +#include "cc/scheduler/begin_frame_source.h" |
| +#include "cc/surfaces/local_surface_id.h" |
| +#include "cc/surfaces/local_surface_id_allocator.h" |
| +#include "mojo/public/cpp/bindings/binding.h" |
| +#include "ui/gfx/geometry/rect.h" |
|
msw
2017/03/10 20:08:40
optional nit: explicit include not needed (transit
Alex Z.
2017/03/11 03:52:20
Done.
|
| +#include "ui/gfx/native_widget_types.h" |
|
msw
2017/03/10 20:08:40
nit: not needed?
Alex Z.
2017/03/11 03:52:20
Done.
|
| + |
| +namespace base { |
| +class ThreadChecker; |
| +} // namespace base |
| + |
| +namespace ui { |
| +namespace ws { |
| + |
| +class DisplayClientCompositorFrameSink |
|
msw
2017/03/10 20:08:40
Add an explanatory class comment.
|
| + : public cc::CompositorFrameSink, |
| + public cc::mojom::MojoCompositorFrameSinkClient, |
| + public cc::ExternalBeginFrameSourceClient { |
| + public: |
| + DisplayClientCompositorFrameSink( |
| + const cc::FrameSinkId& frame_sink_id, |
| + cc::mojom::MojoCompositorFrameSinkAssociatedPtr compositor_frame_sink, |
| + cc::mojom::DisplayPrivateAssociatedPtr display_private, |
| + cc::mojom::MojoCompositorFrameSinkClientRequest client_request); |
| + |
| + ~DisplayClientCompositorFrameSink() override; |
| + |
| + // cc::CompositorFrameSink implementation. |
|
msw
2017/03/10 20:08:40
nit: be consistent about trailing period/colon
Alex Z.
2017/03/11 03:52:20
Done.
|
| + bool BindToClient(cc::CompositorFrameSinkClient* client) override; |
| + void DetachFromClient() override; |
| + void SubmitCompositorFrame(cc::CompositorFrame frame) override; |
| + |
| + private: |
| + // cc::mojom::MojoCompositorFrameSinkClient implementation: |
| + void DidReceiveCompositorFrameAck() override; |
| + void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_args) override; |
| + void ReclaimResources(const cc::ReturnedResourceArray& resources) override; |
| + void WillDrawSurface(const cc::LocalSurfaceId& local_surface_id, |
| + const gfx::Rect& damage_rect) override; |
| + |
| + // cc::ExternalBeginFrameSourceClient implementation: |
| + void OnNeedsBeginFrames(bool needs_begin_frame) override; |
| + void OnDidFinishFrame(const cc::BeginFrameAck& ack) override; |
| + |
| + gfx::Size last_submitted_frame_size_; |
|
msw
2017/03/10 20:08:40
nit: include size.h?
Alex Z.
2017/03/11 03:52:20
Done. But why do we need to include size.h but not
|
| + cc::LocalSurfaceId local_surface_id_; |
| + cc::LocalSurfaceIdAllocator id_allocator_; |
| + cc::mojom::MojoCompositorFrameSinkClientRequest client_request_; |
| + cc::mojom::MojoCompositorFrameSinkAssociatedPtr compositor_frame_sink_; |
| + mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> client_binding_; |
| + cc::mojom::DisplayPrivateAssociatedPtr display_private_; |
| + std::unique_ptr<base::ThreadChecker> thread_checker_; |
| + std::unique_ptr<cc::ExternalBeginFrameSource> begin_frame_source_; |
| + const cc::FrameSinkId frame_sink_id_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DisplayClientCompositorFrameSink); |
| +}; |
| + |
| +} // namspace ws |
| +} // namespace ui |
| + |
| +#endif // SERVICES_UI_PUBLIC_CPP_DISPLAY_CLIENT_COMPOSITOR_FRAME_SINK_H_ |