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 |