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 "core/dom/TaskRunnerHelper.h" | 7 #include "core/dom/TaskRunnerHelper.h" |
8 #include "gpu/command_buffer/client/gles2_interface.h" | 8 #include "gpu/command_buffer/client/gles2_interface.h" |
9 #include "modules/webgl/WebGL2RenderingContextBase.h" | 9 #include "modules/webgl/WebGL2RenderingContextBase.h" |
10 #include "public/platform/Platform.h" | 10 #include "public/platform/Platform.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 WebGLQuery* WebGLQuery::create(WebGL2RenderingContextBase* ctx) { | 14 WebGLQuery* WebGLQuery::create(WebGL2RenderingContextBase* ctx) { |
15 return new WebGLQuery(ctx); | 15 return new WebGLQuery(ctx); |
16 } | 16 } |
17 | 17 |
18 WebGLQuery::WebGLQuery(WebGL2RenderingContextBase* ctx) | 18 WebGLQuery::WebGLQuery(WebGL2RenderingContextBase* ctx) |
19 : WebGLSharedPlatform3DObject(ctx), | 19 : WebGLSharedPlatform3DObject(ctx), |
20 m_target(0), | 20 m_target(0), |
21 m_canUpdateAvailability(false), | 21 m_canUpdateAvailability(false), |
22 m_queryResultAvailable(false), | 22 m_queryResultAvailable(false), |
23 m_queryResult(0), | 23 m_queryResult(0), |
24 m_taskRunner(TaskRunnerHelper::get(TaskType::Unthrottled, | 24 m_taskRunner(TaskRunnerHelper::get(TaskType::Unthrottled, |
25 &ctx->canvas()->document()) | 25 &ctx->canvas()->document())) { |
26 ->clone()) { | |
27 GLuint query; | 26 GLuint query; |
28 ctx->contextGL()->GenQueriesEXT(1, &query); | 27 ctx->contextGL()->GenQueriesEXT(1, &query); |
29 setObject(query); | 28 setObject(query); |
30 } | 29 } |
31 | 30 |
32 WebGLQuery::~WebGLQuery() { | 31 WebGLQuery::~WebGLQuery() { |
33 runDestructor(); | 32 runDestructor(); |
34 } | 33 } |
35 | 34 |
36 void WebGLQuery::setTarget(GLenum target) { | 35 void WebGLQuery::setTarget(GLenum target) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 m_taskHandle = m_taskRunner->postCancellableTask( | 92 m_taskHandle = m_taskRunner->postCancellableTask( |
94 BLINK_FROM_HERE, WTF::bind(&WebGLQuery::allowAvailabilityUpdate, | 93 BLINK_FROM_HERE, WTF::bind(&WebGLQuery::allowAvailabilityUpdate, |
95 wrapWeakPersistent(this))); | 94 wrapWeakPersistent(this))); |
96 } | 95 } |
97 | 96 |
98 void WebGLQuery::allowAvailabilityUpdate() { | 97 void WebGLQuery::allowAvailabilityUpdate() { |
99 m_canUpdateAvailability = true; | 98 m_canUpdateAvailability = true; |
100 } | 99 } |
101 | 100 |
102 } // namespace blink | 101 } // namespace blink |
OLD | NEW |