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 #ifndef WebGLQuery_h | 5 #ifndef WebGLQuery_h |
6 #define WebGLQuery_h | 6 #define WebGLQuery_h |
7 | 7 |
8 #include "modules/webgl/WebGLSharedPlatform3DObject.h" | 8 #include "modules/webgl/WebGLSharedPlatform3DObject.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 class WebGL2RenderingContextBase; | 12 class WebGL2RenderingContextBase; |
13 | 13 |
14 class WebGLQuery : public WebGLSharedPlatform3DObject { | 14 class WebGLQuery : public WebGLSharedPlatform3DObject, public WebThread::TaskObs
erver { |
15 DEFINE_WRAPPERTYPEINFO(); | 15 DEFINE_WRAPPERTYPEINFO(); |
16 public: | 16 public: |
17 ~WebGLQuery() override; | 17 ~WebGLQuery() override; |
18 | 18 |
19 static WebGLQuery* create(WebGL2RenderingContextBase*); | 19 static WebGLQuery* create(WebGL2RenderingContextBase*); |
20 | 20 |
21 void setTarget(GLenum); | 21 void setTarget(GLenum); |
| 22 bool hasTarget() const { return m_target != 0; } |
22 GLenum getTarget() const { return m_target; } | 23 GLenum getTarget() const { return m_target; } |
23 | 24 |
| 25 void resetCachedResult(); |
| 26 void updateCachedResult(WebGraphicsContext3D*); |
| 27 |
| 28 bool isQueryResultAvailable(); |
| 29 GLuint getQueryResult(); |
| 30 |
24 protected: | 31 protected: |
25 explicit WebGLQuery(WebGL2RenderingContextBase*); | 32 explicit WebGLQuery(WebGL2RenderingContextBase*); |
26 | 33 |
27 void deleteObjectImpl(WebGraphicsContext3D*) override; | 34 void deleteObjectImpl(WebGraphicsContext3D*) override; |
28 | 35 |
29 private: | 36 private: |
30 bool isQuery() const override { return true; } | 37 bool isQuery() const override { return true; } |
31 | 38 |
| 39 void registerTaskObserver(); |
| 40 void unregisterTaskObserver(); |
| 41 |
| 42 // TaskObserver implementation. |
| 43 void didProcessTask() override; |
| 44 void willProcessTask() override { } |
| 45 |
32 GLenum m_target; | 46 GLenum m_target; |
| 47 |
| 48 bool m_taskObserverRegistered; |
| 49 bool m_canUpdateAvailability; |
| 50 bool m_queryResultAvailable; |
| 51 GLuint m_queryResult; |
33 }; | 52 }; |
34 | 53 |
35 } // namespace blink | 54 } // namespace blink |
36 | 55 |
37 #endif // WebGLQuery_h | 56 #endif // WebGLQuery_h |
OLD | NEW |