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

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
« no previous file with comments | « Source/core/html/canvas/WebGLDrawBuffers.cpp ('k') | Source/core/html/canvas/WebGLLoseContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7e41cb7e59d53e127945264d82ce310670cc0ee3 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,27 @@ public:
WebGLLoseContextName,
};
- void ref() { m_context->ref(); }
- void deref() { m_context->deref(); }
WebGLRenderingContext* context() { return m_context; }
virtual ~WebGLExtension();
virtual ExtensionName getName() const = 0;
+ // Lose this extension. Passing true = force loss. Some extensions
+ // like WEBGL_lose_context are not normally lost when the context
+ // is lost but must be lost when destroying their WebGLRenderingContext.
+ virtual void lose(bool)
+ {
+ m_context = 0;
+ }
+
+ bool isLost()
+ {
+ return !m_context;
+ }
+
protected:
WebGLExtension(WebGLRenderingContext*);
+
WebGLRenderingContext* m_context;
};
« no previous file with comments | « Source/core/html/canvas/WebGLDrawBuffers.cpp ('k') | Source/core/html/canvas/WebGLLoseContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698