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_frame_receiver_impl.h" | 5 #include "content/browser/renderer_host/offscreen_canvas_frame_receiver_impl.h" |
6 | 6 |
7 #include "cc/surfaces/surface.h" | 7 #include "cc/surfaces/surface.h" |
8 #include "cc/surfaces/surface_manager.h" | 8 #include "cc/surfaces/surface_manager.h" |
9 #include "content/browser/compositor/surface_utils.h" | 9 #include "content/browser/compositor/surface_utils.h" |
| 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
10 | 11 |
11 namespace content { | 12 namespace content { |
12 | 13 |
| 14 OffscreenCanvasFrameReceiverImpl::OffscreenCanvasFrameReceiverImpl() {} |
| 15 |
| 16 OffscreenCanvasFrameReceiverImpl::~OffscreenCanvasFrameReceiverImpl() {} |
| 17 |
13 // static | 18 // static |
14 void OffscreenCanvasFrameReceiverImpl::Create( | 19 void OffscreenCanvasFrameReceiverImpl::Create( |
15 mojo::InterfaceRequest<blink::mojom::OffscreenCanvasFrameReceiver> | 20 blink::mojom::OffscreenCanvasFrameReceiverRequest request) { |
16 request) { | 21 mojo::MakeStrongBinding(base::MakeUnique<OffscreenCanvasFrameReceiverImpl>(), |
17 // |binding_| will take ownership of OffscreenCanvasFrameReceiverImpl | 22 std::move(request)); |
18 new OffscreenCanvasFrameReceiverImpl(std::move(request)); | |
19 } | 23 } |
20 | 24 |
21 OffscreenCanvasFrameReceiverImpl::OffscreenCanvasFrameReceiverImpl( | |
22 mojo::InterfaceRequest<blink::mojom::OffscreenCanvasFrameReceiver> request) | |
23 : binding_(this, std::move(request)) {} | |
24 | |
25 OffscreenCanvasFrameReceiverImpl::~OffscreenCanvasFrameReceiverImpl() {} | |
26 | |
27 void OffscreenCanvasFrameReceiverImpl::SubmitCompositorFrame( | 25 void OffscreenCanvasFrameReceiverImpl::SubmitCompositorFrame( |
28 const cc::SurfaceId& surface_id, | 26 const cc::SurfaceId& surface_id, |
29 cc::CompositorFrame frame) { | 27 cc::CompositorFrame frame) { |
30 cc::Surface* surface = GetSurfaceManager()->GetSurfaceForId(surface_id); | 28 cc::Surface* surface = GetSurfaceManager()->GetSurfaceForId(surface_id); |
31 if (surface) { | 29 if (surface) { |
32 surface->QueueFrame(std::move(frame), base::Closure()); | 30 surface->QueueFrame(std::move(frame), base::Closure()); |
33 } | 31 } |
34 // If surface doet not exist, drop the frame. | 32 // If surface doet not exist, drop the frame. |
35 } | 33 } |
36 | 34 |
37 } // namespace content | 35 } // namespace content |
OLD | NEW |