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

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

Issue 1881563003: Implement OffscreenCanvas.getContext('webgl') (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: offscreenCanvas.getContext('webgl') crashes on worker 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/modules/offscreencanvas/OffscreenCanvas.cpp
diff --git a/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvas.cpp b/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvas.cpp
index 0aedca56e420feed6780983a749a355e6a8f3cd2..3ffe09ea9a7cde9acfce5fddc13d9aeb6afdb141 100644
--- a/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvas.cpp
+++ b/third_party/WebKit/Source/modules/offscreencanvas/OffscreenCanvas.cpp
@@ -35,31 +35,31 @@ void OffscreenCanvas::setHeight(unsigned height)
m_size.setHeight(clampTo<int>(height));
}
-OffscreenCanvasRenderingContext2D* OffscreenCanvas::getContext(const String& id, const CanvasContextCreationAttributes& attributes)
+void OffscreenCanvas::getContext(ScriptState* scriptState, const String& id, const CanvasContextCreationAttributes& attributes, OffscreenRenderingContext& result)
{
OffscreenCanvasRenderingContext::ContextType contextType = OffscreenCanvasRenderingContext::contextTypeFromId(id);
// Unknown type.
if (contextType == OffscreenCanvasRenderingContext::ContextTypeCount)
- return nullptr;
+ return;
OffscreenCanvasRenderingContextFactory* factory = getRenderingContextFactory(contextType);
if (!factory)
- return nullptr;
+ return;
if (m_context) {
- if (m_context->getContextType() != contextType) {
+ if (m_context->getOffscreenCanvasRenderingContextType() != contextType) {
factory->onError(this, "OffscreenCanvas has an existing context of a different type");
- return nullptr;
+ return;
}
} else {
- m_context = factory->create(this, attributes);
+ m_context = factory->create(scriptState, this, attributes);
}
// TODO: When there're more than one context type implemented in the future,
// the return type here should be changed to base class of all Offscreen
// context types.
- return static_cast<OffscreenCanvasRenderingContext2D*>(m_context.get());
+ m_context->setOffscreenCanvasGetContextResult(result);
}
ImageBitmap* OffscreenCanvas::transferToImageBitmap(ExceptionState& exceptionState)
@@ -76,12 +76,12 @@ ImageBitmap* OffscreenCanvas::transferToImageBitmap(ExceptionState& exceptionSta
return image;
}
-OffscreenCanvasRenderingContext2D* OffscreenCanvas::renderingContext() const
+OffscreenCanvasRenderingContext* OffscreenCanvas::renderingContext() const
{
// TODO: When there're more than one context type implemented in the future,
// the return type here should be changed to base class of all Offscreen
// context types.
- return static_cast<OffscreenCanvasRenderingContext2D*>(m_context.get());
+ return m_context.get();
}
OffscreenCanvas::ContextFactoryVector& OffscreenCanvas::renderingContextFactories()

Powered by Google App Engine
This is Rietveld 408576698