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 29679540fa365f8c20961cffd571b7762c55ddf2..6291af5f9a1689ccf3235e594bca64d5c7634c04 100644 |
--- a/content/browser/renderer_host/offscreen_canvas_surface_impl.cc |
+++ b/content/browser/renderer_host/offscreen_canvas_surface_impl.cc |
@@ -16,8 +16,7 @@ |
namespace content { |
-OffscreenCanvasSurfaceImpl::OffscreenCanvasSurfaceImpl() |
- : id_allocator_(new cc::SurfaceIdAllocator()) {} |
+OffscreenCanvasSurfaceImpl::OffscreenCanvasSurfaceImpl() {} |
OffscreenCanvasSurfaceImpl::~OffscreenCanvasSurfaceImpl() { |
if (frame_sink_id_.is_valid()) { |
@@ -33,29 +32,24 @@ void OffscreenCanvasSurfaceImpl::Create( |
std::move(request)); |
} |
-void OffscreenCanvasSurfaceImpl::GetSurfaceId(GetSurfaceIdCallback callback) { |
- DCHECK_CURRENTLY_ON(BrowserThread::UI); |
- if (frame_sink_id_.is_valid()) { |
- // This IPC should be only called once for each HTMLCanvasElement. In this |
- // case, frame_sink_id_ is still unset. |
- // As the browser makes no assumption of correct behavior of renderer, in |
- // an unwanted situation when this function is invoked twice, we need to |
- // unregister the instance from manager. |
- OffscreenCanvasSurfaceManager::GetInstance() |
- ->UnregisterOffscreenCanvasSurfaceInstance(frame_sink_id_); |
- mojo::ReportBadMessage( |
- "The same OffscreenCanvasSurfaceImpl is registered to " |
- "OffscreenCanvasSurfaceManager twice."); |
- } |
- |
- frame_sink_id_ = AllocateFrameSinkId(); |
- cc::SurfaceId surface_id = |
- cc::SurfaceId(frame_sink_id_, id_allocator_->GenerateId()); |
+void OffscreenCanvasSurfaceImpl::SetClient( |
+ blink::mojom::OffscreenCanvasSurfaceClientPtr client, |
+ const cc::FrameSinkId& frame_sink_id) { |
+ client_ = std::move(client); |
+ frame_sink_id_ = frame_sink_id; |
OffscreenCanvasSurfaceManager::GetInstance() |
->RegisterOffscreenCanvasSurfaceInstance(frame_sink_id_, this); |
+} |
- std::move(callback).Run(surface_id); |
+void OffscreenCanvasSurfaceImpl::OnSurfaceCreated( |
+ const cc::SurfaceId& surface_id, |
+ const gfx::Size& frame_size, |
+ float device_scale_factor) { |
+ if (client_) { |
+ client_->OnSurfaceCreated(surface_id, frame_size.width(), |
+ frame_size.height(), device_scale_factor); |
+ } |
} |
void OffscreenCanvasSurfaceImpl::Require(const cc::SurfaceId& surface_id, |