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

Unified Diff: third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp

Issue 1917733004: Reland of: Make OffscreenCanvas Transferable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address all comments Created 4 years, 8 months 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/core/offscreencanvas/OffscreenCanvas.cpp
diff --git a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
index aeb3b6dfd4a28e8d2ea848aa57f0f2f5e6c083fa..e7422f9693d164383434f12856c59148b45bcf69 100644
--- a/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
+++ b/third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp
@@ -32,8 +32,20 @@ void OffscreenCanvas::setHeight(unsigned height)
m_size.setHeight(clampTo<int>(height));
}
+void OffscreenCanvas::setNeutered()
+{
+ ASSERT(!m_context);
+ m_isNeutered = true;
+ m_size.setWidth(0);
+ m_size.setHeight(0);
+}
+
ImageBitmap* OffscreenCanvas::transferToImageBitmap(ExceptionState& exceptionState)
{
+ if (m_isNeutered) {
+ exceptionState.throwDOMException(InvalidStateError, "Cannot transfer an ImageBitmap from a detached OffscreenCanvas");
+ return nullptr;
+ }
if (!m_context) {
exceptionState.throwDOMException(InvalidStateError, "Cannot transfer an ImageBitmap from an OffscreenCanvas with no context");
return nullptr;
@@ -93,7 +105,6 @@ void OffscreenCanvas::registerRenderingContextFactory(PassOwnPtr<CanvasRendering
DEFINE_TRACE(OffscreenCanvas)
{
visitor->trace(m_context);
- visitor->trace(m_canvas);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698