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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h

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/webgl/WebGLRenderingContext.h
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h
index 6c23f299fd15dba7aa3293daf61be08a3b0fb0e9..8c354e6d7b10d1e68cbe7ebfbdda05137608769b 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContext.h
@@ -27,6 +27,8 @@
#define WebGLRenderingContext_h
#include "core/html/canvas/CanvasRenderingContextFactory.h"
+#include "modules/offscreencanvas/OffscreenCanvasRenderingContext.h"
+#include "modules/offscreencanvas/OffscreenCanvasRenderingContextFactory.h"
#include "modules/webgl/WebGLRenderingContextBase.h"
namespace blink {
@@ -47,19 +49,34 @@ public:
void onError(HTMLCanvasElement*, const String& error) override;
};
+ class OffscreenCanvasFactory : public OffscreenCanvasRenderingContextFactory {
+ WTF_MAKE_NONCOPYABLE(OffscreenCanvasFactory);
+ public:
+ OffscreenCanvasFactory() {}
+ ~OffscreenCanvasFactory() override {}
+
+ OffscreenCanvasRenderingContext* create(ScriptState*, OffscreenCanvas*, const CanvasContextCreationAttributes& attrs) override;
+ OffscreenCanvasRenderingContext::ContextType getContextType() const override { return OffscreenCanvasRenderingContext::ContextWebgl; }
+ void onError(OffscreenCanvas* canvas, const String& error) override {}
+ };
+
~WebGLRenderingContext() override;
CanvasRenderingContext::ContextType getContextType() const override { return CanvasRenderingContext::ContextWebgl; }
+ OffscreenCanvasRenderingContext::ContextType getOffscreenCanvasRenderingContextType() const override { return OffscreenCanvasRenderingContext::ContextWebgl; }
+ ImageBitmap* transferToImageBitmap(ExceptionState&) final;
unsigned version() const override { return 1; }
String contextName() const override { return "WebGLRenderingContext"; }
void registerContextExtensions() override;
void setCanvasGetContextResult(RenderingContext&) final;
+ void setOffscreenCanvasGetContextResult(OffscreenRenderingContext&) final;
EAGERLY_FINALIZE();
DECLARE_VIRTUAL_TRACE();
private:
WebGLRenderingContext(HTMLCanvasElement*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&);
+ WebGLRenderingContext(OffscreenCanvas*, PassOwnPtr<WebGraphicsContext3DProvider>, const WebGLContextAttributes&);
// Enabled extension objects.
Member<ANGLEInstancedArrays> m_angleInstancedArrays;

Powered by Google App Engine
This is Rietveld 408576698