| 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/WebGLQuery.h" | 5 #include "modules/webgl/WebGLQuery.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_interface.h" | 7 #include "gpu/command_buffer/client/gles2_interface.h" |
| 8 #include "modules/webgl/WebGL2RenderingContextBase.h" | 8 #include "modules/webgl/WebGL2RenderingContextBase.h" |
| 9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 | 25 |
| 26 WebGLQuery::WebGLQuery(WebGL2RenderingContextBase* ctx) | 26 WebGLQuery::WebGLQuery(WebGL2RenderingContextBase* ctx) |
| 27 : WebGLSharedPlatform3DObject(ctx) | 27 : WebGLSharedPlatform3DObject(ctx) |
| 28 , m_target(0) | 28 , m_target(0) |
| 29 , m_taskObserverRegistered(false) | 29 , m_taskObserverRegistered(false) |
| 30 , m_canUpdateAvailability(false) | 30 , m_canUpdateAvailability(false) |
| 31 , m_queryResultAvailable(false) | 31 , m_queryResultAvailable(false) |
| 32 , m_queryResult(0) | 32 , m_queryResult(0) |
| 33 { | 33 { |
| 34 GLuint query; | 34 setObject(ctx->webContext()->createQueryEXT()); |
| 35 ctx->contextGL()->GenQueriesEXT(1, &query); | |
| 36 setObject(query); | |
| 37 } | 35 } |
| 38 | 36 |
| 39 void WebGLQuery::setTarget(GLenum target) | 37 void WebGLQuery::setTarget(GLenum target) |
| 40 { | 38 { |
| 41 ASSERT(object()); | 39 ASSERT(object()); |
| 42 ASSERT(!m_target); | 40 ASSERT(!m_target); |
| 43 m_target = target; | 41 m_target = target; |
| 44 } | 42 } |
| 45 | 43 |
| 46 void WebGLQuery::deleteObjectImpl(WebGraphicsContext3D* context3d, gpu::gles2::G
LES2Interface* gl) | 44 void WebGLQuery::deleteObjectImpl(WebGraphicsContext3D* context3d, gpu::gles2::G
LES2Interface* gl) |
| 47 { | 45 { |
| 48 gl->DeleteQueriesEXT(1, &m_object); | 46 context3d->deleteQueryEXT(m_object); |
| 49 m_object = 0; | 47 m_object = 0; |
| 50 } | 48 } |
| 51 | 49 |
| 52 void WebGLQuery::resetCachedResult() | 50 void WebGLQuery::resetCachedResult() |
| 53 { | 51 { |
| 54 m_canUpdateAvailability = false; | 52 m_canUpdateAvailability = false; |
| 55 m_queryResultAvailable = false; | 53 m_queryResultAvailable = false; |
| 56 m_queryResult = 0; | 54 m_queryResult = 0; |
| 57 // When this is called, the implication is that we should start | 55 // When this is called, the implication is that we should start |
| 58 // keeping track of whether we can update the cached availability | 56 // keeping track of whether we can update the cached availability |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 Platform::current()->currentThread()->removeTaskObserver(this); | 107 Platform::current()->currentThread()->removeTaskObserver(this); |
| 110 } | 108 } |
| 111 } | 109 } |
| 112 | 110 |
| 113 void WebGLQuery::didProcessTask() | 111 void WebGLQuery::didProcessTask() |
| 114 { | 112 { |
| 115 m_canUpdateAvailability = true; | 113 m_canUpdateAvailability = true; |
| 116 } | 114 } |
| 117 | 115 |
| 118 } // namespace blink | 116 } // namespace blink |
| OLD | NEW |