| 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_compositor_frame_sink.h
" | 5 #include "content/browser/renderer_host/offscreen_canvas_compositor_frame_sink.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 #include "mojo/public/cpp/bindings/strong_binding.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 mojo::MakeStrongBinding(base::MakeUnique<OffscreenCanvasCompositorFrameSink>( | 38 mojo::MakeStrongBinding(base::MakeUnique<OffscreenCanvasCompositorFrameSink>( |
| 39 surface_id, std::move(client)), | 39 surface_id, std::move(client)), |
| 40 std::move(request)); | 40 std::move(request)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 void OffscreenCanvasCompositorFrameSink::SubmitCompositorFrame( | 43 void OffscreenCanvasCompositorFrameSink::SubmitCompositorFrame( |
| 44 cc::CompositorFrame frame, | 44 cc::CompositorFrame frame, |
| 45 const SubmitCompositorFrameCallback& callback) { | 45 const SubmitCompositorFrameCallback& callback) { |
| 46 if (!surface_factory_) { | 46 if (!surface_factory_) { |
| 47 cc::SurfaceManager* manager = GetSurfaceManager(); | 47 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 48 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>(manager, this); | 48 surface_factory_ = base::MakeUnique<cc::SurfaceFactory>( |
| 49 surface_id_.frame_sink_id(), manager, this); |
| 49 surface_factory_->Create(surface_id_); | 50 surface_factory_->Create(surface_id_); |
| 50 | 51 |
| 51 manager->RegisterFrameSinkId(surface_id_.frame_sink_id()); | 52 manager->RegisterFrameSinkId(surface_id_.frame_sink_id()); |
| 52 } | 53 } |
| 53 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), | 54 surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), |
| 54 callback); | 55 callback); |
| 55 } | 56 } |
| 56 | 57 |
| 57 void OffscreenCanvasCompositorFrameSink::SetNeedsBeginFrame( | 58 void OffscreenCanvasCompositorFrameSink::SetNeedsBeginFrame( |
| 58 bool needs_begin_frame) { | 59 bool needs_begin_frame) { |
| 59 NOTIMPLEMENTED(); | 60 NOTIMPLEMENTED(); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void OffscreenCanvasCompositorFrameSink::ReturnResources( | 63 void OffscreenCanvasCompositorFrameSink::ReturnResources( |
| 63 const cc::ReturnedResourceArray& resources) { | 64 const cc::ReturnedResourceArray& resources) { |
| 64 client_->ReturnResources(resources); | 65 client_->ReturnResources(resources); |
| 65 } | 66 } |
| 66 | 67 |
| 67 void OffscreenCanvasCompositorFrameSink::WillDrawSurface( | 68 void OffscreenCanvasCompositorFrameSink::WillDrawSurface( |
| 68 const cc::SurfaceId& id, | 69 const cc::SurfaceId& id, |
| 69 const gfx::Rect& damage_rect) {} | 70 const gfx::Rect& damage_rect) {} |
| 70 | 71 |
| 71 void OffscreenCanvasCompositorFrameSink::SetBeginFrameSource( | 72 void OffscreenCanvasCompositorFrameSink::SetBeginFrameSource( |
| 72 cc::BeginFrameSource* begin_frame_source) {} | 73 cc::BeginFrameSource* begin_frame_source) {} |
| 73 | 74 |
| 74 } // namespace content | 75 } // namespace content |
| OLD | NEW |