Index: Source/core/html/canvas/WebGLExtension.h |
diff --git a/Source/core/html/canvas/WebGLExtension.h b/Source/core/html/canvas/WebGLExtension.h |
index 474f500d141fdb2fa9579af88d1587c7d264d0eb..09ae66ac0037203f17abfd623f5ad753a7d2994d 100644 |
--- a/Source/core/html/canvas/WebGLExtension.h |
+++ b/Source/core/html/canvas/WebGLExtension.h |
@@ -26,6 +26,7 @@ |
#ifndef WebGLExtension_h |
#define WebGLExtension_h |
+#include "core/html/HTMLCanvasElement.h" |
#include "core/html/canvas/WebGLExtensionName.h" |
#include "core/html/canvas/WebGLRenderingContextBase.h" |
#include "platform/heap/Handle.h" |
@@ -33,11 +34,25 @@ |
namespace blink { |
-class WebGLExtension : public RefCountedWillBeGarbageCollectedFinalized<WebGLExtension> { |
+class WebGLExtensionScopedContext : public NoBaseWillBeGarbageCollectedFinalized<WebGLExtensionScopedContext> { |
+ WTF_MAKE_NONCOPYABLE(WebGLExtensionScopedContext); |
WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
public: |
- WebGLRenderingContextBase* context() { return m_context; } |
+ WebGLExtensionScopedContext(WebGLExtension*); |
+ virtual ~WebGLExtensionScopedContext(); |
+ |
+ bool isLost() { return !m_context; } |
+ WebGLRenderingContextBase* context() const { return m_context.get(); } |
+ |
+ virtual void trace(Visitor*); |
+ |
+private: |
+ RefPtrWillBeMember<WebGLRenderingContextBase> m_context; |
+}; |
+class WebGLExtension : public RefCountedWillBeGarbageCollectedFinalized<WebGLExtension> { |
+ WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; |
+public: |
virtual ~WebGLExtension(); |
virtual WebGLExtensionName name() const = 0; |
@@ -49,16 +64,16 @@ public: |
m_context = nullptr; |
} |
- bool isLost() |
- { |
- return !m_context; |
- } |
+ bool isLost() { return !m_context; } |
virtual void trace(Visitor*); |
protected: |
explicit WebGLExtension(WebGLRenderingContextBase*); |
+private: |
+ friend WebGLExtensionScopedContext; |
+ |
RawPtrWillBeWeakMember<WebGLRenderingContextBase> m_context; |
}; |