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