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

Unified Diff: Source/core/html/canvas/WebGLExtension.h

Issue 15876011: Make WebGL extensions get lost when context is lost. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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
Index: Source/core/html/canvas/WebGLExtension.h
diff --git a/Source/core/html/canvas/WebGLExtension.h b/Source/core/html/canvas/WebGLExtension.h
index 84eef1bcd1fc2882fe781208c3effc86271f775d..a27cc3c79c3dfb430d6c7fc1da264da6b0f407a6 100644
--- a/Source/core/html/canvas/WebGLExtension.h
+++ b/Source/core/html/canvas/WebGLExtension.h
@@ -27,10 +27,11 @@
#define WebGLExtension_h
#include "core/html/canvas/WebGLRenderingContext.h"
+#include "wtf/RefCounted.h"
namespace WebCore {
-class WebGLExtension {
+class WebGLExtension : public RefCounted<WebGLExtension> {
WTF_MAKE_FAST_ALLOCATED;
public:
// Extension names are needed to properly wrap instances in JavaScript objects.
@@ -54,15 +55,24 @@ public:
WebGLLoseContextName,
};
- void ref() { m_context->ref(); }
- void deref() { m_context->deref(); }
WebGLRenderingContext* context() { return m_context; }
virtual ~WebGLExtension();
virtual ExtensionName getName() const = 0;
+ virtual void lose()
+ {
+ m_context = 0;
+ }
+
+ bool isLost()
+ {
+ return !m_context;
+ }
+
protected:
WebGLExtension(WebGLRenderingContext*);
+
WebGLRenderingContext* m_context;
};

Powered by Google App Engine
This is Rietveld 408576698