Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLTimerQueryEXT.cpp

Issue 2547813002: Remove WebGLObject maps from WebGLRenderingContextBase and WebGLContextGroup. (Closed)
Patch Set: Fixed WebGLContextObject::validate. Made WebGLExtension non-finalized. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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() {
19 // See the comment in WebGLObject::detachAndDeleteObject().
20 detachAndDeleteObject();
21 }
22
23 WebGLTimerQueryEXT::WebGLTimerQueryEXT(WebGLRenderingContextBase* ctx) 18 WebGLTimerQueryEXT::WebGLTimerQueryEXT(WebGLRenderingContextBase* ctx)
24 : WebGLContextObject(ctx), 19 : WebGLContextObject(ctx),
25 m_target(0), 20 m_target(0),
26 m_queryId(0), 21 m_queryId(0),
27 m_canUpdateAvailability(false), 22 m_canUpdateAvailability(false),
28 m_queryResultAvailable(false), 23 m_queryResultAvailable(false),
29 m_queryResult(0), 24 m_queryResult(0),
30 m_taskRunner(TaskRunnerHelper::get(TaskType::Unthrottled, 25 m_taskRunner(TaskRunnerHelper::get(TaskType::Unthrottled,
31 &ctx->canvas()->document()) 26 &ctx->canvas()->document())
32 ->clone()) { 27 ->clone()) {
33 context()->contextGL()->GenQueriesEXT(1, &m_queryId); 28 context()->contextGL()->GenQueriesEXT(1, &m_queryId);
34 } 29 }
35 30
31 WebGLTimerQueryEXT::~WebGLTimerQueryEXT() {
32 runDestructor();
33 }
34
36 void WebGLTimerQueryEXT::resetCachedResult() { 35 void WebGLTimerQueryEXT::resetCachedResult() {
37 m_canUpdateAvailability = false; 36 m_canUpdateAvailability = false;
38 m_queryResultAvailable = false; 37 m_queryResultAvailable = false;
39 m_queryResult = 0; 38 m_queryResult = 0;
40 // When this is called, the implication is that we should start 39 // When this is called, the implication is that we should start
41 // keeping track of whether we can update the cached availability 40 // keeping track of whether we can update the cached availability
42 // and result. 41 // and result.
43 scheduleAllowAvailabilityUpdate(); 42 scheduleAllowAvailabilityUpdate();
44 } 43 }
45 44
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 m_taskHandle = m_taskRunner->postCancellableTask( 95 m_taskHandle = m_taskRunner->postCancellableTask(
97 BLINK_FROM_HERE, WTF::bind(&WebGLTimerQueryEXT::allowAvailabilityUpdate, 96 BLINK_FROM_HERE, WTF::bind(&WebGLTimerQueryEXT::allowAvailabilityUpdate,
98 wrapWeakPersistent(this))); 97 wrapWeakPersistent(this)));
99 } 98 }
100 99
101 void WebGLTimerQueryEXT::allowAvailabilityUpdate() { 100 void WebGLTimerQueryEXT::allowAvailabilityUpdate() {
102 m_canUpdateAvailability = true; 101 m_canUpdateAvailability = true;
103 } 102 }
104 103
105 } // namespace blink 104 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698