Index: Source/modules/webgl/WebGLFramebuffer.cpp |
diff --git a/Source/modules/webgl/WebGLFramebuffer.cpp b/Source/modules/webgl/WebGLFramebuffer.cpp |
index e9dee4049417d46953014e526d414bf565c1c9bd..d62069dc90d75d835a9f713f5b376f921b083666 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,11 @@ 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. |
+ // Attachments in |m_attachments| will be deleted from other places, so we |
+ // clear it to avoid deleting those attachments in detachAndDeleteObject(). |
+ m_attachments.clear(); |
+ |
+ // See the comment in WebGLObject::detachAndDeleteObject(). |
detachAndDeleteObject(); |
} |
@@ -581,17 +579,11 @@ 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 |
context3d->deleteFramebuffer(m_object); |
m_object = 0; |
@@ -663,9 +655,7 @@ bool WebGLFramebuffer::getReadBufferFormatAndType(GLenum* format, GLenum* type) |
DEFINE_TRACE(WebGLFramebuffer) |
{ |
-#if ENABLE(OILPAN) |
visitor->trace(m_attachments); |
-#endif |
WebGLContextObject::trace(visitor); |
} |