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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp

Issue 2490443002: Make OffscreenCanvas an EventTarget (Closed)
Patch Set: tests added Created 4 years, 1 month 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/WebGLRenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index ca13517d9d8e67ef81a1db32ef5e8b1652581d42..0b557f5fad384cb75028e2c13e67df1c0dd77745 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -972,11 +972,13 @@ WebGLRenderingContextBase::WebGLRenderingContextBase(
OffscreenCanvas* passedOffscreenCanvas,
std::unique_ptr<WebGraphicsContext3DProvider> contextProvider,
const CanvasContextCreationAttributes& requestedAttributes,
+ ExecutionContext* executionContext,
unsigned version)
: WebGLRenderingContextBase(nullptr,
passedOffscreenCanvas,
std::move(contextProvider),
requestedAttributes,
+ executionContext,
version) {}
WebGLRenderingContextBase::WebGLRenderingContextBase(
@@ -988,6 +990,7 @@ WebGLRenderingContextBase::WebGLRenderingContextBase(
nullptr,
std::move(contextProvider),
requestedAttributes,
+ nullptr,
version) {}
WebGLRenderingContextBase::WebGLRenderingContextBase(
@@ -995,6 +998,7 @@ WebGLRenderingContextBase::WebGLRenderingContextBase(
OffscreenCanvas* passedOffscreenCanvas,
std::unique_ptr<WebGraphicsContext3DProvider> contextProvider,
const CanvasContextCreationAttributes& requestedAttributes,
+ ExecutionContext* executionContext,
unsigned version)
: CanvasRenderingContext(passedCanvas,
passedOffscreenCanvas,
@@ -1023,7 +1027,8 @@ WebGLRenderingContextBase::WebGLRenderingContextBase(
m_isOESTextureHalfFloatFormatsTypesAdded(false),
m_isWebGLDepthTextureFormatsTypesAdded(false),
m_isEXTsRGBFormatsTypesAdded(false),
- m_version(version) {
+ m_version(version),
+ m_executionContext(executionContext) {
ASSERT(contextProvider);
m_contextGroup = WebGLContextGroup::create();
@@ -7297,7 +7302,10 @@ bool WebGLRenderingContextBase::validateDrawElements(const char* functionName,
void WebGLRenderingContextBase::dispatchContextLostEvent(TimerBase*) {
WebGLContextEvent* event = WebGLContextEvent::create(
EventTypeNames::webglcontextlost, false, true, "");
- canvas()->dispatchEvent(event);
+ if (getOffscreenCanvas())
+ getOffscreenCanvas()->dispatchEvent(event);
+ else
+ canvas()->dispatchEvent(event);
m_restoreAllowed = event->defaultPrevented();
if (m_restoreAllowed && !m_isHidden) {
if (m_autoRecoveryMethod == Auto)
@@ -7596,6 +7604,7 @@ DEFINE_TRACE(WebGLRenderingContextBase) {
visitor->trace(m_renderbufferBinding);
visitor->trace(m_textureUnits);
visitor->trace(m_extensions);
+ visitor->trace(m_executionContext);
CanvasRenderingContext::trace(visitor);
}

Powered by Google App Engine
This is Rietveld 408576698