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 "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/WebGLRenderingContextBase.h" | 9 #include "modules/webgl/WebGLRenderingContextBase.h" |
10 #include "public/platform/Platform.h" | 10 #include "public/platform/Platform.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 WebGLTimerQueryEXT* WebGLTimerQueryEXT::create(WebGLRenderingContextBase* ctx) { | 14 WebGLTimerQueryEXT* WebGLTimerQueryEXT::create(WebGLRenderingContextBase* ctx) { |
15 return new WebGLTimerQueryEXT(ctx); | 15 return new WebGLTimerQueryEXT(ctx); |
16 } | 16 } |
17 | 17 |
18 WebGLTimerQueryEXT::WebGLTimerQueryEXT(WebGLRenderingContextBase* ctx) | 18 WebGLTimerQueryEXT::WebGLTimerQueryEXT(WebGLRenderingContextBase* ctx) |
19 : WebGLContextObject(ctx), | 19 : WebGLContextObject(ctx), |
20 m_target(0), | 20 m_target(0), |
21 m_queryId(0), | 21 m_queryId(0), |
22 m_canUpdateAvailability(false), | 22 m_canUpdateAvailability(false), |
23 m_queryResultAvailable(false), | 23 m_queryResultAvailable(false), |
24 m_queryResult(0), | 24 m_queryResult(0), |
25 m_taskRunner(TaskRunnerHelper::get(TaskType::Unthrottled, | 25 m_taskRunner(TaskRunnerHelper::get(TaskType::Unthrottled, |
26 &ctx->canvas()->document()) | 26 &ctx->canvas()->document())) { |
27 ->clone()) { | |
28 context()->contextGL()->GenQueriesEXT(1, &m_queryId); | 27 context()->contextGL()->GenQueriesEXT(1, &m_queryId); |
29 } | 28 } |
30 | 29 |
31 WebGLTimerQueryEXT::~WebGLTimerQueryEXT() { | 30 WebGLTimerQueryEXT::~WebGLTimerQueryEXT() { |
32 runDestructor(); | 31 runDestructor(); |
33 } | 32 } |
34 | 33 |
35 void WebGLTimerQueryEXT::resetCachedResult() { | 34 void WebGLTimerQueryEXT::resetCachedResult() { |
36 m_canUpdateAvailability = false; | 35 m_canUpdateAvailability = false; |
37 m_queryResultAvailable = false; | 36 m_queryResultAvailable = false; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 m_taskHandle = m_taskRunner->postCancellableTask( | 94 m_taskHandle = m_taskRunner->postCancellableTask( |
96 BLINK_FROM_HERE, WTF::bind(&WebGLTimerQueryEXT::allowAvailabilityUpdate, | 95 BLINK_FROM_HERE, WTF::bind(&WebGLTimerQueryEXT::allowAvailabilityUpdate, |
97 wrapWeakPersistent(this))); | 96 wrapWeakPersistent(this))); |
98 } | 97 } |
99 | 98 |
100 void WebGLTimerQueryEXT::allowAvailabilityUpdate() { | 99 void WebGLTimerQueryEXT::allowAvailabilityUpdate() { |
101 m_canUpdateAvailability = true; | 100 m_canUpdateAvailability = true; |
102 } | 101 } |
103 | 102 |
104 } // namespace blink | 103 } // namespace blink |
OLD | NEW |