Index: content/browser/renderer_host/offscreen_canvas_surface_impl.cc |
diff --git a/content/browser/renderer_host/offscreen_canvas_surface_impl.cc b/content/browser/renderer_host/offscreen_canvas_surface_impl.cc |
index 3795b60ed0e282e2e29af90444648679990a5123..6fd12ccdd388c9117bc53f8679b95830fa0c9d99 100644 |
--- a/content/browser/renderer_host/offscreen_canvas_surface_impl.cc |
+++ b/content/browser/renderer_host/offscreen_canvas_surface_impl.cc |
@@ -28,10 +28,12 @@ OffscreenCanvasSurfaceImpl::OffscreenCanvasSurfaceImpl( |
} |
OffscreenCanvasSurfaceImpl::~OffscreenCanvasSurfaceImpl() { |
- if (frame_sink_id_.is_valid()) { |
- OffscreenCanvasCompositorFrameSinkManager::GetInstance() |
- ->UnregisterOffscreenCanvasSurfaceInstance(frame_sink_id_); |
+ if (has_registered_frame_sink_hierarchy_) { |
+ content::GetDisplayCompositor()->UnregisterFrameSinkHierarchy( |
xlai (Olivia)
2017/04/03 15:42:59
Previously this is done in destroy of OffscreenCan
kylechar
2017/04/03 16:00:19
The GpuCompositorFrameSink in DisplayCompositor is
|
+ parent_frame_sink_id_, frame_sink_id_); |
} |
+ OffscreenCanvasCompositorFrameSinkManager::GetInstance() |
+ ->UnregisterOffscreenCanvasSurfaceInstance(frame_sink_id_); |
} |
// static |
@@ -48,6 +50,20 @@ void OffscreenCanvasSurfaceImpl::Create( |
mojo::MakeStrongBinding(std::move(impl), std::move(request)); |
} |
+void OffscreenCanvasSurfaceImpl::CreateCompositorFrameSink( |
+ cc::mojom::MojoCompositorFrameSinkClientPtr client, |
+ cc::mojom::MojoCompositorFrameSinkRequest request) { |
+ DCHECK(!compositor_frame_sink_private_.is_bound()); |
+ |
+ content::GetDisplayCompositor()->CreateCompositorFrameSink( |
+ frame_sink_id_, std::move(request), |
+ mojo::MakeRequest(&compositor_frame_sink_private_), std::move(client)); |
+ |
+ content::GetDisplayCompositor()->RegisterFrameSinkHierarchy( |
+ parent_frame_sink_id_, frame_sink_id_); |
+ has_registered_frame_sink_hierarchy_ = true; |
+} |
+ |
void OffscreenCanvasSurfaceImpl::OnSurfaceCreated( |
const cc::SurfaceInfo& surface_info) { |
DCHECK_EQ(surface_info.id().frame_sink_id(), frame_sink_id_); |