| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/renderer_host/offscreen_canvas_provider_impl.h" | 5 #include "content/browser/renderer_host/offscreen_canvas_provider_impl.h" |
| 6 | 6 |
| 7 #include "content/browser/compositor/surface_utils.h" | 7 #include "content/browser/compositor/surface_utils.h" |
| 8 #include "content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_m
anager.h" | 8 #include "content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_m
anager.h" |
| 9 #include "content/browser/renderer_host/offscreen_canvas_surface_impl.h" | 9 #include "content/browser/renderer_host/offscreen_canvas_surface_impl.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 OffscreenCanvasProviderImpl::OffscreenCanvasProviderImpl( | 13 OffscreenCanvasProviderImpl::OffscreenCanvasProviderImpl( |
| 14 uint32_t renderer_client_id) | 14 uint32_t renderer_client_id) |
| 15 : renderer_client_id_(renderer_client_id) {} | 15 : renderer_client_id_(renderer_client_id) {} |
| 16 | 16 |
| 17 OffscreenCanvasProviderImpl::~OffscreenCanvasProviderImpl() = default; | 17 OffscreenCanvasProviderImpl::~OffscreenCanvasProviderImpl() = default; |
| 18 | 18 |
| 19 void OffscreenCanvasProviderImpl::Add( | 19 void OffscreenCanvasProviderImpl::Add( |
| 20 blink::mojom::OffscreenCanvasProviderRequest request) { | 20 blink::mojom::OffscreenCanvasProviderRequest request) { |
| 21 bindings_.AddBinding(this, std::move(request)); | 21 bindings_.AddBinding(this, std::move(request)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void OffscreenCanvasProviderImpl::CreateOffscreenCanvasSurface( | 24 void OffscreenCanvasProviderImpl::CreateOffscreenCanvasSurface( |
| 25 const cc::FrameSinkId& parent_frame_sink_id, | 25 const cc::FrameSinkId& parent_frame_sink_id, |
| 26 const cc::FrameSinkId& frame_sink_id, | 26 const cc::FrameSinkId& frame_sink_id, |
| 27 cc::mojom::FrameSinkManagerClientPtr client, | 27 blink::mojom::OffscreenCanvasSurfaceClientPtr client, |
| 28 blink::mojom::OffscreenCanvasSurfaceRequest request) { | 28 blink::mojom::OffscreenCanvasSurfaceRequest request) { |
| 29 // TODO(kylechar): Kill the renderer too. | 29 // TODO(kylechar): Kill the renderer too. |
| 30 if (parent_frame_sink_id.client_id() != renderer_client_id_) { | 30 if (parent_frame_sink_id.client_id() != renderer_client_id_) { |
| 31 DLOG(ERROR) << "Invalid parent client id " << parent_frame_sink_id; | 31 DLOG(ERROR) << "Invalid parent client id " << parent_frame_sink_id; |
| 32 return; | 32 return; |
| 33 } | 33 } |
| 34 if (frame_sink_id.client_id() != renderer_client_id_) { | 34 if (frame_sink_id.client_id() != renderer_client_id_) { |
| 35 DLOG(ERROR) << "Invalid client id " << frame_sink_id; | 35 DLOG(ERROR) << "Invalid client id " << frame_sink_id; |
| 36 return; | 36 return; |
| 37 } | 37 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 56 if (!surface_impl) { | 56 if (!surface_impl) { |
| 57 DLOG(ERROR) << "No OffscreenCanvasSurfaceImpl for " << frame_sink_id; | 57 DLOG(ERROR) << "No OffscreenCanvasSurfaceImpl for " << frame_sink_id; |
| 58 return; | 58 return; |
| 59 } | 59 } |
| 60 | 60 |
| 61 surface_impl->CreateCompositorFrameSink(std::move(client), | 61 surface_impl->CreateCompositorFrameSink(std::move(client), |
| 62 std::move(request)); | 62 std::move(request)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace content | 65 } // namespace content |
| OLD | NEW |