| 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  |   49  | 
|   47   WebGLSharedObject* object() const override; |   50   WebGLSharedObject* object() const override; | 
|   48   bool isSharedObject(WebGLSharedObject*) const override; |   51   bool isSharedObject(WebGLSharedObject*) const override; | 
|   49   bool valid() const override; |   52   bool valid() const override; | 
|   50   void onDetached(gpu::gles2::GLES2Interface*) override; |   53   void onDetached(gpu::gles2::GLES2Interface*) override; | 
|   51   void attach(gpu::gles2::GLES2Interface*, |   54   void attach(gpu::gles2::GLES2Interface*, | 
|   52               GLenum target, |   55               GLenum target, | 
|   53               GLenum attachment) override; |   56               GLenum attachment) override; | 
|   54   void unattach(gpu::gles2::GLES2Interface*, |   57   void unattach(gpu::gles2::GLES2Interface*, | 
|   55                 GLenum target, |   58                 GLenum target, | 
|   56                 GLenum attachment) override; |   59                 GLenum attachment) override; | 
|   57  |   60  | 
|   58   Member<WebGLRenderbuffer> m_renderbuffer; |   61   TraceWrapperMember<WebGLRenderbuffer> m_renderbuffer; | 
|   59 }; |   62 }; | 
|   60  |   63  | 
|   61 WebGLFramebuffer::WebGLAttachment* WebGLRenderbufferAttachment::create( |   64 WebGLFramebuffer::WebGLAttachment* WebGLRenderbufferAttachment::create( | 
|   62     WebGLRenderbuffer* renderbuffer) { |   65     WebGLRenderbuffer* renderbuffer) { | 
|   63   return new WebGLRenderbufferAttachment(renderbuffer); |   66   return new WebGLRenderbufferAttachment(renderbuffer); | 
|   64 } |   67 } | 
|   65  |   68  | 
|   66 DEFINE_TRACE(WebGLRenderbufferAttachment) { |   69 DEFINE_TRACE(WebGLRenderbufferAttachment) { | 
|   67   visitor->trace(m_renderbuffer); |   70   visitor->trace(m_renderbuffer); | 
|   68   WebGLFramebuffer::WebGLAttachment::trace(visitor); |   71   WebGLFramebuffer::WebGLAttachment::trace(visitor); | 
|   69 } |   72 } | 
|   70  |   73  | 
|   71 WebGLRenderbufferAttachment::WebGLRenderbufferAttachment( |   74 WebGLRenderbufferAttachment::WebGLRenderbufferAttachment( | 
|   72     WebGLRenderbuffer* renderbuffer) |   75     WebGLRenderbuffer* renderbuffer) | 
|   73     : m_renderbuffer(renderbuffer) {} |   76     : m_renderbuffer(this, renderbuffer) {} | 
|   74  |   77  | 
|   75 WebGLSharedObject* WebGLRenderbufferAttachment::object() const { |   78 WebGLSharedObject* WebGLRenderbufferAttachment::object() const { | 
|   76   return m_renderbuffer->object() ? m_renderbuffer.get() : 0; |   79   return m_renderbuffer->object() ? m_renderbuffer.get() : 0; | 
|   77 } |   80 } | 
|   78  |   81  | 
|   79 bool WebGLRenderbufferAttachment::isSharedObject( |   82 bool WebGLRenderbufferAttachment::isSharedObject( | 
|   80     WebGLSharedObject* object) const { |   83     WebGLSharedObject* object) const { | 
|   81   return object == m_renderbuffer; |   84   return object == m_renderbuffer; | 
|   82 } |   85 } | 
|   83  |   86  | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|  103 } |  106 } | 
|  104  |  107  | 
|  105 class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment { |  108 class WebGLTextureAttachment final : public WebGLFramebuffer::WebGLAttachment { | 
|  106  public: |  109  public: | 
|  107   static WebGLFramebuffer::WebGLAttachment* create(WebGLTexture*, |  110   static WebGLFramebuffer::WebGLAttachment* create(WebGLTexture*, | 
|  108                                                    GLenum target, |  111                                                    GLenum target, | 
|  109                                                    GLint level, |  112                                                    GLint level, | 
|  110                                                    GLint layer); |  113                                                    GLint layer); | 
|  111  |  114  | 
|  112   DECLARE_VIRTUAL_TRACE(); |  115   DECLARE_VIRTUAL_TRACE(); | 
 |  116   DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() { visitor->traceWrappers(m_texture); } | 
|  113  |  117  | 
|  114  private: |  118  private: | 
|  115   WebGLTextureAttachment(WebGLTexture*, |  119   WebGLTextureAttachment(WebGLTexture*, | 
|  116                          GLenum target, |  120                          GLenum target, | 
|  117                          GLint level, |  121                          GLint level, | 
|  118                          GLint layer); |  122                          GLint layer); | 
|  119  |  123  | 
|  120   WebGLSharedObject* object() const override; |  124   WebGLSharedObject* object() const override; | 
|  121   bool isSharedObject(WebGLSharedObject*) const override; |  125   bool isSharedObject(WebGLSharedObject*) const override; | 
|  122   bool valid() const override; |  126   bool valid() const override; | 
|  123   void onDetached(gpu::gles2::GLES2Interface*) override; |  127   void onDetached(gpu::gles2::GLES2Interface*) override; | 
|  124   void attach(gpu::gles2::GLES2Interface*, |  128   void attach(gpu::gles2::GLES2Interface*, | 
|  125               GLenum target, |  129               GLenum target, | 
|  126               GLenum attachment) override; |  130               GLenum attachment) override; | 
|  127   void unattach(gpu::gles2::GLES2Interface*, |  131   void unattach(gpu::gles2::GLES2Interface*, | 
|  128                 GLenum target, |  132                 GLenum target, | 
|  129                 GLenum attachment) override; |  133                 GLenum attachment) override; | 
|  130  |  134  | 
|  131   Member<WebGLTexture> m_texture; |  135   TraceWrapperMember<WebGLTexture> m_texture; | 
|  132   GLenum m_target; |  136   GLenum m_target; | 
|  133   GLint m_level; |  137   GLint m_level; | 
|  134   GLint m_layer; |  138   GLint m_layer; | 
|  135 }; |  139 }; | 
|  136  |  140  | 
|  137 WebGLFramebuffer::WebGLAttachment* WebGLTextureAttachment::create( |  141 WebGLFramebuffer::WebGLAttachment* WebGLTextureAttachment::create( | 
|  138     WebGLTexture* texture, |  142     WebGLTexture* texture, | 
|  139     GLenum target, |  143     GLenum target, | 
|  140     GLint level, |  144     GLint level, | 
|  141     GLint layer) { |  145     GLint layer) { | 
|  142   return new WebGLTextureAttachment(texture, target, level, layer); |  146   return new WebGLTextureAttachment(texture, target, level, layer); | 
|  143 } |  147 } | 
|  144  |  148  | 
|  145 DEFINE_TRACE(WebGLTextureAttachment) { |  149 DEFINE_TRACE(WebGLTextureAttachment) { | 
|  146   visitor->trace(m_texture); |  150   visitor->trace(m_texture); | 
|  147   WebGLFramebuffer::WebGLAttachment::trace(visitor); |  151   WebGLFramebuffer::WebGLAttachment::trace(visitor); | 
|  148 } |  152 } | 
|  149  |  153  | 
|  150 WebGLTextureAttachment::WebGLTextureAttachment(WebGLTexture* texture, |  154 WebGLTextureAttachment::WebGLTextureAttachment(WebGLTexture* texture, | 
|  151                                                GLenum target, |  155                                                GLenum target, | 
|  152                                                GLint level, |  156                                                GLint level, | 
|  153                                                GLint layer) |  157                                                GLint layer) | 
|  154     : m_texture(texture), m_target(target), m_level(level), m_layer(layer) {} |  158     : m_texture(this, texture), | 
 |  159       m_target(target), | 
 |  160       m_level(level), | 
 |  161       m_layer(layer) {} | 
