Chromium Code Reviews| Index: content/browser/frame_sink_provider_impl.cc |
| diff --git a/content/browser/frame_sink_provider_impl.cc b/content/browser/frame_sink_provider_impl.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5d984183906ed6a2e8f7608f2ed468f3d7323688 |
| --- /dev/null |
| +++ b/content/browser/frame_sink_provider_impl.cc |
| @@ -0,0 +1,37 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| +#include "content/browser/frame_sink_provider_impl.h" |
| +#include "content/browser/renderer_host/render_widget_host_impl.h" |
| + |
| +namespace content { |
| + |
| +FrameSinkProviderImpl::FrameSinkProviderImpl(int32_t process_id) |
| + : process_id_(process_id), binding_(this) {} |
| + |
| +FrameSinkProviderImpl::~FrameSinkProviderImpl() = default; |
| + |
| +void FrameSinkProviderImpl::Bind(mojom::FrameSinkProviderRequest request) { |
| + if (binding_.is_bound()) { |
|
Fady Samuel
2017/04/10 02:28:37
Should this be a DCHECK instead or can a malicious
Saman Sami
2017/04/10 02:37:47
Since the request comes from the renderer, I think
|
| + LOG(ERROR) << "Received multiple requests for FrameSinkProvider. " |
| + << "There should be only one instance per renderer."; |
| + return; |
| + } |
| + binding_.Bind(std::move(request)); |
| +} |
| + |
| +void FrameSinkProviderImpl::CreateForWidget( |
| + int32_t widget_id, |
|
Fady Samuel
2017/04/10 02:28:37
routing ID right?
Saman Sami
2017/04/10 02:37:47
Those two are basically synonymous (I'm pretty sur
|
| + cc::mojom::MojoCompositorFrameSinkRequest request, |
| + cc::mojom::MojoCompositorFrameSinkClientPtr client) { |
| + RenderWidgetHostImpl* render_widget_host_impl = |
| + RenderWidgetHostImpl::FromID(process_id_, widget_id); |
| + if (!render_widget_host_impl) { |
| + LOG(ERROR) << "No RenderWidgetHost exists with id " << widget_id; |
| + return; |
| + } |
| + render_widget_host_impl->RequestMojoCompositorFrameSink(std::move(request), |
| + std::move(client)); |
| +} |
| + |
| +} // namespace content |