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

Unified Diff: Source/modules/webgl/WebGLVertexArrayObjectBase.cpp

Issue 1281953003: Revert of [Oilpan] Migrate classes under module/webgl onto oilpan heap (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/webgl/WebGLVertexArrayObjectBase.h ('k') | Source/modules/webgl/WebGLVertexArrayObjectOES.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webgl/WebGLVertexArrayObjectBase.cpp
diff --git a/Source/modules/webgl/WebGLVertexArrayObjectBase.cpp b/Source/modules/webgl/WebGLVertexArrayObjectBase.cpp
index 16d70507c15c69c5de7f82b2f6023035f4055c75..5f3d0c2ae6d61eff2c86d4bd3f2caebb5dcc2a0c 100644
--- a/Source/modules/webgl/WebGLVertexArrayObjectBase.cpp
+++ b/Source/modules/webgl/WebGLVertexArrayObjectBase.cpp
@@ -15,7 +15,9 @@
, m_object(0)
, m_type(type)
, m_hasEverBeenBound(false)
+#if ENABLE(OILPAN)
, m_destructionInProgress(false)
+#endif
, m_boundElementArrayBuffer(nullptr)
{
m_vertexAttribState.reserveCapacity(ctx->maxVertexAttribs());
@@ -31,12 +33,18 @@
WebGLVertexArrayObjectBase::~WebGLVertexArrayObjectBase()
{
+#if ENABLE(OILPAN)
m_destructionInProgress = true;
+#endif
- // Delete the platform framebuffer resource, in case
- // where this vertex array object isn't detached when it and
- // the WebGLRenderingContextBase object it is registered with
- // are both finalized.
+ // Delete the platform framebuffer resource. Explicit detachment
+ // is for the benefit of Oilpan, where this vertex array object
+ // isn't detached when it and the WebGLRenderingContextBase object
+ // it is registered with are both finalized. Without Oilpan, the
+ // object will have been detached.
+ //
+ // To keep the code regular, the trivial detach()ment is always
+ // performed.
detachAndDeleteObject();
}
@@ -63,15 +71,20 @@
break;
}
- // Member<> objects must not be accessed during the destruction,
- // since they could have been already finalized.
- // The finalizers of these objects will handle their detachment
- // by themselves.
+#if ENABLE(OILPAN)
+ // These m_boundElementArrayBuffer and m_vertexAttribState heap
+ // objects must not be accessed during destruction in the oilpan
+ // build. They could have been already finalized. The finalizers
+ // of these objects (and their elements) will themselves handle
+ // detachment.
if (!m_destructionInProgress)
dispatchDetached(context3d);
+#else
+ dispatchDetached(context3d);
+#endif
}
-void WebGLVertexArrayObjectBase::setElementArrayBuffer(WebGLBuffer* buffer)
+void WebGLVertexArrayObjectBase::setElementArrayBuffer(PassRefPtrWillBeRawPtr<WebGLBuffer> buffer)
{
if (buffer)
buffer->onAttached();
@@ -85,12 +98,12 @@
ASSERT(index < context()->maxVertexAttribs());
// Lazily create the vertex attribute states.
for (size_t i = m_vertexAttribState.size(); i <= index; i++)
- m_vertexAttribState.append(new VertexAttribState);
+ m_vertexAttribState.append(adoptPtrWillBeNoop(new VertexAttribState()));
return m_vertexAttribState[index].get();
}
void WebGLVertexArrayObjectBase::setVertexAttribState(
- GLuint index, GLsizei bytesPerElement, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset, WebGLBuffer* buffer)
+ GLuint index, GLsizei bytesPerElement, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset, PassRefPtrWillBeRawPtr<WebGLBuffer> buffer)
{
GLsizei validatedStride = stride ? stride : bytesPerElement;
VertexAttribState* state = getVertexAttribState(index);
@@ -110,7 +123,7 @@
state->offset = offset;
}
-void WebGLVertexArrayObjectBase::unbindBuffer(WebGLBuffer* buffer)
+void WebGLVertexArrayObjectBase::unbindBuffer(PassRefPtrWillBeRawPtr<WebGLBuffer> buffer)
{
if (m_boundElementArrayBuffer == buffer) {
m_boundElementArrayBuffer->onDetached(context()->webContext());
@@ -118,7 +131,7 @@
}
for (size_t i = 0; i < m_vertexAttribState.size(); ++i) {
- VertexAttribState* state = m_vertexAttribState[i];
+ VertexAttribState* state = m_vertexAttribState[i].get();
if (state->bufferBinding == buffer) {
buffer->onDetached(context()->webContext());
state->bufferBinding = nullptr;
« no previous file with comments | « Source/modules/webgl/WebGLVertexArrayObjectBase.h ('k') | Source/modules/webgl/WebGLVertexArrayObjectOES.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698