Title: [152168] trunk/Source/WebCore
Revision
152168
Author
[email protected]
Date
2013-06-28 09:01:32 -0700 (Fri, 28 Jun 2013)

Log Message

Get rid of IsWorkerGlobalScope and ExtendsDOMGlobalObject extended attributes
https://bugs.webkit.org/show_bug.cgi?id=118191

Reviewed by Kentaro Hara.

Remove WebKit-specific [IsWorkerGlobalScope] and [ExtendsDOMGlobalObject] IDL
extended attributes and update the JSC bindings generator to figure this out
on its own.

No new tests, no behavior change.

* bindings/scripts/CodeGeneratorJS.pm:
(IsDOMGlobalObject):
(GenerateHeader):
(GenerateImplementation):
(GenerateConstructorHelperMethods):
* bindings/scripts/IDLAttributes.txt:
* page/DOMWindow.idl:
* workers/DedicatedWorkerGlobalScope.idl:
* workers/SharedWorkerGlobalScope.idl:
* workers/WorkerGlobalScope.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (152167 => 152168)


--- trunk/Source/WebCore/ChangeLog	2013-06-28 15:58:03 UTC (rev 152167)
+++ trunk/Source/WebCore/ChangeLog	2013-06-28 16:01:32 UTC (rev 152168)
@@ -1,5 +1,29 @@
 2013-06-28  Christophe Dumez  <[email protected]>
 
+        Get rid of IsWorkerGlobalScope and ExtendsDOMGlobalObject extended attributes
+        https://bugs.webkit.org/show_bug.cgi?id=118191
+
+        Reviewed by Kentaro Hara.
+
+        Remove WebKit-specific [IsWorkerGlobalScope] and [ExtendsDOMGlobalObject] IDL
+        extended attributes and update the JSC bindings generator to figure this out
+        on its own.
+
+        No new tests, no behavior change.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (IsDOMGlobalObject):
+        (GenerateHeader):
+        (GenerateImplementation):
+        (GenerateConstructorHelperMethods):
+        * bindings/scripts/IDLAttributes.txt:
+        * page/DOMWindow.idl:
+        * workers/DedicatedWorkerGlobalScope.idl:
+        * workers/SharedWorkerGlobalScope.idl:
+        * workers/WorkerGlobalScope.idl:
+
+2013-06-28  Christophe Dumez  <[email protected]>
+
         Introduce SVGGraphicsElement IDL interface
         https://bugs.webkit.org/show_bug.cgi?id=118178
 

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (152167 => 152168)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-06-28 15:58:03 UTC (rev 152167)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-06-28 16:01:32 UTC (rev 152168)
@@ -347,6 +347,12 @@
     return $interface->extendedAttributes->{"CustomIsReachable"};
 }
 
+sub IsDOMGlobalObject
+{
+    my $interface = shift;
+    return $interface->name eq "DOMWindow" || $codeGenerator->InheritsInterface($interface, "WorkerGlobalScope");
+}
+
 sub GenerateGetOwnPropertySlotBody
 {
     my ($interface, $interfaceName, $className, $hasAttributes, $inlined) = @_;
@@ -723,7 +729,7 @@
         $headerIncludes{"$interfaceName.h"} = 1;
     } else {
         # Implementation class forward declaration
-        if ($interfaceName eq "DOMWindow" || $interface->extendedAttributes->{"IsWorkerGlobalScope"}) {
+        if (IsDOMGlobalObject($interface)) {
             AddClassForwardIfNeeded($interfaceName) unless $svgPropertyOrListPropertyType;
         }
     }
@@ -745,7 +751,7 @@
         push(@headerContent, "        vm.heap.addFinalizer(ptr, destroy);\n");
         push(@headerContent, "        return ptr;\n");
         push(@headerContent, "    }\n\n");
-    } elsif ($interface->extendedAttributes->{"IsWorkerGlobalScope"}) {
+    } elsif ($codeGenerator->InheritsInterface($interface, "WorkerGlobalScope")) {
         push(@headerContent, "    static $className* create(JSC::VM& vm, JSC::Structure* structure, PassRefPtr<$implType> impl)\n");
         push(@headerContent, "    {\n");
         push(@headerContent, "        $className* ptr = new (NotNull, JSC::allocateCell<$className>(vm.heap)) ${className}(vm, structure, impl);\n");
@@ -772,12 +778,12 @@
         push(@headerContent, "    }\n\n");
     }
 
-    if ($interfaceName eq "DOMWindow" || $interface->extendedAttributes->{"IsWorkerGlobalScope"}) {
+    if (IsDOMGlobalObject($interface)) {
         push(@headerContent, "    static const bool needsDestruction = false;\n\n");
     }
 
     # Prototype
-    push(@headerContent, "    static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);\n") unless ($interface->extendedAttributes->{"ExtendsDOMGlobalObject"});
+    push(@headerContent, "    static JSC::JSObject* createPrototype(JSC::ExecState*, JSC::JSGlobalObject*);\n") unless IsDOMGlobalObject($interface);
 
     $headerTrailingIncludes{"${className}Custom.h"} = 1 if $interface->extendedAttributes->{"JSCustomHeader"};
 
@@ -851,7 +857,7 @@
     }
     push(@headerContent, "    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)\n");
     push(@headerContent, "    {\n");
