OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_MUS_SURFACES_COMPOSITOR_FRAME_SINK_IMPL_H_ |
| 6 #define COMPONENTS_MUS_SURFACES_COMPOSITOR_FRAME_SINK_IMPL_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "cc/scheduler/begin_frame_source.h" |
| 10 #include "cc/surfaces/surface_factory.h" |
| 11 #include "cc/surfaces/surface_factory_client.h" |
| 12 #include "cc/surfaces/surface_id.h" |
| 13 #include "components/mus/public/interfaces/display_compositor.mojom.h" |
| 14 #include "components/mus/surfaces/surfaces_state.h" |
| 15 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 16 |
| 17 namespace mus { |
| 18 |
| 19 class CompositorFrameSinkDelegate; |
| 20 |
| 21 // A client presents visuals to screen by submitting CompositorFrames to a |
| 22 // CompositorFrameSink. |
| 23 class CompositorFrameSinkImpl : public cc::SurfaceFactoryClient, |
| 24 public mojom::CompositorFrameSink, |
| 25 public cc::BeginFrameObserver { |
| 26 public: |
| 27 CompositorFrameSinkImpl( |
| 28 CompositorFrameSinkDelegate* delegate, |
| 29 int sink_id, |
| 30 const scoped_refptr<SurfacesState>& surfaces_state, |
| 31 mojo::InterfaceRequest<mojom::CompositorFrameSink> request, |
| 32 mojom::CompositorFrameSinkClientPtr client); |
| 33 ~CompositorFrameSinkImpl() override; |
| 34 |
| 35 // mojom::CompositorFrameSink implementation. |
| 36 void SetNeedsBeginFrame(bool needs_begin_frame) override; |
| 37 void SubmitCompositorFrame( |
| 38 mojom::CompositorFramePtr frame, |
| 39 const SubmitCompositorFrameCallback& callback) override; |
| 40 |
| 41 private: |
| 42 // SurfaceFactoryClient implementation. |
| 43 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
| 44 void WillDrawSurface(cc::SurfaceId surface_id, |
| 45 const gfx::Rect& damage_rect) override; |
| 46 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
| 47 |
| 48 // BeginFrameObserver implementation. |
| 49 void OnBeginFrame(const cc::BeginFrameArgs& args) override; |
| 50 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; |
| 51 void OnBeginFrameSourcePausedChanged(bool paused) override; |
| 52 |
| 53 void OnConnectionLost(); |
| 54 |
| 55 CompositorFrameSinkDelegate* const delegate_; |
| 56 scoped_refptr<SurfacesState> surfaces_state_; |
| 57 const int sink_id_; |
| 58 cc::BeginFrameSource* begin_frame_source_; |
| 59 bool needs_begin_frame_; |
| 60 cc::BeginFrameArgs last_used_begin_frame_args_; |
| 61 cc::SurfaceFactory factory_; |
| 62 cc::SurfaceId surface_id_; |
| 63 gfx::Size last_submitted_frame_size_; |
| 64 mojom::CompositorFrameSinkClientPtr client_; |
| 65 mojo::Binding<mojom::CompositorFrameSink> binding_; |
| 66 |
| 67 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkImpl); |
| 68 }; |
| 69 |
| 70 } // namespace mus |
| 71 |
| 72 #endif // COMPONENTS_MUS_SURFACES_COMPOSITOR_FRAME_SINK_IMPL_H_ |
OLD | NEW |