| 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_surface_impl.h" | 5 #include "content/browser/renderer_host/offscreen_canvas_surface_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "cc/surfaces/surface.h" | 11 #include "cc/surfaces/surface.h" |
| 12 #include "cc/surfaces/surface_manager.h" | 12 #include "cc/surfaces/surface_manager.h" |
| 13 #include "content/browser/compositor/surface_utils.h" | 13 #include "content/browser/compositor/surface_utils.h" |
| 14 #include "content/browser/renderer_host/offscreen_canvas_surface_manager.h" | 14 #include "content/browser/renderer_host/offscreen_canvas_compositor_frame_sink_m
anager.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 OffscreenCanvasSurfaceImpl::OffscreenCanvasSurfaceImpl( | 19 OffscreenCanvasSurfaceImpl::OffscreenCanvasSurfaceImpl( |
| 20 const cc::FrameSinkId& parent_frame_sink_id, | 20 const cc::FrameSinkId& parent_frame_sink_id, |
| 21 const cc::FrameSinkId& frame_sink_id, | 21 const cc::FrameSinkId& frame_sink_id, |
| 22 cc::mojom::DisplayCompositorClientPtr client) | 22 cc::mojom::DisplayCompositorClientPtr client) |
| 23 : client_(std::move(client)), | 23 : client_(std::move(client)), |
| 24 frame_sink_id_(frame_sink_id), | 24 frame_sink_id_(frame_sink_id), |
| 25 parent_frame_sink_id_(parent_frame_sink_id) { | 25 parent_frame_sink_id_(parent_frame_sink_id) { |
| 26 OffscreenCanvasSurfaceManager::GetInstance() | 26 OffscreenCanvasCompositorFrameSinkManager::GetInstance() |
| 27 ->RegisterOffscreenCanvasSurfaceInstance(frame_sink_id_, this); | 27 ->RegisterOffscreenCanvasSurfaceInstance(frame_sink_id_, this); |
| 28 } | 28 } |
| 29 | 29 |
| 30 OffscreenCanvasSurfaceImpl::~OffscreenCanvasSurfaceImpl() { | 30 OffscreenCanvasSurfaceImpl::~OffscreenCanvasSurfaceImpl() { |
| 31 if (frame_sink_id_.is_valid()) { | 31 if (frame_sink_id_.is_valid()) { |
| 32 OffscreenCanvasSurfaceManager::GetInstance() | 32 OffscreenCanvasCompositorFrameSinkManager::GetInstance() |
| 33 ->UnregisterOffscreenCanvasSurfaceInstance(frame_sink_id_); | 33 ->UnregisterOffscreenCanvasSurfaceInstance(frame_sink_id_); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 // static | 37 // static |
| 38 void OffscreenCanvasSurfaceImpl::Create( | 38 void OffscreenCanvasSurfaceImpl::Create( |
| 39 const cc::FrameSinkId& parent_frame_sink_id, | 39 const cc::FrameSinkId& parent_frame_sink_id, |
| 40 const cc::FrameSinkId& frame_sink_id, | 40 const cc::FrameSinkId& frame_sink_id, |
| 41 cc::mojom::DisplayCompositorClientPtr client, | 41 cc::mojom::DisplayCompositorClientPtr client, |
| 42 blink::mojom::OffscreenCanvasSurfaceRequest request) { | 42 blink::mojom::OffscreenCanvasSurfaceRequest request) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 62 void OffscreenCanvasSurfaceImpl::Require(const cc::SurfaceId& surface_id, | 62 void OffscreenCanvasSurfaceImpl::Require(const cc::SurfaceId& surface_id, |
| 63 const cc::SurfaceSequence& sequence) { | 63 const cc::SurfaceSequence& sequence) { |
| 64 GetSurfaceManager()->RequireSequence(surface_id, sequence); | 64 GetSurfaceManager()->RequireSequence(surface_id, sequence); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void OffscreenCanvasSurfaceImpl::Satisfy(const cc::SurfaceSequence& sequence) { | 67 void OffscreenCanvasSurfaceImpl::Satisfy(const cc::SurfaceSequence& sequence) { |
| 68 GetSurfaceManager()->SatisfySequence(sequence); | 68 GetSurfaceManager()->SatisfySequence(sequence); |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace content | 71 } // namespace content |
| OLD | NEW |