-    if ($interfaceName eq "DOMWindow" || $interface->extendedAttributes->{"IsWorkerGlobalScope"}) {
+    if (IsDOMGlobalObject($interface)) {
         push(@headerContent, "        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::GlobalObjectType, StructureFlags), &s_info);\n");
     } else {
         push(@headerContent, "        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), &s_info);\n");
@@ -995,7 +1001,7 @@
     # Constructor
     if ($interfaceName eq "DOMWindow") {
         push(@headerContent, "    $className(JSC::VM&, JSC::Structure*, PassRefPtr<$implType>, JSDOMWindowShell*);\n");
-    } elsif ($interface->extendedAttributes->{"IsWorkerGlobalScope"}) {
+    } elsif ($codeGenerator->InheritsInterface($interface, "WorkerGlobalScope")) {
         push(@headerContent, "    $className(JSC::VM&, JSC::Structure*, PassRefPtr<$implType>);\n");
     } else {
         push(@headerContent, "    $className(JSC::Structure*, JSDOMGlobalObject*, PassRefPtr<$implType>);\n");
@@ -1097,7 +1103,7 @@
     push(@headerContent, "class ${className}Prototype : public JSC::JSNonFinalObject {\n");
     push(@headerContent, "public:\n");
     push(@headerContent, "    typedef JSC::JSNonFinalObject Base;\n");
-    if ($interfaceName ne "DOMWindow" && !$interface->extendedAttributes->{"IsWorkerGlobalScope"}) {
+    unless (IsDOMGlobalObject($interface)) {
         push(@headerContent, "    static JSC::JSObject* self(JSC::ExecState*, JSC::JSGlobalObject*);\n");
     }
 
@@ -1781,7 +1787,7 @@
     } else {
         push(@implContent, "const ClassInfo ${className}Prototype::s_info = { \"${visibleInterfaceName}Prototype\", &Base::s_info, &${className}PrototypeTable, 0, CREATE_METHOD_TABLE(${className}Prototype) };\n\n");
     }
-    if ($interfaceName ne "DOMWindow" && !$interface->extendedAttributes->{"IsWorkerGlobalScope"}) {
+    unless (IsDOMGlobalObject($interface)) {
         push(@implContent, "JSObject* ${className}Prototype::self(ExecState* exec, JSGlobalObject* globalObject)\n");
         push(@implContent, "{\n");
         push(@implContent, "    return getDOMPrototype<${className}>(exec, globalObject);\n");
@@ -1867,7 +1873,7 @@
         push(@implContent, "    : $parentClassName(vm, structure, impl, shell)\n");
         push(@implContent, "{\n");
         push(@implContent, "}\n\n");
-    } elsif ($interface->extendedAttributes->{"IsWorkerGlobalScope"}) {
+    } elsif ($codeGenerator->InheritsInterface($interface, "WorkerGlobalScope")) {
         AddIncludesForTypeInImpl($interfaceName);
         push(@implContent, "${className}::$className(VM& vm, Structure* structure, PassRefPtr<$implType> impl)\n");
         push(@implContent, "    : $parentClassName(vm, structure, impl)\n");
@@ -1897,7 +1903,7 @@
         push(@implContent, "}\n\n");
     }
 
-    if (!$interface->extendedAttributes->{"ExtendsDOMGlobalObject"}) {
+    unless (IsDOMGlobalObject($interface)) {
         push(@implContent, "JSObject* ${className}::createPrototype(ExecState* exec, JSGlobalObject* globalObject)\n");
         push(@implContent, "{\n");
         if ($hasParent && $parentClassName ne "JSC::DOMNodeFilter") {
@@ -2070,7 +2076,7 @@
                     push(@implContent, "    $interfaceName* impl = static_cast<$interfaceName*>(castedThis->impl());\n");
                     push(@implContent, "    if (EventListener* listener = impl->$implGetterFunctionName()) {\n");
                     push(@implContent, "        if (const JSEventListener* jsListener = JSEventListener::cast(listener)) {\n");
-                    if ($interfaceName eq "Document" || $interfaceName eq "WorkerGlobalScope" || $interfaceName eq "SharedWorkerGlobalScope" || $interfaceName eq "DedicatedWorkerGlobalScope") {
+                    if ($interfaceName eq "Document" || $codeGenerator->InheritsInterface($interface, "WorkerGlobalScope")) {
                         push(@implContent, "            if (JSObject* jsFunction = jsListener->jsFunction(impl))\n");
                     } else {
                         push(@implContent, "            if (JSObject* jsFunction = jsListener->jsFunction(impl->scriptExecutionContext()))\n");
@@ -2521,7 +2527,7 @@
                     push(@implContent, "    $className* castedThis = toJSDOMWindow(exec->hostThisValue().toThisObject(exec));\n");
                     push(@implContent, "    if (!castedThis)\n");
                     push(@implContent, "        return throwVMTypeError(exec);\n");
-                } elsif ($interface->extendedAttributes->{"IsWorkerGlobalScope"}) {
+                } elsif ($codeGenerator->InheritsInterface($interface, "WorkerGlobalScope")) {
                     push(@implContent, "    $className* castedThis = to${className}(exec->hostThisValue().toThisObject(exec));\n");
                     push(@implContent, "    if (!castedThis)\n");
                     push(@implContent, "        return throwVMTypeError(exec);\n");
@@ -4304,7 +4310,7 @@
 
     push(@$outputArray, "void ${constructorClassName}::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)\n");
     push(@$outputArray, "{\n");
-    if ($interfaceName eq "DOMWindow" || $interface->extendedAttributes->{"IsWorkerGlobalScope"}) {
+    if (IsDOMGlobalObject($interface)) {
         push(@$outputArray, "    Base::finishCreation(exec->vm());\n");
         push(@$outputArray, "    ASSERT(inherits(&s_info));\n");
         push(@$outputArray, "    putDirect(exec->vm(), exec->propertyNames().prototype, globalObject->prototype(), DontDelete | ReadOnly);\n");

Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt (152167 => 152168)


--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt	2013-06-28 15:58:03 UTC (rev 152167)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt	2013-06-28 16:01:32 UTC (rev 152168)
@@ -57,7 +57,6 @@
 EnabledBySetting=*
 EnforceRange
 EventTarget
-ExtendsDOMGlobalObject
 GenerateIsReachable=|Impl|ImplContext|ImplDocument|ImplElementRoot|ImplFrame|ImplOwnerNodeRoot
 GetterRaisesException
 GlobalContext=DOMWindow|WorkerGlobalScope|SharedWorkerGlobalScope|DedicatedWorkerGlobalScope
@@ -68,7 +67,6 @@
 InitializedByEventConstructor
 InterfaceName=*
 IsIndex
-IsWorkerGlobalScope
 JSCustomDefineOwnProperty
 JSCustomDefineOwnPropertyOnPrototype
 JSCustomFinalize

Modified: trunk/Source/WebCore/page/DOMWindow.idl (152167 => 152168)


--- trunk/Source/WebCore/page/DOMWindow.idl	2013-06-28 15:58:03 UTC (rev 152167)
+++ trunk/Source/WebCore/page/DOMWindow.idl	2013-06-28 16:01:32 UTC (rev 152168)
@@ -34,7 +34,6 @@
     JSCustomToNativeObject,
     CustomPutFunction,
     EventTarget,
-    ExtendsDOMGlobalObject,
     JSGenerateToNativeObject,
     ReplaceableConstructor,
     JSLegacyParent=JSDOMWindowBase,

Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.idl (152167 => 152168)


--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.idl	2013-06-28 15:58:03 UTC (rev 152167)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.idl	2013-06-28 16:01:32 UTC (rev 152168)
@@ -31,8 +31,6 @@
 [
     GlobalContext=DedicatedWorkerGlobalScope,
     Conditional=WORKERS,
-    ExtendsDOMGlobalObject,
-    IsWorkerGlobalScope,
     JSGenerateToNativeObject,
     JSNoStaticTables,
 ] interface DedicatedWorkerGlobalScope : WorkerGlobalScope {

Modified: trunk/Source/WebCore/workers/SharedWorkerGlobalScope.idl (152167 => 152168)


--- trunk/Source/WebCore/workers/SharedWorkerGlobalScope.idl	2013-06-28 15:58:03 UTC (rev 152167)
+++ trunk/Source/WebCore/workers/SharedWorkerGlobalScope.idl	2013-06-28 16:01:32 UTC (rev 152168)
@@ -31,8 +31,6 @@
 [
     GlobalContext=SharedWorkerGlobalScope,
     Conditional=SHARED_WORKERS,
-    ExtendsDOMGlobalObject,
-    IsWorkerGlobalScope,
     JSGenerateToNativeObject,
     JSNoStaticTables,
 ] interface SharedWorkerGlobalScope : WorkerGlobalScope {

Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.idl (152167 => 152168)


--- trunk/Source/WebCore/workers/WorkerGlobalScope.idl	2013-06-28 15:58:03 UTC (rev 152167)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.idl	2013-06-28 16:01:32 UTC (rev 152168)
@@ -30,8 +30,6 @@
     JSCustomMarkFunction,
     JSCustomGetOwnPropertySlotAndDescriptor,
     EventTarget,
-    ExtendsDOMGlobalObject,
-    IsWorkerGlobalScope,
     JSLegacyParent=JSWorkerGlobalScopeBase,
     JSNoStaticTables,
 ] interface WorkerGlobalScope {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to