Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Unified Diff: third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp

Issue 2479563005: Create manager to track OffscreenCanvasSurfaceImpl instances (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
diff --git a/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
index 4c30861ef7c573338193634985326ede43e9da06..d926f6df84ef79c47191533d068d7022d03407e5 100644
--- a/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
+++ b/third_party/WebKit/Source/modules/canvas/HTMLCanvasElementModule.cpp
@@ -37,18 +37,20 @@ void HTMLCanvasElementModule::getContext(
OffscreenCanvas* HTMLCanvasElementModule::transferControlToOffscreen(
HTMLCanvasElement& canvas,
ExceptionState& exceptionState) {
- if (!canvas.createSurfaceLayer()) {
+ int canvasId = DOMNodeIds::idForNode(&canvas);
+ if (!canvas.createSurfaceLayer(canvasId)) {
exceptionState.throwDOMException(
V8Error,
"Offscreen canvas creation failed due to an internal timeout.");
return nullptr;
}
- return transferControlToOffscreenInternal(canvas, exceptionState);
+ return transferControlToOffscreenInternal(canvas, canvasId, exceptionState);
}
OffscreenCanvas* HTMLCanvasElementModule::transferControlToOffscreenInternal(
HTMLCanvasElement& canvas,
+ int canvasId,
ExceptionState& exceptionState) {
if (canvas.renderingContext()) {
exceptionState.throwDOMException(
@@ -58,7 +60,7 @@ OffscreenCanvas* HTMLCanvasElementModule::transferControlToOffscreenInternal(
}
OffscreenCanvas* offscreenCanvas =
OffscreenCanvas::create(canvas.width(), canvas.height());
- offscreenCanvas->setAssociatedCanvasId(DOMNodeIds::idForNode(&canvas));
+ offscreenCanvas->setAssociatedCanvasId(canvasId);
CanvasSurfaceLayerBridge* bridge = canvas.surfaceLayerBridge();
if (bridge) {

Powered by Google App Engine
This is Rietveld 408576698