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

Unified Diff: Source/core/html/canvas/WebGLDrawBuffers.cpp

Issue 687533005: Enforce context refrence guards in WebGL extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switched to using RefPtr Created 6 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
« no previous file with comments | « Source/core/html/canvas/WebGLDebugShaders.cpp ('k') | Source/core/html/canvas/WebGLExtension.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/canvas/WebGLDrawBuffers.cpp
diff --git a/Source/core/html/canvas/WebGLDrawBuffers.cpp b/Source/core/html/canvas/WebGLDrawBuffers.cpp
index e3d14f8a5621640238b37ea572f7e3caf8acfc64..655b188aa997e3b37cc215babd5e3d3a6c3f0323 100644
--- a/Source/core/html/canvas/WebGLDrawBuffers.cpp
+++ b/Source/core/html/canvas/WebGLDrawBuffers.cpp
@@ -63,35 +63,36 @@ const char* WebGLDrawBuffers::extensionName()
void WebGLDrawBuffers::drawBuffersWEBGL(const Vector<GLenum>& buffers)
{
- if (isLost())
+ WebGLExtensionScopedContext scoped(this);
+ if (scoped.isLost())
return;
GLsizei n = buffers.size();
const GLenum* bufs = buffers.data();
- if (!m_context->m_framebufferBinding) {
+ if (!scoped.context()->m_framebufferBinding) {
if (n != 1) {
- m_context->synthesizeGLError(GL_INVALID_VALUE, "drawBuffersWEBGL", "more than one buffer");
+ scoped.context()->synthesizeGLError(GL_INVALID_VALUE, "drawBuffersWEBGL", "more than one buffer");
return;
}
if (bufs[0] != GL_BACK && bufs[0] != GL_NONE) {
- m_context->synthesizeGLError(GL_INVALID_OPERATION, "drawBuffersWEBGL", "BACK or NONE");
+ scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, "drawBuffersWEBGL", "BACK or NONE");
return;
}
// Because the backbuffer is simulated on all current WebKit ports, we need to change BACK to COLOR_ATTACHMENT0.
GLenum value = (bufs[0] == GL_BACK) ? GL_COLOR_ATTACHMENT0 : GL_NONE;
- m_context->webContext()->drawBuffersEXT(1, &value);
- m_context->setBackDrawBuffer(bufs[0]);
+ scoped.context()->webContext()->drawBuffersEXT(1, &value);
+ scoped.context()->setBackDrawBuffer(bufs[0]);
} else {
- if (n > m_context->maxDrawBuffers()) {
- m_context->synthesizeGLError(GL_INVALID_VALUE, "drawBuffersWEBGL", "more than max draw buffers");
+ if (n > scoped.context()->maxDrawBuffers()) {
+ scoped.context()->synthesizeGLError(GL_INVALID_VALUE, "drawBuffersWEBGL", "more than max draw buffers");
return;
}
for (GLsizei i = 0; i < n; ++i) {
if (bufs[i] != GL_NONE && bufs[i] != static_cast<GLenum>(GL_COLOR_ATTACHMENT0_EXT + i)) {
- m_context->synthesizeGLError(GL_INVALID_OPERATION, "drawBuffersWEBGL", "COLOR_ATTACHMENTi_EXT or NONE");
+ scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, "drawBuffersWEBGL", "COLOR_ATTACHMENTi_EXT or NONE");
return;
}
}
- m_context->m_framebufferBinding->drawBuffers(buffers);
+ scoped.context()->m_framebufferBinding->drawBuffers(buffers);
}
}
« no previous file with comments | « Source/core/html/canvas/WebGLDebugShaders.cpp ('k') | Source/core/html/canvas/WebGLExtension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698