Index: Source/modules/webgl/WebGLBuffer.cpp |
diff --git a/Source/modules/webgl/WebGLBuffer.cpp b/Source/modules/webgl/WebGLBuffer.cpp |
index 0969b7b8983abc6cf31e5d5cec766228e1b141b4..4744cd162f998f72a157dd00be8a6df6b074cbf1 100644 |
--- a/Source/modules/webgl/WebGLBuffer.cpp |
+++ b/Source/modules/webgl/WebGLBuffer.cpp |
@@ -31,9 +31,9 @@ |
namespace blink { |
-WebGLBuffer* WebGLBuffer::create(WebGLRenderingContextBase* ctx) |
+PassRefPtrWillBeRawPtr<WebGLBuffer> WebGLBuffer::create(WebGLRenderingContextBase* ctx) |
{ |
- return new WebGLBuffer(ctx); |
+ return adoptRefWillBeNoop(new WebGLBuffer(ctx)); |
} |
WebGLBuffer::WebGLBuffer(WebGLRenderingContextBase* ctx) |
@@ -45,7 +45,15 @@ |
WebGLBuffer::~WebGLBuffer() |
{ |
- // See the comment in WebGLObject::detachAndDeleteObject(). |
+ // Delete the buffer's platform object. This object will have been |
+ // detached from the WebGLContextGroup if the group object was |
+ // finalized first. With Oilpan not enabled, it always will be, |
+ // but with Oilpan enabled, the WebGLBuffer might end up being |
+ // finalized first. In which case detachment is needed to ensure |
+ // that the platform object is indeed deleted. |
+ // |
+ // To keep the code regular, the trivial detach()ment is always |
+ // performed. |
detachAndDeleteObject(); |
} |