Title: [174839] trunk/Source/WebCore
Revision
174839
Author
[email protected]
Date
2014-10-17 14:24:11 -0700 (Fri, 17 Oct 2014)

Log Message

Get rid of wrapperContext() in DOM bindings.
<https://webkit.org/b/137834>

Reviewed by Chris Dumez.

The "wrapper context" is always the DOMWrapperWorld, and since we're passing that around
already, we don't need a separate mechanism to get at the context.

The context is extra data stored in the DOM object's JSC::Weak (the wrapper GC object.)

* bindings/js/JSDOMBinding.h:
(WebCore::setInlineCachedWrapper):
(WebCore::cacheWrapper):
(WebCore::wrapperContext): Deleted.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (174838 => 174839)


--- trunk/Source/WebCore/ChangeLog	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/ChangeLog	2014-10-17 21:24:11 UTC (rev 174839)
@@ -1,3 +1,22 @@
+2014-10-17  Andreas Kling  <[email protected]>
+
+        Get rid of wrapperContext() in DOM bindings.
+        <https://webkit.org/b/137834>
+
+        Reviewed by Chris Dumez.
+
+        The "wrapper context" is always the DOMWrapperWorld, and since we're passing that around
+        already, we don't need a separate mechanism to get at the context.
+
+        The context is extra data stored in the DOM object's JSC::Weak (the wrapper GC object.)
+
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::setInlineCachedWrapper):
+        (WebCore::cacheWrapper):
+        (WebCore::wrapperContext): Deleted.
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateHeader):
+
 2014-10-17  Benjamin Poulain  <[email protected]>
 
         Make a better use of the available registers when compiling nested selector lists

Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -133,13 +133,8 @@
     return static_cast<WebCoreTypedArrayController*>(world.vm().m_typedArrayController.get())->wrapperOwner();
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, JSC::ArrayBuffer*)
-{
-    return &world;
-}
-
 inline JSDOMWrapper* getInlineCachedWrapper(DOMWrapperWorld&, void*) { return nullptr; }
-inline bool setInlineCachedWrapper(DOMWrapperWorld&, void*, JSDOMWrapper*, JSC::WeakHandleOwner*, void*) { return false; }
+inline bool setInlineCachedWrapper(DOMWrapperWorld&, void*, JSDOMWrapper*, JSC::WeakHandleOwner*) { return false; }
 inline bool clearInlineCachedWrapper(DOMWrapperWorld&, void*, JSDOMWrapper*) { return false; }
 
 inline JSDOMWrapper* getInlineCachedWrapper(DOMWrapperWorld& world, ScriptWrappable* domObject)
@@ -156,19 +151,19 @@
     return buffer->m_wrapper.get();
 }
 
-inline bool setInlineCachedWrapper(DOMWrapperWorld& world, ScriptWrappable* domObject, JSDOMWrapper* wrapper, JSC::WeakHandleOwner* wrapperOwner, void* context)
+inline bool setInlineCachedWrapper(DOMWrapperWorld& world, ScriptWrappable* domObject, JSDOMWrapper* wrapper, JSC::WeakHandleOwner* wrapperOwner)
 {
     if (!world.isNormal())
         return false;
-    domObject->setWrapper(wrapper, wrapperOwner, context);
+    domObject->setWrapper(wrapper, wrapperOwner, &world);
     return true;
 }
 
-inline bool setInlineCachedWrapper(DOMWrapperWorld& world, JSC::ArrayBuffer* domObject, JSC::JSArrayBuffer* wrapper, JSC::WeakHandleOwner* wrapperOwner, void* context)
+inline bool setInlineCachedWrapper(DOMWrapperWorld& world, JSC::ArrayBuffer* domObject, JSC::JSArrayBuffer* wrapper, JSC::WeakHandleOwner* wrapperOwner)
 {
     if (!world.isNormal())
         return false;
-    domObject->m_wrapper = JSC::Weak<JSC::JSArrayBuffer>(wrapper, wrapperOwner, context);
+    domObject->m_wrapper = JSC::Weak<JSC::JSArrayBuffer>(wrapper, wrapperOwner, &world);
     return true;
 }
 
