Title: [151283] trunk/Source/WebCore
Revision
151283
Author
[email protected]
Date
2013-06-06 11:45:54 -0700 (Thu, 06 Jun 2013)

Log Message

Clean up AddIncludesForType in JSC bindings generators
https://bugs.webkit.org/show_bug.cgi?id=117297

Reviewed by Kentaro Hara.

Clean up AddIncludesForType in JSC bindings generators:
- Add JSC specific SkipIncludeHeader() subroutine and move
exceptions there.
- Remove special case for SerializedScriptValue by improving
the condition for callbacks: "JS" prefix is now only added to
headers in callbacks if they are wrapper types. Non-wrapper
types such as SerializedScriptValue do not have a JS*.h
header.

No new tests, code clean up.

* bindings/scripts/CodeGenerator.pm:
(SkipIncludeHeader):
- Reuse IsPrimitiveType() to avoid code duplication.
- Remove special case for String as this is not a valid IDL type
and it is not currently used.
* bindings/scripts/CodeGeneratorJS.pm:
(SkipIncludeHeader):
(AddIncludesForType):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (151282 => 151283)


--- trunk/Source/WebCore/ChangeLog	2013-06-06 17:18:09 UTC (rev 151282)
+++ trunk/Source/WebCore/ChangeLog	2013-06-06 18:45:54 UTC (rev 151283)
@@ -1,3 +1,30 @@
+2013-06-06  Christophe Dumez  <[email protected]>
+
+        Clean up AddIncludesForType in JSC bindings generators
+        https://bugs.webkit.org/show_bug.cgi?id=117297
+
+        Reviewed by Kentaro Hara.
+
+        Clean up AddIncludesForType in JSC bindings generators:
+        - Add JSC specific SkipIncludeHeader() subroutine and move
+        exceptions there.
+        - Remove special case for SerializedScriptValue by improving
+        the condition for callbacks: "JS" prefix is now only added to
+        headers in callbacks if they are wrapper types. Non-wrapper
+        types such as SerializedScriptValue do not have a JS*.h
+        header.
+
+        No new tests, code clean up.
+
+        * bindings/scripts/CodeGenerator.pm:
+        (SkipIncludeHeader):
+        - Reuse IsPrimitiveType() to avoid code duplication.
+        - Remove special case for String as this is not a valid IDL type
+        and it is not currently used.
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (SkipIncludeHeader):
+        (AddIncludesForType):
+
 2013-06-06  Radu Stavila  <[email protected]>
 
         :hover style not applied on hover if its display property is different from original style's

Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (151282 => 151283)


--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2013-06-06 17:18:09 UTC (rev 151282)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm	2013-06-06 18:45:54 UTC (rev 151283)
@@ -332,9 +332,7 @@
     my $object = shift;
     my $type = shift;
 
-    return 1 if $primitiveTypeHash{$type};
-    return 1 if $numericTypeHash{$type};
-    return 1 if $type eq "String";
+    return 1 if $object->IsPrimitiveType($type);
 
     # Special case: SVGPoint.h / SVGNumber.h do not exist.
     return 1 if $type eq "SVGPoint" or $type eq "SVGNumber";

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (151282 => 151283)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-06-06 17:18:09 UTC (rev 151282)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2013-06-06 18:45:54 UTC (rev 151283)
@@ -202,31 +202,43 @@
     AddIncludesForType($type, $isCallback, \%headerIncludes);
 }
 
+my %typesWithoutHeader = (
+    "Array" => 1,
+    "DOMString" => 1,
+    "DOMTimeStamp" => 1,
+    "any" => 1
+);
+
+sub SkipIncludeHeader
+{
+    my $type = shift;
+
+    return 1 if $codeGenerator->SkipIncludeHeader($type);
+    return 1 if $codeGenerator->GetSequenceType($type) or $codeGenerator->GetArrayType($type);
+    return $typesWithoutHeader{$type};
+}
+
 sub AddIncludesForType
 {
     my $type = shift;
     my $isCallback = shift;
     my $includesRef = shift;
 
+    return if SkipIncludeHeader($type);
+
     # When we're finished with the one-file-per-class
     # reorganization, we won't need these special cases.
-    if ($codeGenerator->IsPrimitiveType($type) or $codeGenerator->SkipIncludeHeader($type)
-        or $type eq "DOMString" or $type eq "any" or $type eq "Array" or $type eq "DOMTimeStamp") {
-    } elsif ($type =~ /SVGPathSeg/) {
+    if ($type =~ /SVGPathSeg/) {
         my $joinedName = $type;
         $joinedName =~ s/Abs|Rel//;
         $includesRef->{"${joinedName}.h"} = 1;
     } elsif ($type eq "XPathNSResolver") {
         $includesRef->{"JSXPathNSResolver.h"} = 1;
         $includesRef->{"JSCustomXPathNSResolver.h"} = 1;
-    } elsif ($type eq "SerializedScriptValue") {
-        $includesRef->{"SerializedScriptValue.h"} = 1;
-    } elsif ($isCallback) {
+    } elsif ($isCallback && $codeGenerator->IsWrapperType($type)) {
         $includesRef->{"JS${type}.h"} = 1;
     } elsif ($codeGenerator->IsTypedArrayType($type)) {
         $includesRef->{"<wtf/${type}.h>"} = 1;
-    } elsif ($codeGenerator->GetSequenceType($type)) {
-    } elsif ($codeGenerator->GetArrayType($type)) {
     } else {
         # default, include the same named file
         $includesRef->{"${type}.h"} = 1;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to