Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 /* | 1 /* | 
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 
| 3 * | 3 * | 
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without | 
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions | 
| 6 * are met: | 6 * are met: | 
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright | 
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. | 
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright | 
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the | 
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 namespace blink { | 33 namespace blink { | 
| 34 | 34 | 
| 35 namespace { | 35 namespace { | 
| 36 | 36 | 
| 37 class WebGLRenderbufferAttachment final | 37 class WebGLRenderbufferAttachment final | 
| 38 : public WebGLFramebuffer::WebGLAttachment { | 38 : public WebGLFramebuffer::WebGLAttachment { | 
| 39 public: | 39 public: | 
| 40 static WebGLFramebuffer::WebGLAttachment* create(WebGLRenderbuffer*); | 40 static WebGLFramebuffer::WebGLAttachment* create(WebGLRenderbuffer*); | 
| 41 | 41 | 
| 42 DECLARE_VIRTUAL_TRACE(); | 42 DECLARE_VIRTUAL_TRACE(); | 
| 43 DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() { | |
| 44 visitor->traceWrappers(m_renderbuffer); | |
| 45 } | |
| 43 | 46 | 
| 44 private: | 47 private: | 
| 45 explicit WebGLRenderbufferAttachment(WebGLRenderbuffer*); | 48 explicit WebGLRenderbufferAttachment(WebGLRenderbuffer*); | 
| 46 WebGLRenderbufferAttachment() {} | 49 WebGLRenderbufferAttachment() : m_renderbuffer(this, nullptr) {} | 
| 47 | 50 | 
| 48 WebGLSharedObject* object() const override; | 51 WebGLSharedObject* object() const override; | 
| 49 bool isSharedObject(WebGLSharedObject*) const override; | 52 bool isSharedObject(WebGLSharedObject*) const override; | 
| 50 bool valid() const override; | 53 bool valid() const override; | 
| 51 void onDetached(gpu::gles2::GLES2Interface*) override; | 54 void onDetached(gpu::gles2::GLES2Interface*) override; | 
| 52 void attach(gpu::gles2::GLES2Interface*, | 55 void attach(gpu::gles2::GLES2Interface*, | 
| 53 GLenum target, | 56 GLenum target, | 
| 54 GLenum attachment) override; | 57 GLenum attachment) override; | 
| 55 void unattach(gpu::gles2::GLES2Interface*, | 58 void unattach(gpu::gles2::GLES2Interface*, | 
| 56 GLenum target, | 59 GLenum target, | 
| 57 GLenum attachment) override; | 60 GLenum attachment) override; | 
| 58 | 61 | 
| 59 Member<WebGLRenderbuffer> m_renderbuffer; | 62 TraceWrapperMember<WebGLRenderbuffer> m_renderbuffer; | 
| 
 
haraken
2016/11/30 14:30:35
How did you notice that these things need to be Tr
 
Michael Lippautz
2016/11/30 15:09:06
visitChildDOMWrappers on WebGLFrameBuffer and the
 
 | |
| 60 }; | 63 }; | 
| 61 | 64 | 
| 62 WebGLFramebuffer::WebGLAttachment* WebGLRenderbufferAttachment::create( | 65 WebGLFramebuffer::WebGLAttachment* WebGLRenderbufferAttachment::create( | 
| 63 WebGLRenderbuffer* renderbuffer) { | 66 WebGLRenderbuffer* renderbuffer) { | 
| 64 return new WebGLRenderbufferAttachment(renderbuffer); | 67 return new WebGLRenderbufferAttachment(renderbuffer); | 
| 65 } | 68 } | 
| 66 | 69 | 
| 67 DEFINE_TRACE(WebGLRenderbufferAttachment) { | 70 DEFINE_TRACE(WebGLRenderbufferAttachment) { | 
| 68 visitor->trace(m_renderbuffer); | 71 visitor->trace(m_renderbuffer); | 
| 69 WebGLFramebuffer::WebGLAttachment::trace(visitor); | 72 WebGLFramebuffer::WebGLAttachment::trace(visitor); | 
| 70 } | 73 } | 
| 71 | 74 | 
| 72 WebGLRenderbufferAttachment::WebGLRenderbufferAttachment( | 75 WebGLRenderbufferAttachment::WebGLRenderbufferAttachment( | 
| 73 WebGLRenderbuffer* renderbuffer) | 76 WebGLRenderbuffer* renderbuffer) | 
| 74 : m_renderbuffer(renderbuffer) {} | 77 : m_renderbuffer(this, renderbuffer) {} | 
| 75 | 78 | 
| 76 WebGLSharedObject* WebGLRenderbufferAttachment::object() const { | 79 WebGLSharedObject* WebGLRenderbufferAttachment::object() const { | 
| 77 return m_renderbuffer->object() ? m_renderbuffer.get() : 0; | 80 return m_renderbuffer->object() ? m_renderbuffer.get() : 0; | 
| 78 } | 81 } | 
| 79 | 82 | 
| 80 bool WebGLRenderbufferAttachment::isSharedObject( | 83 bool WebGLRenderbufferAttachment::isSharedObject( | 
| 81 WebGLSharedObject* object) const { | 84 WebGLSharedObject* object) const { | 
| 82 return object == m_renderbuffer; | 85 return object == m_renderbuffer; | 
| 83 } | 86 } | 
| 84 | 87 | 
| (...skipping 19 matching lines...) Expand all Loading... | |
| 104 } | 107 } | 
| 105 | 108 | 
| 106 class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment { | 109 class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment { | 
| 107 public: | 110 public: | 
| 108 static WebGLFramebuffer::WebGLAttachment* create(WebGLTexture*, | 111 static WebGLFramebuffer::WebGLAttachment* create(WebGLTexture*, | 
| 109 GLenum target, | 112 GLenum target, | 
| 110 GLint level, | 113 GLint level, | 
| 111 GLint layer); | 114 GLint layer); | 
| 112 | 115 | 
| 113 DECLARE_VIRTUAL_TRACE(); | 116 DECLARE_VIRTUAL_TRACE(); | 
| 117 DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() { visitor->traceWrappers(m_texture); } | |
| 114 | 118 | 
| 115 private: | 119 private: | 
| 116 WebGLTextureAttachment(WebGLTexture*, | 120 WebGLTextureAttachment(WebGLTexture*, | 
| 117 GLenum target, | 121 GLenum target, | 
| 118 GLint level, | 122 GLint level, | 
| 119 GLint layer); | 123 GLint layer); | 
| 120 WebGLTextureAttachment() {} | 124 WebGLTextureAttachment() : m_texture(this, nullptr) {} | 
| 121 | 125 | 
| 122 WebGLSharedObject* object() const override; | 126 WebGLSharedObject* object() const override; | 
| 123 bool isSharedObject(WebGLSharedObject*) const override; | 127 bool isSharedObject(WebGLSharedObject*) const override; | 
| 124 bool valid() const override; | 128 bool valid() const override; | 
| 125 void onDetached(gpu::gles2::GLES2Interface*) override; | 129 void onDetached(gpu::gles2::GLES2Interface*) override; | 
| 126 void attach(gpu::gles2::GLES2Interface*, | 130 void attach(gpu::gles2::GLES2Interface*, | 
| 127 GLenum target, | 131 GLenum target, | 
| 128 GLenum attachment) override; | 132 GLenum attachment) override; | 
| 129 void unattach(gpu::gles2::GLES2Interface*, | 133 void unattach(gpu::gles2::GLES2Interface*, | 
| 130 GLenum target, | 134 GLenum target, | 
| 131 GLenum attachment) override; | 135 GLenum attachment) override; | 
| 132 | 136 | 
| 133 Member<WebGLTexture> m_texture; | 137 TraceWrapperMember<WebGLTexture> m_texture; | 
| 134 GLenum m_target; | 138 GLenum m_target; | 
| 135 GLint m_level; | 139 GLint m_level; | 
| 136 GLint m_layer; | 140 GLint m_layer; | 
| 137 }; | 141 }; | 
| 138 | 142 | 
| 139 WebGLFramebuffer::WebGLAttachment* WebGLTextureAttachment::create( | 143 WebGLFramebuffer::WebGLAttachment* WebGLTextureAttachment::create( | 
| 140 WebGLTexture* texture, | 144 WebGLTexture* texture, | 
| 141 GLenum target, | 145 GLenum target, | 
| 142 GLint level, | 146 GLint level, | 
| 143 GLint layer) { | 147 GLint layer) { | 
| 144 return new WebGLTextureAttachment(texture, target, level, layer); | 148 return new WebGLTextureAttachment(texture, target, level, layer); | 
| 145 } | 149 } | 
| 146 | 150 | 
| 147 DEFINE_TRACE(WebGLTextureAttachment) { | 151 DEFINE_TRACE(WebGLTextureAttachment) { | 
| 148 visitor->trace(m_texture); | 152 visitor->trace(m_texture); | 
| 149 WebGLFramebuffer::WebGLAttachment::trace(visitor); | 153 WebGLFramebuffer::WebGLAttachment::trace(visitor); | 
| 150 } | 154 } | 
| 151 | 155 | 
| 152 WebGLTextureAttachment::WebGLTextureAttachment(WebGLTexture* texture, | 156 WebGLTextureAttachment::WebGLTextureAttachment(WebGLTexture* texture, | 
| 153 GLenum target, | 157 GLenum target, | 
| 154 GLint level, | 158 GLint level, | 
| 155 GLint layer) | 159 GLint layer) | 
| 156 : m_texture(texture), m_target(target), m_level(level), m_layer(layer) {} | 160 : m_texture(this, texture), | 
| 161 m_target(target), | |
| 162 m_level(level), | |
| 163 m_layer(layer) {} | |
| 157 | 164 | 
| 158 WebGLSharedObject* WebGLTextureAttachment::object() const { | 165 WebGLSharedObject* WebGLTextureAttachment::object() const { | 
| 159 return m_texture->object() ? m_texture.get() : 0; | 166 return m_texture->object() ? m_texture.get() : 0; | 
| 160 } | 167 } | 
| 161 | 168 | 
| 162 bool WebGLTextureAttachment::isSharedObject(WebGLSharedObject* object) const { | 169 bool WebGLTextureAttachment::isSharedObject(WebGLSharedObject* object) const { | 
| 163 return object == m_texture; | 170 return object == m_texture; | 
| 164 } | 171 } | 
| 165 | 172 | 
| 166 bool WebGLTextureAttachment::valid() const { | 173 bool WebGLTextureAttachment::valid() const { | 
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 550 } | 557 } | 
| 551 | 558 | 
| 552 DEFINE_TRACE_WRAPPERS(WebGLFramebuffer) { | 559 DEFINE_TRACE_WRAPPERS(WebGLFramebuffer) { | 
| 553 for (const auto& attachment : m_attachments) { | 560 for (const auto& attachment : m_attachments) { | 
| 554 visitor->traceWrappers(attachment.value->object()); | 561 visitor->traceWrappers(attachment.value->object()); | 
| 555 } | 562 } | 
| 556 WebGLContextObject::traceWrappers(visitor); | 563 WebGLContextObject::traceWrappers(visitor); | 
| 557 } | 564 } | 
| 558 | 565 | 
| 559 } // namespace blink | 566 } // namespace blink | 
| OLD | NEW |