| OLD | NEW |
| (Empty) |
| 1 // Copyright 2017 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 #include "content/browser/renderer_host/frame_sink_provider_impl.h" | |
| 5 #include "content/browser/renderer_host/render_widget_host_impl.h" | |
| 6 | |
| 7 namespace content { | |
| 8 | |
| 9 FrameSinkProviderImpl::FrameSinkProviderImpl(int32_t process_id) | |
| 10 : process_id_(process_id), binding_(this) {} | |
| 11 | |
| 12 FrameSinkProviderImpl::~FrameSinkProviderImpl() = default; | |
| 13 | |
| 14 void FrameSinkProviderImpl::Bind(mojom::FrameSinkProviderRequest request) { | |
| 15 if (binding_.is_bound()) { | |
| 16 DLOG(ERROR) << "Received multiple requests for FrameSinkProvider. " | |
| 17 << "There should be only one instance per renderer."; | |
| 18 return; | |
| 19 } | |
| 20 binding_.Bind(std::move(request)); | |
| 21 } | |
| 22 | |
| 23 void FrameSinkProviderImpl::Unbind() { | |
| 24 binding_.Close(); | |
| 25 } | |
| 26 | |
| 27 void FrameSinkProviderImpl::CreateForWidget( | |
| 28 int32_t widget_id, | |
| 29 cc::mojom::MojoCompositorFrameSinkRequest request, | |
| 30 cc::mojom::MojoCompositorFrameSinkClientPtr client) { | |
| 31 RenderWidgetHostImpl* render_widget_host_impl = | |
| 32 RenderWidgetHostImpl::FromID(process_id_, widget_id); | |
| 33 if (!render_widget_host_impl) { | |
| 34 DLOG(ERROR) << "No RenderWidgetHost exists with id " << widget_id | |
| 35 << "in process " << process_id_; | |
| 36 return; | |
| 37 } | |
| 38 render_widget_host_impl->RequestMojoCompositorFrameSink(std::move(request), | |
| 39 std::move(client)); | |
| 40 } | |
| 41 | |
| 42 } // namespace content | |
| OLD | NEW |