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

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

Issue 1473023007: Fix the crash problem of WebGL2 Query api. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add the checking for context lost. Created 5 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
index 6d68faaba2df29307afde851c4b63257969c50db..952591508afd358dfdabcb4df97c940210ac74a4 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
@@ -1593,6 +1593,9 @@ WebGLQuery* WebGL2RenderingContextBase::createQuery()
void WebGL2RenderingContextBase::deleteQuery(WebGLQuery* query)
{
+ if (isContextLost() || !query)
+ return;
+
if (m_currentBooleanOcclusionQuery == query) {
webContext()->endQueryEXT(m_currentBooleanOcclusionQuery->getTarget());
m_currentBooleanOcclusionQuery = nullptr;
@@ -1617,6 +1620,11 @@ GLboolean WebGL2RenderingContextBase::isQuery(WebGLQuery* query)
void WebGL2RenderingContextBase::beginQuery(GLenum target, WebGLQuery* query)
{
bool deleted;
+ if (!query) {
+ synthesizeGLError(GL_INVALID_OPERATION, "beginQuery", "query object is null");
+ return;
+ }
+
if (!checkObjectToBeBound("beginQuery", query, deleted))
return;
if (deleted) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698