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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.cpp

Issue 2492343003: Fix the WebGLObject arg non-nullable behaviors. (Closed)
Patch Set: Fix the WebGLObject arg non-nullable behaviors. 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/webgl/EXTDisjointTimerQuery.h" 5 #include "modules/webgl/EXTDisjointTimerQuery.h"
6 6
7 #include "bindings/modules/v8/WebGLAny.h" 7 #include "bindings/modules/v8/WebGLAny.h"
8 #include "gpu/command_buffer/client/gles2_interface.h" 8 #include "gpu/command_buffer/client/gles2_interface.h"
9 #include "modules/webgl/WebGLRenderingContextBase.h" 9 #include "modules/webgl/WebGLRenderingContextBase.h"
10 #include "modules/webgl/WebGLTimerQueryEXT.h" 10 #include "modules/webgl/WebGLTimerQueryEXT.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 return scoped.context()->contextGL()->IsQueryEXT(query->object()); 62 return scoped.context()->contextGL()->IsQueryEXT(query->object());
63 } 63 }
64 64
65 void EXTDisjointTimerQuery::beginQueryEXT(GLenum target, 65 void EXTDisjointTimerQuery::beginQueryEXT(GLenum target,
66 WebGLTimerQueryEXT* query) { 66 WebGLTimerQueryEXT* query) {
67 WebGLExtensionScopedContext scoped(this); 67 WebGLExtensionScopedContext scoped(this);
68 if (scoped.isLost()) 68 if (scoped.isLost())
69 return; 69 return;
70 70
71 if (!query || query->isDeleted() || !query->validate(0, scoped.context())) { 71 DCHECK(query);
72 if (query->isDeleted() || !query->validate(0, scoped.context())) {
72 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, "beginQueryEXT", 73 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, "beginQueryEXT",
73 "invalid query"); 74 "invalid query");
74 return; 75 return;
75 } 76 }
76 77
77 if (target != GL_TIME_ELAPSED_EXT) { 78 if (target != GL_TIME_ELAPSED_EXT) {
78 scoped.context()->synthesizeGLError(GL_INVALID_ENUM, "beginQueryEXT", 79 scoped.context()->synthesizeGLError(GL_INVALID_ENUM, "beginQueryEXT",
79 "invalid target"); 80 "invalid target");
80 return; 81 return;
81 } 82 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 m_currentElapsedQuery->resetCachedResult(); 119 m_currentElapsedQuery->resetCachedResult();
119 m_currentElapsedQuery.clear(); 120 m_currentElapsedQuery.clear();
120 } 121 }
121 122
122 void EXTDisjointTimerQuery::queryCounterEXT(WebGLTimerQueryEXT* query, 123 void EXTDisjointTimerQuery::queryCounterEXT(WebGLTimerQueryEXT* query,
123 GLenum target) { 124 GLenum target) {
124 WebGLExtensionScopedContext scoped(this); 125 WebGLExtensionScopedContext scoped(this);
125 if (scoped.isLost()) 126 if (scoped.isLost())
126 return; 127 return;
127 128
128 if (!query || query->isDeleted() || !query->validate(0, scoped.context())) { 129 DCHECK(query);
130 if (query->isDeleted() || !query->validate(0, scoped.context())) {
129 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, "queryCounterEXT", 131 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, "queryCounterEXT",
130 "invalid query"); 132 "invalid query");
131 return; 133 return;
132 } 134 }
133 135
134 if (target != GL_TIMESTAMP_EXT) { 136 if (target != GL_TIMESTAMP_EXT) {
135 scoped.context()->synthesizeGLError(GL_INVALID_ENUM, "queryCounterEXT", 137 scoped.context()->synthesizeGLError(GL_INVALID_ENUM, "queryCounterEXT",
136 "invalid target"); 138 "invalid target");
137 return; 139 return;
138 } 140 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 return ScriptValue::createNull(scriptState); 183 return ScriptValue::createNull(scriptState);
182 } 184 }
183 185
184 ScriptValue EXTDisjointTimerQuery::getQueryObjectEXT(ScriptState* scriptState, 186 ScriptValue EXTDisjointTimerQuery::getQueryObjectEXT(ScriptState* scriptState,
185 WebGLTimerQueryEXT* query, 187 WebGLTimerQueryEXT* query,
186 GLenum pname) { 188 GLenum pname) {
187 WebGLExtensionScopedContext scoped(this); 189 WebGLExtensionScopedContext scoped(this);
188 if (scoped.isLost()) 190 if (scoped.isLost())
189 return ScriptValue::createNull(scriptState); 191 return ScriptValue::createNull(scriptState);
190 192
191 if (!query || query->isDeleted() || !query->validate(0, scoped.context()) || 193 DCHECK(query);
194 if (query->isDeleted() || !query->validate(0, scoped.context()) ||
192 m_currentElapsedQuery == query) { 195 m_currentElapsedQuery == query) {
193 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, 196 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION,
194 "getQueryObjectEXT", "invalid query"); 197 "getQueryObjectEXT", "invalid query");
195 return ScriptValue::createNull(scriptState); 198 return ScriptValue::createNull(scriptState);
196 } 199 }
197 200
198 switch (pname) { 201 switch (pname) {
199 case GL_QUERY_RESULT_EXT: { 202 case GL_QUERY_RESULT_EXT: {
200 query->updateCachedResult(scoped.context()->contextGL()); 203 query->updateCachedResult(scoped.context()->contextGL());
201 return WebGLAny(scriptState, query->getQueryResult()); 204 return WebGLAny(scriptState, query->getQueryResult());
(...skipping 16 matching lines...) Expand all
218 WebGLExtension::trace(visitor); 221 WebGLExtension::trace(visitor);
219 } 222 }
220 223
221 EXTDisjointTimerQuery::EXTDisjointTimerQuery(WebGLRenderingContextBase* context) 224 EXTDisjointTimerQuery::EXTDisjointTimerQuery(WebGLRenderingContextBase* context)
222 : WebGLExtension(context) { 225 : WebGLExtension(context) {
223 context->extensionsUtil()->ensureExtensionEnabled( 226 context->extensionsUtil()->ensureExtensionEnabled(
224 "GL_EXT_disjoint_timer_query"); 227 "GL_EXT_disjoint_timer_query");
225 } 228 }
226 229
227 } // namespace blink 230 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/webgl/EXTDisjointTimerQuery.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698