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

Unified Diff: third_party/WebKit/Source/modules/webgl/WebGLContextGroup.h

Issue 2547813002: Remove WebGLObject maps from WebGLRenderingContextBase and WebGLContextGroup. (Closed)
Patch Set: Fixed WebGLContextObject::validate. Made WebGLExtension non-finalized. Created 4 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
Index: third_party/WebKit/Source/modules/webgl/WebGLContextGroup.h
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLContextGroup.h b/third_party/WebKit/Source/modules/webgl/WebGLContextGroup.h
index a27e9871c992e0d53537ceb1e1fbae641448d044..4986a45d53dba7707731baebcbc19cda1a43ea10 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLContextGroup.h
+++ b/third_party/WebKit/Source/modules/webgl/WebGLContextGroup.h
@@ -26,6 +26,7 @@
#ifndef WebGLContextGroup_h
#define WebGLContextGroup_h
+#include "bindings/core/v8/ScriptWrappable.h"
#include "modules/webgl/WebGLRenderingContextBase.h"
#include "wtf/HashSet.h"
#include "wtf/PassRefPtr.h"
@@ -33,42 +34,47 @@
namespace blink {
-class WebGLSharedObject;
-class WebGLRenderingContextBase;
-
typedef int ExceptionCode;
-class WebGLContextGroup final : public RefCounted<WebGLContextGroup> {
+class WebGLContextGroup final : public GarbageCollected<WebGLContextGroup>,
+ public TraceWrapperBase {
+ WTF_MAKE_NONCOPYABLE(WebGLContextGroup);
+
public:
- static PassRefPtr<WebGLContextGroup> create();
- ~WebGLContextGroup();
+ WebGLContextGroup();
void addContext(WebGLRenderingContextBase*);
- void removeContext(WebGLRenderingContextBase*);
- void addObject(WebGLSharedObject*);
- void removeObject(WebGLSharedObject*);
+ // There's no point in having a removeContext method any more now that
+ // the context group is GarbageCollected. The only time it would be
+ // called would be during WebGLRenderingContext destruction, and at that
+ // time, the context is not allowed to refer back to the context group
+ // since both are on the Oilpan heap.
gpu::gles2::GLES2Interface* getAGLInterface();
void loseContextGroup(WebGLRenderingContextBase::LostContextMode,
WebGLRenderingContextBase::AutoRecoveryMethod);
+ // This counter gets incremented every time context loss is
+ // triggered. Because there's no longer any explicit enumeration of
+ // the objects in a given context group upon context loss, each
+ // object needs to keep track of the context loss count when it was
+ // created, in order to validate itself.
+ uint32_t numberOfContextLosses() const;
+
+ DEFINE_INLINE_TRACE() { visitor->trace(m_contexts); }
+
+ DECLARE_VIRTUAL_TRACE_WRAPPERS();
+
private:
friend class WebGLObject;
- WebGLContextGroup();
-
- void detachAndRemoveAllObjects();
+ uint32_t m_numberOfContextLosses;
- // FIXME: Oilpan: this object is not on the heap, but keeps untraced
- // pointers to on-heap objects in the two hash sets below.
- // The objects are responsible for managing their
- // registration with WebGLContextGroup, and vice versa, the
- // WebGLContextGroup takes care of detaching the group objects if
- // the set of WebGLRenderingContextBase contexts becomes empty.
- HashSet<UntracedMember<WebGLRenderingContextBase>> m_contexts;
- HashSet<UntracedMember<WebGLSharedObject>> m_groupObjects;
+ // Note: ideally this would use a TraceWrapperMember subclass, but
+ // that doesn't seem to exist for weak members yet.
+ HeapHashSet<WeakMember<WebGLRenderingContextBase>> m_contexts;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698