|  155  |  162  | 
|  156 WebGLSharedObject* WebGLTextureAttachment::object() const { |  163 WebGLSharedObject* WebGLTextureAttachment::object() const { | 
|  157   return m_texture->object() ? m_texture.get() : 0; |  164   return m_texture->object() ? m_texture.get() : 0; | 
|  158 } |  165 } | 
|  159  |  166  | 
|  160 bool WebGLTextureAttachment::isSharedObject(WebGLSharedObject* object) const { |  167 bool WebGLTextureAttachment::isSharedObject(WebGLSharedObject* object) const { | 
|  161   return object == m_texture; |  168   return object == m_texture; | 
|  162 } |  169 } | 
|  163  |  170  | 
|  164 bool WebGLTextureAttachment::valid() const { |  171 bool WebGLTextureAttachment::valid() const { | 
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  533   } |  540   } | 
|  534 } |  541 } | 
|  535  |  542  | 
|  536 DEFINE_TRACE(WebGLFramebuffer) { |  543 DEFINE_TRACE(WebGLFramebuffer) { | 
|  537   visitor->trace(m_attachments); |  544   visitor->trace(m_attachments); | 
|  538   WebGLContextObject::trace(visitor); |  545   WebGLContextObject::trace(visitor); | 
|  539 } |  546 } | 
|  540  |  547  | 
|  541 DEFINE_TRACE_WRAPPERS(WebGLFramebuffer) { |  548 DEFINE_TRACE_WRAPPERS(WebGLFramebuffer) { | 
|  542   for (const auto& attachment : m_attachments) { |  549   for (const auto& attachment : m_attachments) { | 
|  543     visitor->traceWrappers(attachment.value->object()); |  550     visitor->traceWrappers(attachment.value); | 
|  544   } |  551   } | 
|  545   WebGLContextObject::traceWrappers(visitor); |  552   WebGLContextObject::traceWrappers(visitor); | 
|  546 } |  553 } | 
|  547  |  554  | 
|  548 }  // namespace blink |  555 }  // namespace blink | 
| OLD | NEW |