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

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

Issue 2273683003: Use visitDOMWrapper to preserve WebGL JS object wrappers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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: third_party/WebKit/Source/modules/webgl/WebGLObject.h
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLObject.h b/third_party/WebKit/Source/modules/webgl/WebGLObject.h
index 6fe0442298e365e767876869325286932dc2abce..50aad57ab19205c8edcb3199eb49434e20ab56ba 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLObject.h
+++ b/third_party/WebKit/Source/modules/webgl/WebGLObject.h
@@ -26,6 +26,7 @@
#ifndef WebGLObject_h
#define WebGLObject_h
+#include "bindings/core/v8/DOMWrapperWorld.h"
#include "bindings/core/v8/ScriptWrappable.h"
#include "platform/heap/Handle.h"
#include "third_party/khronos/GLES2/gl2.h"
@@ -77,9 +78,20 @@ public:
virtual bool validate(const WebGLContextGroup*, const WebGLRenderingContextBase*) const = 0;
virtual bool hasObject() const = 0;
+ static void trySetWrapperReferencesInAllWorlds(const v8::Persistent<v8::Object>& wrapper, ScriptWrappable* scriptWrappable, v8::Isolate* isolate)
+ {
+ if (scriptWrappable) {
haraken 2016/08/31 23:14:50 I'd prefer moving the null check to DOMWrapperWorl
Kai Ninomiya 2016/09/02 18:29:22 Done.
+ DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, scriptWrappable, isolate);
+ }
+ }
+
DEFINE_INLINE_VIRTUAL_TRACE() { }
protected:
+ // To allow WebGL[2]RenderingContextBase to call visitChildDOMWrappers.
+ friend class WebGLRenderingContextBase;
+ friend class WebGL2RenderingContextBase;
+
explicit WebGLObject(WebGLRenderingContextBase*);
// deleteObjectImpl should be only called once to delete the OpenGL resource.
@@ -93,6 +105,8 @@ protected:
virtual gpu::gles2::GLES2Interface* getAGLInterface() const = 0;
+ virtual void visitChildDOMWrappers(v8::Isolate*, const v8::Persistent<v8::Object>&) { }
+
private:
unsigned m_attachmentCount;
bool m_deleted;

Powered by Google App Engine
This is Rietveld 408576698