Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef WebGLExtension_h | 26 #ifndef WebGLExtension_h |
| 27 #define WebGLExtension_h | 27 #define WebGLExtension_h |
| 28 | 28 |
| 29 #include "core/html/canvas/WebGLExtensionName.h" | 29 #include "core/html/canvas/WebGLExtensionName.h" |
| 30 #include "core/html/canvas/WebGLRenderingContextBase.h" | 30 #include "core/html/canvas/WebGLRenderingContextBase.h" |
| 31 #include "platform/heap/Handle.h" | |
| 31 #include "wtf/RefCounted.h" | 32 #include "wtf/RefCounted.h" |
| 32 | 33 |
| 33 namespace WebCore { | 34 namespace WebCore { |
| 34 | 35 |
| 35 class WebGLExtension : public RefCounted<WebGLExtension> { | 36 class WebGLExtension : public RefCountedWillBeGarbageCollectedFinalized<WebGLExt ension> { |
| 36 WTF_MAKE_FAST_ALLOCATED; | 37 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
| 37 public: | 38 public: |
| 38 WebGLRenderingContextBase* context() { return m_context; } | 39 WebGLRenderingContextBase* context() { return m_context; } |
| 39 | 40 |
| 40 virtual ~WebGLExtension(); | 41 virtual ~WebGLExtension(); |
| 41 virtual WebGLExtensionName name() const = 0; | 42 virtual WebGLExtensionName name() const = 0; |
| 42 | 43 |
| 43 // Lose this extension. Passing true = force loss. Some extensions | 44 // Lose this extension. Passing true = force loss. Some extensions |
| 44 // like WEBGL_lose_context are not normally lost when the context | 45 // like WEBGL_lose_context are not normally lost when the context |
| 45 // is lost but must be lost when destroying their WebGLRenderingContextBase. | 46 // is lost but must be lost when destroying their WebGLRenderingContextBase. |
| 46 virtual void lose(bool) | 47 virtual void lose(bool) |
| 47 { | 48 { |
| 48 m_context = 0; | 49 m_context = nullptr; |
| 49 } | 50 } |
| 50 | 51 |
| 51 bool isLost() | 52 bool isLost() |
| 52 { | 53 { |
| 53 return !m_context; | 54 return !m_context; |
| 54 } | 55 } |
| 55 | 56 |
| 57 virtual void trace(Visitor*); | |
| 58 | |
| 56 protected: | 59 protected: |
| 57 WebGLExtension(WebGLRenderingContextBase*); | 60 WebGLExtension(WebGLRenderingContextBase*); |
| 58 | 61 |
| 59 WebGLRenderingContextBase* m_context; | 62 RawPtrWillBeWeakMember<WebGLRenderingContextBase> m_context; |
|
sof
2014/07/01 13:54:11
Once the context object disappears, it is cleared
| |
| 60 }; | 63 }; |
| 61 | 64 |
| 62 } // namespace WebCore | 65 } // namespace WebCore |
| 63 | 66 |
| 64 #endif // WebGLExtension_h | 67 #endif // WebGLExtension_h |
| OLD | NEW |