Chromium Code Reviews| Index: Source/core/html/canvas/WebGLObject.cpp |
| diff --git a/Source/core/html/canvas/WebGLObject.cpp b/Source/core/html/canvas/WebGLObject.cpp |
| index bcc8adc3e9dcf171d5ec2b735ef97a69bf0ea79a..353eea27c731aed30900b0760f4d7d206ba6640d 100644 |
| --- a/Source/core/html/canvas/WebGLObject.cpp |
| +++ b/Source/core/html/canvas/WebGLObject.cpp |
| @@ -29,7 +29,7 @@ |
| namespace blink { |
| -WebGLObject::WebGLObject(WebGLRenderingContextBase*) |
| +WebGLObject::WebGLObject(WebGLRenderingContextBase* base) |
|
haraken
2014/07/22 03:46:10
|base| is not needed.
sof
2014/07/22 06:15:21
Removed.
|
| : m_object(0) |
| , m_attachmentCount(0) |
| , m_deleted(false) |
| @@ -38,6 +38,10 @@ WebGLObject::WebGLObject(WebGLRenderingContextBase*) |
| WebGLObject::~WebGLObject() |
| { |
| +#if ENABLE(OILPAN) |
|
haraken
2014/07/22 03:46:10
Do we need #if ENABLE(OILPAN)? I guess ASSERT(m_de
sof
2014/07/22 06:15:21
I made it condition to avoid needlessly upsetting
|
| + // Verify that platform objects have been explicitly deleted. |
| + ASSERT(m_deleted); |
| +#endif |
| } |
| void WebGLObject::setObject(Platform3DObject object) |
| @@ -70,8 +74,25 @@ void WebGLObject::deleteObject(blink::WebGraphicsContext3D* context3d) |
| void WebGLObject::detach() |
| { |
| m_attachmentCount = 0; // Make sure OpenGL resource is deleted. |
| - } |
| +} |
| +void WebGLObject::detachAndDeleteObject() |
| +{ |
| + // Helper method that pairs detachment with platform object |
| + // deletion. |
| + // |
| + // With Oilpan enabled, objects may end up being finalized without |
| + // having been detached first. Consequently, the objects force |
| + // detachment first before deleting the platform object. Without |
| + // Oilpan, the objects will have been detached from the 'parent' |
| + // objects first and do not separately require it when finalizing. |
| + // |
| + // However, as detach() is trivial, the individual WebGL |
| + // destructors will always call detachAndDeleteObject() rather |
| + // than do it based on Oilpan being enabled. |
| + detach(); |
| + deleteObject(0); |
| +} |
| void WebGLObject::onDetached(blink::WebGraphicsContext3D* context3d) |
| { |