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

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

Issue 1385793002: Only make timer queries' results available when control returns to browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review feedback from dyen. Created 5 years, 2 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/EXTDisjointTimerQuery.cpp
diff --git a/third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp b/third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp
index 30a7b157eca209fa155366a9fde8f0b8f2200e82..2217f40cc0e6ee4aa467ca7c6ad63c151ef02c17 100644
--- a/third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp
+++ b/third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp
@@ -117,6 +117,7 @@ void EXTDisjointTimerQuery::endQueryEXT(GLenum target)
}
scoped.context()->webContext()->endQueryEXT(target);
+ m_currentElapsedQuery->resetCachedResult();
m_currentElapsedQuery.clear();
}
@@ -143,6 +144,7 @@ void EXTDisjointTimerQuery::queryCounterEXT(WebGLTimerQueryEXT* query, GLenum ta
scoped.context()->webContext()->queryCounterEXT(query->object(), target);
query->setTarget(target);
+ query->resetCachedResult();
}
ScriptValue EXTDisjointTimerQuery::getQueryEXT(ScriptState* scriptState, GLenum target, GLenum pname)
@@ -177,23 +179,19 @@ ScriptValue EXTDisjointTimerQuery::getQueryObjectEXT(ScriptState* scriptState, W
if (scoped.isLost())
return ScriptValue::createNull(scriptState);
- if (!query || query->isDeleted() || !query->validate(0, scoped.context())) {
+ if (!query || query->isDeleted() || !query->validate(0, scoped.context()) || m_currentElapsedQuery == query) {
scoped.context()->webContext()->synthesizeGLError(GL_INVALID_OPERATION);
return ScriptValue::createNull(scriptState);
}
- // TODO(kbr): Per the spec, figure out a way to only update this value once
- // the current frame has completed rendering.
switch (pname) {
case GL_QUERY_RESULT_EXT: {
- GLuint64 result = 0;
- scoped.context()->webContext()->getQueryObjectui64vEXT(query->object(), pname, &result);
- return WebGLAny(scriptState, result);
+ query->updateCachedResult(scoped.context()->webContext());
+ return WebGLAny(scriptState, query->getQueryResult());
}
case GL_QUERY_RESULT_AVAILABLE_EXT: {
- GLuint available = 0;
- scoped.context()->webContext()->getQueryObjectuivEXT(query->object(), pname, &available);
- return WebGLAny(scriptState, !!available);
+ query->updateCachedResult(scoped.context()->webContext());
+ return WebGLAny(scriptState, query->isQueryResultAvailable());
}
default:
scoped.context()->webContext()->synthesizeGLError(GL_INVALID_ENUM);

Powered by Google App Engine
This is Rietveld 408576698