@@ -198,10 +193,9 @@
 template<typename DOMClass, typename WrapperClass> inline void cacheWrapper(DOMWrapperWorld& world, DOMClass* domObject, WrapperClass* wrapper)
 {
     JSC::WeakHandleOwner* owner = wrapperOwner(world, domObject);
-    void* context = wrapperContext(world, domObject);
-    if (setInlineCachedWrapper(world, domObject, wrapper, owner, context))
+    if (setInlineCachedWrapper(world, domObject, wrapper, owner))
         return;
-    weakAdd(world.m_wrappers, (void*)domObject, JSC::Weak<JSC::JSObject>(wrapper, owner, context));
+    weakAdd(world.m_wrappers, (void*)domObject, JSC::Weak<JSC::JSObject>(wrapper, owner, &world));
 }
 
 template<typename DOMClass, typename WrapperClass> inline void uncacheWrapper(DOMWrapperWorld& world, DOMClass* domObject, WrapperClass* wrapper)

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2014-10-17 21:24:11 UTC (rev 174839)
@@ -1168,11 +1168,6 @@
         push(@headerContent, "    return &js${interfaceName}Owner;\n");
         push(@headerContent, "}\n");
         push(@headerContent, "\n");
-        push(@headerContent, "inline void* wrapperContext(DOMWrapperWorld& world, $implType*)\n");
-        push(@headerContent, "{\n");
-        push(@headerContent, "    return &world;\n");
-        push(@headerContent, "}\n");
-        push(@headerContent, "\n");
     }
     if (ShouldGenerateToJSDeclaration($hasParent, $interface)) {
         push(@headerContent, "WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, $implType*);\n");

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestActiveDOMObject.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -88,11 +88,6 @@
     return &jsTestActiveDOMObjectOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestActiveDOMObject*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestActiveDOMObject*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestCustomNamedGetter.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -92,11 +92,6 @@
     return &jsTestCustomNamedGetterOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestCustomNamedGetter*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestCustomNamedGetter*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventConstructor.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -88,11 +88,6 @@
     return &jsTestEventConstructorOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestEventConstructor*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestEventConstructor*);
 
 bool fillTestEventConstructorInit(TestEventConstructorInit&, JSDictionary&);

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -96,11 +96,6 @@
     return &jsTestEventTargetOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestEventTarget*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestEventTarget*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestException.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -89,11 +89,6 @@
     return &jsTestExceptionOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestException*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestException*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestGenerateIsReachable.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -86,11 +86,6 @@
     return &jsTestGenerateIsReachableOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestGenerateIsReachable*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestGenerateIsReachable*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -115,11 +115,6 @@
     return &jsTestInterfaceOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestInterface*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestInterface*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -86,11 +86,6 @@
     return &jsTestMediaQueryListListenerOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestMediaQueryListListener*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestMediaQueryListListener*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNamedConstructor.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -87,11 +87,6 @@
     return &jsTestNamedConstructorOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestNamedConstructor*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestNamedConstructor*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestNondeterministic.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -86,11 +86,6 @@
     return &jsTestNondeterministicOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestNondeterministic*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestNondeterministic*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -101,11 +101,6 @@
     return &jsTestObjOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestObj*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestObj*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestOverloadedConstructors.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -86,11 +86,6 @@
     return &jsTestOverloadedConstructorsOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestOverloadedConstructors*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestOverloadedConstructors*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -92,11 +92,6 @@
     return &jsTestSerializedScriptValueInterfaceOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestSerializedScriptValueInterface*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestSerializedScriptValueInterface*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -88,11 +88,6 @@
     return &jsTestTypedefsOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, TestTypedefs*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestTypedefs*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSattribute.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -87,11 +87,6 @@
     return &jsattributeOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, attribute*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, attribute*);
 
 

Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.h (174838 => 174839)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.h	2014-10-17 21:21:00 UTC (rev 174838)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSreadonly.h	2014-10-17 21:24:11 UTC (rev 174839)
@@ -86,11 +86,6 @@
     return &jsreadonlyOwner;
 }
 
-inline void* wrapperContext(DOMWrapperWorld& world, readonly*)
-{
-    return &world;
-}
-
 WEBCORE_EXPORT JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, readonly*);
 
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to