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

Unified Diff: Source/core/html/canvas/OESVertexArrayObject.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/ANGLEInstancedArrays.cpp ('k') | Source/core/html/canvas/WebGLDebugShaders.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/canvas/OESVertexArrayObject.cpp
diff --git a/Source/core/html/canvas/OESVertexArrayObject.cpp b/Source/core/html/canvas/OESVertexArrayObject.cpp
index 063dc0f4a95c1ddad693d84a1ed2348f667deab2..997990271083a49e7214ce7cf4c12486e6f56367 100644
--- a/Source/core/html/canvas/OESVertexArrayObject.cpp
+++ b/Source/core/html/canvas/OESVertexArrayObject.cpp
@@ -55,54 +55,58 @@ PassRefPtrWillBeRawPtr<OESVertexArrayObject> OESVertexArrayObject::create(WebGLR
PassRefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> OESVertexArrayObject::createVertexArrayOES()
{
- if (isLost())
+ WebGLExtensionScopedContext scoped(this);
+ if (scoped.isLost())
return nullptr;
- RefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(m_context, WebGLVertexArrayObjectOES::VaoTypeUser);
- m_context->addContextObject(o.get());
+ RefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(scoped.context(), WebGLVertexArrayObjectOES::VaoTypeUser);
+ scoped.context()->addContextObject(o.get());
return o.release();
}
void OESVertexArrayObject::deleteVertexArrayOES(WebGLVertexArrayObjectOES* arrayObject)
{
- if (!arrayObject || isLost())
+ WebGLExtensionScopedContext scoped(this);
+ if (!arrayObject || scoped.isLost())
return;
- if (!arrayObject->isDefaultObject() && arrayObject == m_context->m_boundVertexArrayObject)
- m_context->setBoundVertexArrayObject(nullptr);
+ if (!arrayObject->isDefaultObject() && arrayObject == scoped.context()->m_boundVertexArrayObject)
+ scoped.context()->setBoundVertexArrayObject(nullptr);
- arrayObject->deleteObject(m_context->webContext());
+ arrayObject->deleteObject(scoped.context()->webContext());
}
GLboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arrayObject)
{
- if (!arrayObject || isLost())
+ WebGLExtensionScopedContext scoped(this);
+ if (!arrayObject || scoped.isLost())
return 0;
if (!arrayObject->hasEverBeenBound())
return 0;
- return m_context->webContext()->isVertexArrayOES(arrayObject->object());
+ return scoped.context()->webContext()->isVertexArrayOES(arrayObject->object());
}
void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayObject)
{
- if (isLost())
+ WebGLExtensionScopedContext scoped(this);
+ if (scoped.isLost())
return;
- if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, context()))) {
- m_context->webContext()->synthesizeGLError(GL_INVALID_OPERATION);
+ if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, scoped.context()))) {
+ scoped.context()->webContext()->synthesizeGLError(GL_INVALID_OPERATION);
return;
}
if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) {
- m_context->webContext()->bindVertexArrayOES(arrayObject->object());
+ scoped.context()->webContext()->bindVertexArrayOES(arrayObject->object());
arrayObject->setHasEverBeenBound();
- m_context->setBoundVertexArrayObject(arrayObject);
+ scoped.context()->setBoundVertexArrayObject(arrayObject);
} else {
- m_context->webContext()->bindVertexArrayOES(0);
- m_context->setBoundVertexArrayObject(nullptr);
+ scoped.context()->webContext()->bindVertexArrayOES(0);
+ scoped.context()->setBoundVertexArrayObject(nullptr);
}
}
« no previous file with comments | « Source/core/html/canvas/ANGLEInstancedArrays.cpp ('k') | Source/core/html/canvas/WebGLDebugShaders.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698