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

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

Issue 1817323003: Revert of Remove create/delete methods from WebGraphicsContext3D. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@complex-casts
Patch Set: Created 4 years, 9 months 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/WebGLVertexArrayObjectBase.h" 5 #include "modules/webgl/WebGLVertexArrayObjectBase.h"
6 6
7 #include "gpu/command_buffer/client/gles2_interface.h"
8 #include "modules/webgl/WebGLRenderingContextBase.h" 7 #include "modules/webgl/WebGLRenderingContextBase.h"
9 8
10 namespace blink { 9 namespace blink {
11 10
12 WebGLVertexArrayObjectBase::WebGLVertexArrayObjectBase(WebGLRenderingContextBase * ctx, VaoType type) 11 WebGLVertexArrayObjectBase::WebGLVertexArrayObjectBase(WebGLRenderingContextBase * ctx, VaoType type)
13 : WebGLContextObject(ctx) 12 : WebGLContextObject(ctx)
14 , m_object(0) 13 , m_object(0)
15 , m_type(type) 14 , m_type(type)
16 , m_hasEverBeenBound(false) 15 , m_hasEverBeenBound(false)
17 , m_destructionInProgress(false) 16 , m_destructionInProgress(false)
18 , m_boundElementArrayBuffer(nullptr) 17 , m_boundElementArrayBuffer(nullptr)
19 { 18 {
20 m_arrayBufferList.resize(ctx->maxVertexAttribs()); 19 m_arrayBufferList.resize(ctx->maxVertexAttribs());
21 20
22 switch (m_type) { 21 switch (m_type) {
23 case VaoTypeDefault: 22 case VaoTypeDefault:
24 break; 23 break;
25 default: 24 default:
26 context()->contextGL()->GenVertexArraysOES(1, &m_object); 25 m_object = context()->webContext()->createVertexArrayOES();
27 break; 26 break;
28 } 27 }
29 } 28 }
30 29
31 WebGLVertexArrayObjectBase::~WebGLVertexArrayObjectBase() 30 WebGLVertexArrayObjectBase::~WebGLVertexArrayObjectBase()
32 { 31 {
33 m_destructionInProgress = true; 32 m_destructionInProgress = true;
34 33
35 // Delete the platform framebuffer resource, in case 34 // Delete the platform framebuffer resource, in case
36 // where this vertex array object isn't detached when it and 35 // where this vertex array object isn't detached when it and
(...skipping 12 matching lines...) Expand all
49 m_arrayBufferList[i]->onDetached(context3d, gl); 48 m_arrayBufferList[i]->onDetached(context3d, gl);
50 } 49 }
51 } 50 }
52 51
53 void WebGLVertexArrayObjectBase::deleteObjectImpl(WebGraphicsContext3D* context3 d, gpu::gles2::GLES2Interface* gl) 52 void WebGLVertexArrayObjectBase::deleteObjectImpl(WebGraphicsContext3D* context3 d, gpu::gles2::GLES2Interface* gl)
54 { 53 {
55 switch (m_type) { 54 switch (m_type) {
56 case VaoTypeDefault: 55 case VaoTypeDefault:
57 break; 56 break;
58 default: 57 default:
59 gl->DeleteVertexArraysOES(1, &m_object); 58 context3d->deleteVertexArrayOES(m_object);
60 m_object = 0; 59 m_object = 0;
61 break; 60 break;
62 } 61 }
63 62
64 // Member<> objects must not be accessed during the destruction, 63 // Member<> objects must not be accessed during the destruction,
65 // since they could have been already finalized. 64 // since they could have been already finalized.
66 // The finalizers of these objects will handle their detachment 65 // The finalizers of these objects will handle their detachment
67 // by themselves. 66 // by themselves.
68 if (!m_destructionInProgress) 67 if (!m_destructionInProgress)
69 dispatchDetached(context3d, gl); 68 dispatchDetached(context3d, gl);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 109 }
111 110
112 DEFINE_TRACE(WebGLVertexArrayObjectBase) 111 DEFINE_TRACE(WebGLVertexArrayObjectBase)
113 { 112 {
114 visitor->trace(m_boundElementArrayBuffer); 113 visitor->trace(m_boundElementArrayBuffer);
115 visitor->trace(m_arrayBufferList); 114 visitor->trace(m_arrayBufferList);
116 WebGLContextObject::trace(visitor); 115 WebGLContextObject::trace(visitor);
117 } 116 }
118 117
119 } // namespace blink 118 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698