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_FACTORY_IMPL_H_ |
| 6 #define COMPONENTS_MUS_SURFACES_COMPOSITOR_FRAME_SINK_FACTORY_IMPL_H_ |
| 7 |
| 8 #include "cc/surfaces/surface_id_allocator.h" |
| 9 #include "components/mus/public/interfaces/gpu/display_compositor.mojom.h" |
| 10 #include "components/mus/surfaces/compositor_frame_sink_delegate.h" |
| 11 #include "components/mus/surfaces/surfaces_state.h" |
| 12 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 13 |
| 14 namespace mus { |
| 15 namespace gpu { |
| 16 |
| 17 class CompositorFrameSinkImpl; |
| 18 |
| 19 class CompositorFrameSinkFactoryImpl : public mojom::CompositorFrameSinkFactory, |
| 20 public CompositorFrameSinkDelegate { |
| 21 public: |
| 22 CompositorFrameSinkFactoryImpl( |
| 23 uint32_t client_id, |
| 24 mojo::InterfaceRequest<mojom::CompositorFrameSinkFactory> request, |
| 25 const scoped_refptr<SurfacesState>& surfaces_state); |
| 26 ~CompositorFrameSinkFactoryImpl() override; |
| 27 |
| 28 uint32_t client_id() const { return client_id_; } |
| 29 |
| 30 void CompositorFrameSinkConnectionLost(int local_id) override; |
| 31 cc::SurfaceId GenerateSurfaceId() override; |
| 32 |
| 33 // mojom::CompositorFrameSinkFactory implementation. |
| 34 void CreateCompositorFrameSink( |
| 35 uint32_t local_id, |
| 36 uint64_t nonce, |
| 37 mojo::InterfaceRequest<mojom::CompositorFrameSink> sink, |
| 38 mojom::CompositorFrameSinkClientPtr client) override; |
| 39 |
| 40 private: |
| 41 const uint32_t client_id_; |
| 42 scoped_refptr<SurfacesState> surfaces_state_; |
| 43 cc::SurfaceIdAllocator allocator_; |
| 44 using CompositorFrameSinkMap = |
| 45 std::map<uint32_t, std::unique_ptr<CompositorFrameSinkImpl>>; |
| 46 CompositorFrameSinkMap sinks_; |
| 47 mojo::StrongBinding<mojom::CompositorFrameSinkFactory> binding_; |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkFactoryImpl); |
| 50 }; |
| 51 |
| 52 } // namespace gpu |
| 53 } // namespace mus |
| 54 |
| 55 #endif // COMPONENTS_MUS_SURFACES_COMPOSITOR_FRAME_SINK_FACTORY_IMPL_H_ |
OLD | NEW |