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

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

Issue 2273683003: Use visitDOMWrapper to preserve WebGL JS object wrappers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: style Created 4 years, 3 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 #ifndef WebGLVertexArrayObjectBase_h 5 #ifndef WebGLVertexArrayObjectBase_h
6 #define WebGLVertexArrayObjectBase_h 6 #define WebGLVertexArrayObjectBase_h
7 7
8 #include "bindings/core/v8/ScopedPersistent.h"
9 #include "modules/webgl/WebGLBuffer.h" 8 #include "modules/webgl/WebGLBuffer.h"
10 #include "modules/webgl/WebGLContextObject.h" 9 #include "modules/webgl/WebGLContextObject.h"
11 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
12 11
13 namespace blink { 12 namespace blink {
14 13
15 class WebGLVertexArrayObjectBase : public WebGLContextObject { 14 class WebGLVertexArrayObjectBase : public WebGLContextObject {
16 public: 15 public:
17 enum VaoType { 16 enum VaoType {
18 VaoTypeDefault, 17 VaoTypeDefault,
(...skipping 12 matching lines...) Expand all
31 WebGLBuffer* boundElementArrayBuffer() const { return m_boundElementArrayBuf fer; } 30 WebGLBuffer* boundElementArrayBuffer() const { return m_boundElementArrayBuf fer; }
32 void setElementArrayBuffer(WebGLBuffer*); 31 void setElementArrayBuffer(WebGLBuffer*);
33 32
34 WebGLBuffer* getArrayBufferForAttrib(size_t); 33 WebGLBuffer* getArrayBufferForAttrib(size_t);
35 void setArrayBufferForAttrib(GLuint, WebGLBuffer*); 34 void setArrayBufferForAttrib(GLuint, WebGLBuffer*);
36 void setAttribEnabled(GLuint, bool); 35 void setAttribEnabled(GLuint, bool);
37 bool getAttribEnabled(GLuint) const; 36 bool getAttribEnabled(GLuint) const;
38 bool isAllEnabledAttribBufferBound() const { return m_isAllEnabledAttribBuff erBound; } 37 bool isAllEnabledAttribBufferBound() const { return m_isAllEnabledAttribBuff erBound; }
39 void unbindBuffer(WebGLBuffer*); 38 void unbindBuffer(WebGLBuffer*);
40 39
41 ScopedPersistent<v8::Array>* getPersistentCache(); 40 virtual void visitChildDOMWrappers(v8::Isolate*, const v8::Persistent<v8::Ob ject>&);
42 41
43 DECLARE_VIRTUAL_TRACE(); 42 DECLARE_VIRTUAL_TRACE();
44 43
45 protected: 44 protected:
46 WebGLVertexArrayObjectBase(WebGLRenderingContextBase*, VaoType); 45 WebGLVertexArrayObjectBase(WebGLRenderingContextBase*, VaoType);
47 46
48 private: 47 private:
49 void dispatchDetached(gpu::gles2::GLES2Interface*); 48 void dispatchDetached(gpu::gles2::GLES2Interface*);
50 bool hasObject() const override { return m_object != 0; } 49 bool hasObject() const override { return m_object != 0; }
51 void deleteObjectImpl(gpu::gles2::GLES2Interface*) override; 50 void deleteObjectImpl(gpu::gles2::GLES2Interface*) override;
52 51
53 void updateAttribBufferBoundStatus(); 52 void updateAttribBufferBoundStatus();
54 53
55 GLuint m_object; 54 GLuint m_object;
56 55
57 VaoType m_type; 56 VaoType m_type;
58 bool m_hasEverBeenBound; 57 bool m_hasEverBeenBound;
59 bool m_destructionInProgress; 58 bool m_destructionInProgress;
60 Member<WebGLBuffer> m_boundElementArrayBuffer; 59 Member<WebGLBuffer> m_boundElementArrayBuffer;
61 HeapVector<Member<WebGLBuffer>> m_arrayBufferList; 60 HeapVector<Member<WebGLBuffer>> m_arrayBufferList;
62 Vector<bool> m_attribEnabled; 61 Vector<bool> m_attribEnabled;
63 bool m_isAllEnabledAttribBufferBound; 62 bool m_isAllEnabledAttribBufferBound;
64
65 // For preserving the wrappers of WebGLBuffer objects latched in
66 // via vertexAttribPointer calls.
67 ScopedPersistent<v8::Array> m_arrayBufferWrappers;
68 }; 63 };
69 64
70 } // namespace blink 65 } // namespace blink
71 66
72 #endif // WebGLVertexArrayObjectBase_h 67 #endif // WebGLVertexArrayObjectBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698