| 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/WebGLTimerQueryEXT.h" | 5 #include "modules/webgl/WebGLTimerQueryEXT.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/WebGLRenderingContextBase.h" | 8 #include "modules/webgl/WebGLRenderingContextBase.h" |
| 9 #include "public/platform/Platform.h" | 9 #include "public/platform/Platform.h" |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 WebGLTimerQueryEXT::WebGLTimerQueryEXT(WebGLRenderingContextBase* ctx) | 26 WebGLTimerQueryEXT::WebGLTimerQueryEXT(WebGLRenderingContextBase* ctx) |
| 27 : WebGLContextObject(ctx) | 27 : WebGLContextObject(ctx) |
| 28 , m_target(0) | 28 , m_target(0) |
| 29 , m_queryId(0) | 29 , m_queryId(0) |
| 30 , m_taskObserverRegistered(false) | 30 , m_taskObserverRegistered(false) |
| 31 , m_canUpdateAvailability(false) | 31 , m_canUpdateAvailability(false) |
| 32 , m_queryResultAvailable(false) | 32 , m_queryResultAvailable(false) |
| 33 , m_queryResult(0) | 33 , m_queryResult(0) |
| 34 { | 34 { |
| 35 context()->contextGL()->GenQueriesEXT(1, &m_queryId); | 35 m_queryId = context()->webContext()->createQueryEXT(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void WebGLTimerQueryEXT::resetCachedResult() | 38 void WebGLTimerQueryEXT::resetCachedResult() |
| 39 { | 39 { |
| 40 m_canUpdateAvailability = false; | 40 m_canUpdateAvailability = false; |
| 41 m_queryResultAvailable = false; | 41 m_queryResultAvailable = false; |
| 42 m_queryResult = 0; | 42 m_queryResult = 0; |
| 43 // When this is called, the implication is that we should start | 43 // When this is called, the implication is that we should start |
| 44 // keeping track of whether we can update the cached availability | 44 // keeping track of whether we can update the cached availability |
| 45 // and result. | 45 // and result. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 75 return m_queryResultAvailable; | 75 return m_queryResultAvailable; |
| 76 } | 76 } |
| 77 | 77 |
| 78 GLuint64 WebGLTimerQueryEXT::getQueryResult() | 78 GLuint64 WebGLTimerQueryEXT::getQueryResult() |
| 79 { | 79 { |
| 80 return m_queryResult; | 80 return m_queryResult; |
| 81 } | 81 } |
| 82 | 82 |
| 83 void WebGLTimerQueryEXT::deleteObjectImpl(WebGraphicsContext3D* context3d, gpu::
gles2::GLES2Interface* gl) | 83 void WebGLTimerQueryEXT::deleteObjectImpl(WebGraphicsContext3D* context3d, gpu::
gles2::GLES2Interface* gl) |
| 84 { | 84 { |
| 85 gl->DeleteQueriesEXT(1, &m_queryId); | 85 context3d->deleteQueryEXT(m_queryId); |
| 86 m_queryId = 0; | 86 m_queryId = 0; |
| 87 } | 87 } |
| 88 | 88 |
| 89 void WebGLTimerQueryEXT::registerTaskObserver() | 89 void WebGLTimerQueryEXT::registerTaskObserver() |
| 90 { | 90 { |
| 91 if (!m_taskObserverRegistered) { | 91 if (!m_taskObserverRegistered) { |
| 92 m_taskObserverRegistered = true; | 92 m_taskObserverRegistered = true; |
| 93 Platform::current()->currentThread()->addTaskObserver(this); | 93 Platform::current()->currentThread()->addTaskObserver(this); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 void WebGLTimerQueryEXT::unregisterTaskObserver() | 97 void WebGLTimerQueryEXT::unregisterTaskObserver() |
| 98 { | 98 { |
| 99 if (m_taskObserverRegistered) { | 99 if (m_taskObserverRegistered) { |
| 100 m_taskObserverRegistered = false; | 100 m_taskObserverRegistered = false; |
| 101 Platform::current()->currentThread()->removeTaskObserver(this); | 101 Platform::current()->currentThread()->removeTaskObserver(this); |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 void WebGLTimerQueryEXT::didProcessTask() | 105 void WebGLTimerQueryEXT::didProcessTask() |
| 106 { | 106 { |
| 107 m_canUpdateAvailability = true; | 107 m_canUpdateAvailability = true; |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace blink | 110 } // namespace blink |
| OLD | NEW |