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 #include "components/mus/surfaces/compositor_frame_sink_factory_impl.h" |
| 6 |
| 7 #include "base/memory/ptr_util.h" |
| 8 #include "cc/surfaces/surface_id.h" |
| 9 #include "components/mus/surfaces/compositor_frame_sink_impl.h" |
| 10 |
| 11 namespace mus { |
| 12 |
| 13 CompositorFrameSinkFactoryImpl::CompositorFrameSinkFactoryImpl( |
| 14 int client_id, |
| 15 mojo::InterfaceRequest<mojom::CompositorFrameSinkFactory> request, |
| 16 const scoped_refptr<SurfacesState>& surfaces_state) |
| 17 : client_id_(client_id), |
| 18 surfaces_state_(surfaces_state), |
| 19 allocator_(client_id), |
| 20 binding_(this, std::move(request)) {} |
| 21 |
| 22 CompositorFrameSinkFactoryImpl::~CompositorFrameSinkFactoryImpl() {} |
| 23 |
| 24 void CompositorFrameSinkFactoryImpl::CompositorFrameSinkConnectionLost( |
| 25 int sink_id) { |
| 26 sinks_.erase(sink_id); |
| 27 } |
| 28 |
| 29 cc::SurfaceId CompositorFrameSinkFactoryImpl::GenerateSurfaceId() { |
| 30 return allocator_.GenerateId(); |
| 31 } |
| 32 |
| 33 void CompositorFrameSinkFactoryImpl::CreateCompositorFrameSink( |
| 34 int sink_id, |
| 35 mojo::InterfaceRequest<mojom::CompositorFrameSink> sink, |
| 36 mojom::CompositorFrameSinkClientPtr client) { |
| 37 sinks_[sink_id] = base::WrapUnique(new CompositorFrameSinkImpl( |
| 38 this, sink_id, surfaces_state_, std::move(sink), std::move(client))); |
| 39 } |
| 40 |
| 41 } // namespace mus |
OLD | NEW |