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

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

Issue 798233005: Merge 185069 "Enforce context refrence guards in WebGL extensions." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/2214/
Patch Set: Created 6 years 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/WebGLExtension.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/canvas/WebGLExtension.h
===================================================================
--- Source/core/html/canvas/WebGLExtension.h (revision 187498)
+++ Source/core/html/canvas/WebGLExtension.h (working copy)
@@ -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 WebGLExtensionScopedContext : public NoBaseWillBeGarbageCollectedFinalized<WebGLExtensionScopedContext> {
+ WTF_MAKE_NONCOPYABLE(WebGLExtensionScopedContext);
+ WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
+public:
+ 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:
- WebGLRenderingContextBase* context() { return m_context; }
-
virtual ~WebGLExtension();
virtual WebGLExtensionName name() const = 0;
@@ -49,10 +64,7 @@
m_context = nullptr;
}
- bool isLost()
- {
- return !m_context;
- }
+ bool isLost() { return !m_context; }
virtual void trace(Visitor*);
@@ -59,6 +71,9 @@
protected:
explicit WebGLExtension(WebGLRenderingContextBase*);
+private:
+ friend WebGLExtensionScopedContext;
+
RawPtrWillBeWeakMember<WebGLRenderingContextBase> m_context;
};
« no previous file with comments | « Source/core/html/canvas/WebGLDrawBuffers.cpp ('k') | Source/core/html/canvas/WebGLExtension.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698