| OLD | NEW |
| 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" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 EXTDisjointTimerQuery::~EXTDisjointTimerQuery() {} | |
| 15 | |
| 16 WebGLExtensionName EXTDisjointTimerQuery::name() const { | 14 WebGLExtensionName EXTDisjointTimerQuery::name() const { |
| 17 return EXTDisjointTimerQueryName; | 15 return EXTDisjointTimerQueryName; |
| 18 } | 16 } |
| 19 | 17 |
| 20 EXTDisjointTimerQuery* EXTDisjointTimerQuery::create( | 18 EXTDisjointTimerQuery* EXTDisjointTimerQuery::create( |
| 21 WebGLRenderingContextBase* context) { | 19 WebGLRenderingContextBase* context) { |
| 22 EXTDisjointTimerQuery* o = new EXTDisjointTimerQuery(context); | 20 return new EXTDisjointTimerQuery(context); |
| 23 return o; | |
| 24 } | 21 } |
| 25 | 22 |
| 26 bool EXTDisjointTimerQuery::supported(WebGLRenderingContextBase* context) { | 23 bool EXTDisjointTimerQuery::supported(WebGLRenderingContextBase* context) { |
| 27 return context->extensionsUtil()->supportsExtension( | 24 return context->extensionsUtil()->supportsExtension( |
| 28 "GL_EXT_disjoint_timer_query"); | 25 "GL_EXT_disjoint_timer_query"); |
| 29 } | 26 } |
| 30 | 27 |
| 31 const char* EXTDisjointTimerQuery::extensionName() { | 28 const char* EXTDisjointTimerQuery::extensionName() { |
| 32 return "EXT_disjoint_timer_query"; | 29 return "EXT_disjoint_timer_query"; |
| 33 } | 30 } |
| 34 | 31 |
| 35 WebGLTimerQueryEXT* EXTDisjointTimerQuery::createQueryEXT() { | 32 WebGLTimerQueryEXT* EXTDisjointTimerQuery::createQueryEXT() { |
| 36 WebGLExtensionScopedContext scoped(this); | 33 WebGLExtensionScopedContext scoped(this); |
| 37 if (scoped.isLost()) | 34 if (scoped.isLost()) |
| 38 return nullptr; | 35 return nullptr; |
| 39 | 36 |
| 40 WebGLTimerQueryEXT* o = WebGLTimerQueryEXT::create(scoped.context()); | 37 return WebGLTimerQueryEXT::create(scoped.context()); |
| 41 scoped.context()->addContextObject(o); | |
| 42 return o; | |
| 43 } | 38 } |
| 44 | 39 |
| 45 void EXTDisjointTimerQuery::deleteQueryEXT(WebGLTimerQueryEXT* query) { | 40 void EXTDisjointTimerQuery::deleteQueryEXT(WebGLTimerQueryEXT* query) { |
| 46 WebGLExtensionScopedContext scoped(this); | 41 WebGLExtensionScopedContext scoped(this); |
| 47 if (!query || scoped.isLost()) | 42 if (!query || scoped.isLost()) |
| 48 return; | 43 return; |
| 49 query->deleteObject(scoped.context()->contextGL()); | 44 query->deleteObject(scoped.context()->contextGL()); |
| 50 | 45 |
| 51 if (query == m_currentElapsedQuery) | 46 if (query == m_currentElapsedQuery) |
| 52 m_currentElapsedQuery.clear(); | 47 m_currentElapsedQuery.clear(); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 WebGLExtension::trace(visitor); | 216 WebGLExtension::trace(visitor); |
| 222 } | 217 } |
| 223 | 218 |
| 224 EXTDisjointTimerQuery::EXTDisjointTimerQuery(WebGLRenderingContextBase* context) | 219 EXTDisjointTimerQuery::EXTDisjointTimerQuery(WebGLRenderingContextBase* context) |
| 225 : WebGLExtension(context) { | 220 : WebGLExtension(context) { |
| 226 context->extensionsUtil()->ensureExtensionEnabled( | 221 context->extensionsUtil()->ensureExtensionEnabled( |
| 227 "GL_EXT_disjoint_timer_query"); | 222 "GL_EXT_disjoint_timer_query"); |
| 228 } | 223 } |
| 229 | 224 |
| 230 } // namespace blink | 225 } // namespace blink |
| OLD | NEW |