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

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: works! 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..52eb1071f75301c5a5850e6c3ffba3c3e8104834 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 neutered OffscreenCanvas");
Justin Novosad 2016/04/26 20:08:31 The spec has cleaned up it vocabulare and uses "de
xidachen 2016/04/26 20:40:59 Will have another CL that change the word "neutere
+ 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