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