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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLQuery.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/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() {
19 // See the comment in WebGLObject::detachAndDeleteObject().
20 detachAndDeleteObject();
21 }
22
23 WebGLQuery::WebGLQuery(WebGL2RenderingContextBase* ctx) 18 WebGLQuery::WebGLQuery(WebGL2RenderingContextBase* ctx)
24 : WebGLSharedPlatform3DObject(ctx), 19 : WebGLSharedPlatform3DObject(ctx),
25 m_target(0), 20 m_target(0),
26 m_canUpdateAvailability(false), 21 m_canUpdateAvailability(false),
27 m_queryResultAvailable(false), 22 m_queryResultAvailable(false),
28 m_queryResult(0), 23 m_queryResult(0),
29 m_taskRunner(TaskRunnerHelper::get(TaskType::Unthrottled, 24 m_taskRunner(TaskRunnerHelper::get(TaskType::Unthrottled,
30 &ctx->canvas()->document()) 25 &ctx->canvas()->document())
31 ->clone()) { 26 ->clone()) {
32 GLuint query; 27 GLuint query;
33 ctx->contextGL()->GenQueriesEXT(1, &query); 28 ctx->contextGL()->GenQueriesEXT(1, &query);
34 setObject(query); 29 setObject(query);
35 } 30 }
36 31
32 WebGLQuery::~WebGLQuery() {
33 runDestructor();
34 }
35
37 void WebGLQuery::setTarget(GLenum target) { 36 void WebGLQuery::setTarget(GLenum target) {
38 ASSERT(object()); 37 ASSERT(object());
39 ASSERT(!m_target); 38 ASSERT(!m_target);
40 m_target = target; 39 m_target = target;
41 } 40 }
42 41
43 void WebGLQuery::deleteObjectImpl(gpu::gles2::GLES2Interface* gl) { 42 void WebGLQuery::deleteObjectImpl(gpu::gles2::GLES2Interface* gl) {
44 gl->DeleteQueriesEXT(1, &m_object); 43 gl->DeleteQueriesEXT(1, &m_object);
45 m_object = 0; 44 m_object = 0;
46 } 45 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 m_taskHandle = m_taskRunner->postCancellableTask( 93 m_taskHandle = m_taskRunner->postCancellableTask(
95 BLINK_FROM_HERE, WTF::bind(&WebGLQuery::allowAvailabilityUpdate, 94 BLINK_FROM_HERE, WTF::bind(&WebGLQuery::allowAvailabilityUpdate,
96 wrapWeakPersistent(this))); 95 wrapWeakPersistent(this)));
97 } 96 }
98 97
99 void WebGLQuery::allowAvailabilityUpdate() { 98 void WebGLQuery::allowAvailabilityUpdate() {
100 m_canUpdateAvailability = true; 99 m_canUpdateAvailability = true;
101 } 100 }
102 101
103 } // namespace blink 102 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698