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

Unified Diff: Source/modules/webgl/WebGLFramebuffer.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/WebGLFramebuffer.h ('k') | Source/modules/webgl/WebGLFramebuffer.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webgl/WebGLFramebuffer.cpp
diff --git a/Source/modules/webgl/WebGLFramebuffer.cpp b/Source/modules/webgl/WebGLFramebuffer.cpp
index d62069dc90d75d835a9f713f5b376f921b083666..e9dee4049417d46953014e526d414bf565c1c9bd 100644
--- a/Source/modules/webgl/WebGLFramebuffer.cpp
+++ b/Source/modules/webgl/WebGLFramebuffer.cpp
@@ -38,7 +38,7 @@
class WebGLRenderbufferAttachment final : public WebGLFramebuffer::WebGLAttachment {
public:
- static WebGLFramebuffer::WebGLAttachment* create(WebGLRenderbuffer*);
+ static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLRenderbuffer*);
DECLARE_VIRTUAL_TRACE();
@@ -57,12 +57,12 @@
void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
- Member<WebGLRenderbuffer> m_renderbuffer;
+ RefPtrWillBeMember<WebGLRenderbuffer> m_renderbuffer;
};
-WebGLFramebuffer::WebGLAttachment* WebGLRenderbufferAttachment::create(WebGLRenderbuffer* renderbuffer)
-{
- return new WebGLRenderbufferAttachment(renderbuffer);
+PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLRenderbufferAttachment::create(WebGLRenderbuffer* renderbuffer)
+{
+ return adoptRefWillBeNoop(new WebGLRenderbufferAttachment(renderbuffer));
}
DEFINE_TRACE(WebGLRenderbufferAttachment)
@@ -140,13 +140,12 @@
GLenum WebGLRenderbufferAttachment::type() const
{
- notImplemented();
return 0;
}
class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment {
public:
- static WebGLFramebuffer::WebGLAttachment* create(WebGLTexture*, GLenum target, GLint level);
+ static PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> create(WebGLTexture*, GLenum target, GLint level);
DECLARE_VIRTUAL_TRACE();
@@ -165,14 +164,14 @@
void attach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
void unattach(WebGraphicsContext3D*, GLenum target, GLenum attachment) override;
- Member<WebGLTexture> m_texture;
+ RefPtrWillBeMember<WebGLTexture> m_texture;
GLenum m_target;
GLint m_level;
};
-WebGLFramebuffer::WebGLAttachment* WebGLTextureAttachment::create(WebGLTexture* texture, GLenum target, GLint level)
-{
- return new WebGLTextureAttachment(texture, target, level);
+PassRefPtrWillBeRawPtr<WebGLFramebuffer::WebGLAttachment> WebGLTextureAttachment::create(WebGLTexture* texture, GLenum target, GLint level)
+{
+ return adoptRefWillBeNoop(new WebGLTextureAttachment(texture, target, level));
}
DEFINE_TRACE(WebGLTextureAttachment)
@@ -325,9 +324,9 @@
{
}
-WebGLFramebuffer* WebGLFramebuffer::create(WebGLRenderingContextBase* ctx)
-{
- return new WebGLFramebuffer(ctx);
+PassRefPtrWillBeRawPtr<WebGLFramebuffer> WebGLFramebuffer::create(WebGLRenderingContextBase* ctx)
+{
+ return adoptRefWillBeNoop(new WebGLFramebuffer(ctx));
}
WebGLFramebuffer::WebGLFramebuffer(WebGLRenderingContextBase* ctx)
@@ -340,11 +339,14 @@
WebGLFramebuffer::~WebGLFramebuffer()
{
- // 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().
+ // 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.
detachAndDeleteObject();
}
@@ -579,11 +581,17 @@
void WebGLFramebuffer::deleteObjectImpl(WebGraphicsContext3D* context3d)
{
- // Both the AttachmentMap and its WebGLAttachment objects are GCed
- // objects and cannot be accessed, as they may have been finalized
+#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
// 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;
@@ -655,7 +663,9 @@
DEFINE_TRACE(WebGLFramebuffer)
{
+#if ENABLE(OILPAN)
visitor->trace(m_attachments);
+#endif
WebGLContextObject::trace(visitor);
}
« no previous file with comments | « Source/modules/webgl/WebGLFramebuffer.h ('k') | Source/modules/webgl/WebGLFramebuffer.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698