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 namespace gpu { |
| 13 |
| 14 CompositorFrameSinkFactoryImpl::CompositorFrameSinkFactoryImpl( |
| 15 uint32_t client_id, |
| 16 mojo::InterfaceRequest<mojom::CompositorFrameSinkFactory> request, |
| 17 const scoped_refptr<SurfacesState>& surfaces_state) |
| 18 : client_id_(client_id), |
| 19 surfaces_state_(surfaces_state), |
| 20 allocator_(client_id), |
| 21 binding_(this, std::move(request)) {} |
| 22 |
| 23 CompositorFrameSinkFactoryImpl::~CompositorFrameSinkFactoryImpl() {} |
| 24 |
| 25 void CompositorFrameSinkFactoryImpl::CompositorFrameSinkConnectionLost( |
| 26 int local_id) { |
| 27 sinks_.erase(local_id); |
| 28 } |
| 29 |
| 30 cc::SurfaceId CompositorFrameSinkFactoryImpl::GenerateSurfaceId() { |
| 31 return allocator_.GenerateId(); |
| 32 } |
| 33 |
| 34 void CompositorFrameSinkFactoryImpl::CreateCompositorFrameSink( |
| 35 uint32_t local_id, |
| 36 uint64_t nonce, |
| 37 mojo::InterfaceRequest<mojom::CompositorFrameSink> sink, |
| 38 mojom::CompositorFrameSinkClientPtr client) { |
| 39 // TODO(fsamuel): Use nonce once patch lands: |
| 40 // https://codereview.chromium.org/1996783002/ |
| 41 sinks_[local_id] = base::WrapUnique(new CompositorFrameSinkImpl( |
| 42 this, local_id, surfaces_state_, std::move(sink), std::move(client))); |
| 43 } |
| 44 |
| 45 } // namespace gpu |
| 46 } // namespace mus |
OLD | NEW |