Chromium Code Reviews| Index: Source/modules/webgl/WebGLFramebuffer.cpp |
| diff --git a/Source/modules/webgl/WebGLFramebuffer.cpp b/Source/modules/webgl/WebGLFramebuffer.cpp |
| index e9dee4049417d46953014e526d414bf565c1c9bd..a93ed371d0c278df662ce2319dc92fa2bbf7fcb0 100644 |
| --- a/Source/modules/webgl/WebGLFramebuffer.cpp |
| +++ b/Source/modules/webgl/WebGLFramebuffer.cpp |
| @@ -38,7 +38,7 @@ namespace { |
| class WebGLRenderbufferAttachment final : public WebGLFramebuffer::WebGLAttachment { |
| public: |
| - static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLRenderbuffer*); |
| + static WebGLFramebuffer::WebGLAttachment* create(WebGLRenderbuffer*); |
| DECLARE_VIRTUAL_TRACE(); |
| @@ -57,12 +57,12 @@ private: |
| void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override; |
| void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override; |
| - RefPtrWillBeMember<WebGLRenderbuffer> m_renderbuffer; |
| + Member<WebGLRenderbuffer> m_renderbuffer; |
| }; |
| -PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLRenderbufferAttachment::create(WebGLRenderbuffer* renderbuffer) |
| +WebGLFramebuffer::WebGLAttachment* WebGLRenderbufferAttachment::create(WebGLRenderbuffer* renderbuffer) |
| { |
| - return adoptRefWillBeNoop(new WebGLRenderbufferAttachment(renderbuffer)); |
| + return new WebGLRenderbufferAttachment(renderbuffer); |
| } |
| DEFINE_TRACE(WebGLRenderbufferAttachment) |
| @@ -140,12 +140,13 @@ void WebGLRenderbufferAttachment::unattach(WebGraphicsContext3D* context, GLenum |
| GLenum WebGLRenderbufferAttachment::type() const |
| { |
| + notImplemented(); |
| return 0; |
| } |
| class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment { |
| public: |
| - static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLTexture*, GLenum target, GLint level); |
| + static WebGLFramebuffer::WebGLAttachment* create(WebGLTexture*, GLenum target, GLint level); |
| DECLARE_VIRTUAL_TRACE(); |
| @@ -164,14 +165,14 @@ private: |
| void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override; |
| void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override; |
| - RefPtrWillBeMember<WebGLTexture> m_texture; |
| + Member<WebGLTexture> m_texture; |
| GLenum m_target; |
| GLint m_level; |
| }; |
| -PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLTextureAttachment::create(WebGLTexture* texture, GLenum target, GLint level) |
| +WebGLFramebuffer::WebGLAttachment* WebGLTextureAttachment::create(WebGLTexture* texture, GLenum target, GLint level) |
| { |
| - return adoptRefWillBeNoop(new WebGLTextureAttachment(texture, target, level)); |
| + return new WebGLTextureAttachment(texture, target, level); |
| } |
| DEFINE_TRACE(WebGLTextureAttachment) |
| @@ -324,9 +325,9 @@ WebGLFramebuffer::WebGLAttachment::~WebGLAttachment() |
| { |
| } |
| -PassRefPtrWillBeRawPtr<WebGLFramebuffer> WebGLFramebuffer::create(WebGLRenderingContextBase* ctx) |
| +WebGLFramebuffer* WebGLFramebuffer::create(WebGLRenderingContextBase* ctx) |
| { |
| - return adoptRefWillBeNoop(new WebGLFramebuffer(ctx)); |
| + return new WebGLFramebuffer(ctx); |
| } |
| WebGLFramebuffer::WebGLFramebuffer(WebGLRenderingContextBase* ctx) |
| @@ -339,14 +340,9 @@ WebGLFramebuffer::WebGLFramebuffer(WebGLRenderingContextBase* ctx) |
| WebGLFramebuffer::~WebGLFramebuffer() |
| { |
| - // Delete the platform framebuffer resource. Explicit detachment |
| - // is for the benefit of Oilpan, where the framebuffer 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. |
| + m_attachments.clear(); |
|
sof
2015/08/06 06:46:30
Could you add a comment next to this explaining pu
peria
2015/08/06 07:38:46
Done.
|
| + |
| + // See the comment in WebGLObject::detachAndDeleteObject(). |
| detachAndDeleteObject(); |
| } |
| @@ -581,17 +577,17 @@ bool WebGLFramebuffer::hasStencilBuffer() const |
| void WebGLFramebuffer::deleteObjectImpl(WebGraphicsContext3D* context3d) |
| { |
| -#if !ENABLE(OILPAN) |
| - // With Oilpan, both the AttachmentMap and its WebGLAttachment objects are |
| - // GCed objects and cannot be accessed, as they may have been finalized |
| + // Both the AttachmentMap and its WebGLAttachment objects are GCed |
| + // objects and cannot be accessed, as they may have been finalized |
| // already during the same GC sweep. |
| // |
| // The WebGLAttachment-derived classes instead handle detachment |
| // on their own when finalizing, so the explicit notification is |
| // not needed. |
| - for (const auto& attachment : m_attachments) |
| - attachment.value->onDetached(context3d); |
| -#endif |
| + if (!m_attachments.isEmpty()) { |
| + for (const auto& attachment : m_attachments) |
| + attachment.value->onDetached(context3d); |
| + } |
| context3d->deleteFramebuffer(m_object); |
| m_object = 0; |
| @@ -663,9 +659,7 @@ bool WebGLFramebuffer::getReadBufferFormatAndType(GLenum* format, GLenum* type) |
| DEFINE_TRACE(WebGLFramebuffer) |
| { |
| -#if ENABLE(OILPAN) |
| visitor->trace(m_attachments); |
| -#endif |
| WebGLContextObject::trace(visitor); |
| } |