Title: [99463] trunk/Source/WebCore
Revision
99463
Author
[email protected]
Date
2011-11-07 12:50:13 -0800 (Mon, 07 Nov 2011)

Log Message

Refactor CodeGeneratorV8.pm before making a core change for bug 71093.
https://bugs.webkit.org/show_bug.cgi?id=71659

Reviewed by Adam Barth.

Just refactor CodeGeneratorV8.pm without any change in behavior,
as the first step for fixing bug 71093.

Tests: WebCore/bindings/scripts/test/TestObj.idl
       WebCore/bindings/scripts/test/TestInterface.idl

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateHeader): Sort generated headers in alphabetical order. Removed unnecessary variable names from method signatures. These changes are for silencing style check errors when a new TestXXXX.idl is added.
(GenerateConstructorCallback): Renamed variables to clarify their roles.
(WriteData): Removed an unused array @implHeaderContent.
* bindings/scripts/test/V8/V8TestInterface.h: Updated a run-binding-tests result.
* bindings/scripts/test/V8/V8TestMediaQueryListListener.h: Ditto.
* bindings/scripts/test/V8/V8TestObj.h: Ditto.
* bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h: Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (99462 => 99463)


--- trunk/Source/WebCore/ChangeLog	2011-11-07 20:48:35 UTC (rev 99462)
+++ trunk/Source/WebCore/ChangeLog	2011-11-07 20:50:13 UTC (rev 99463)
@@ -1,3 +1,25 @@
+2011-11-07  Kentaro Hara  <[email protected]>
+
+        Refactor CodeGeneratorV8.pm before making a core change for bug 71093.
+        https://bugs.webkit.org/show_bug.cgi?id=71659
+
+        Reviewed by Adam Barth.
+
+        Just refactor CodeGeneratorV8.pm without any change in behavior,
+        as the first step for fixing bug 71093.
+
+        Tests: WebCore/bindings/scripts/test/TestObj.idl
+               WebCore/bindings/scripts/test/TestInterface.idl
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateHeader): Sort generated headers in alphabetical order. Removed unnecessary variable names from method signatures. These changes are for silencing style check errors when a new TestXXXX.idl is added.
+        (GenerateConstructorCallback): Renamed variables to clarify their roles.
+        (WriteData): Removed an unused array @implHeaderContent.
+        * bindings/scripts/test/V8/V8TestInterface.h: Updated a run-binding-tests result.
+        * bindings/scripts/test/V8/V8TestMediaQueryListListener.h: Ditto.
+        * bindings/scripts/test/V8/V8TestObj.h: Ditto.
+        * bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h: Ditto.
+
 2011-11-07  Ken Buchanan <[email protected]>
 
         Crash due to mixed direction text runs

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (99462 => 99463)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-11-07 20:48:35 UTC (rev 99462)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-11-07 20:50:13 UTC (rev 99463)
@@ -39,7 +39,6 @@
 my @headerContent = ();
 my @implContentHeader = ();
 my @implFixedHeader = ();
-my @implHeaderContent = ();
 my @implContent = ();
 my @implContentDecls = ();
 my %implIncludes = ();
@@ -283,6 +282,8 @@
     $headerIncludes{"wtf/text/StringHash.h"} = 1;
     $headerIncludes{"WrapperTypeInfo.h"} = 1;
     $headerIncludes{"V8DOMWrapper.h"} = 1;
+    $headerIncludes{"wtf/HashMap.h"} = 1;
+    $headerIncludes{"v8.h"} = 1;
 
     my $headerClassInclude = GetHeaderClassInclude($implClassName);
     $headerIncludes{$headerClassInclude} = 1 if $headerClassInclude ne "";
@@ -290,16 +291,13 @@
     my ($svgPropertyType, $svgListPropertyType, $svgNativeType) = GetSVGPropertyTypes($implClassName);
 
     foreach my $headerInclude (sort keys(%headerIncludes)) {
-        if ($headerInclude =~ /wtf/) {
+        if ($headerInclude =~ /wtf|v8\.h/) {
             push(@headerContent, "#include \<${headerInclude}\>\n");
         } else {
             push(@headerContent, "#include \"${headerInclude}\"\n");
         }
     }
 
-    push(@headerContent, "#include <v8.h>\n");
-    push(@headerContent, "#include <wtf/HashMap.h>\n");
-
     push(@headerContent, "\nnamespace WebCore {\n");
     push(@headerContent, "\ntemplate<typename PropertyType> class SVGPropertyTearOff;\n") if $svgPropertyType;
     if ($svgNativeType) {
@@ -339,7 +337,7 @@
     my $forceNewObjectCall = IsDOMNodeType($interfaceName) ? ", forceNewObject" : "";
 
     push(@headerContent, <<END);
-    static bool HasInstance(v8::Handle<v8::Value> value);
+    static bool HasInstance(v8::Handle<v8::Value>);
     static v8::Persistent<v8::FunctionTemplate> GetRawTemplate();
     static v8::Persistent<v8::FunctionTemplate> GetTemplate();
     static ${nativeType}* toNative(v8::Handle<v8::Object> object)
@@ -385,7 +383,7 @@
 
     if ($dataNode->extendedAttributes->{"CustomConstructor"} || $dataNode->extendedAttributes->{"V8CustomConstructor"} || $dataNode->extendedAttributes->{"CanBeConstructed"} || $dataNode->extendedAttributes->{"Constructor"}) {
         push(@headerContent, <<END);
-    static v8::Handle<v8::Value> constructorCallback(const v8::Arguments& args);
+    static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
 END
     }
 
@@ -1522,7 +1520,8 @@
         }
     }
 
-    my @extraArgumentList;
+    my @beforeArgumentList;
+    my @afterArgumentList;
     push(@implContent, <<END);
 v8::Handle<v8::Value> V8${implClassName}::constructorCallback(const v8::Arguments& args)
 {
@@ -1546,9 +1545,8 @@
     my ($parameterCheckString, $paramIndex) = GenerateParametersCheck($function, $implClassName);
     push(@implContent, $parameterCheckString);
 
-    my @contextArgument;
     if ($dataNode->extendedAttributes->{"CallWith"} && $dataNode->extendedAttributes->{"CallWith"} eq "ScriptExecutionContext") {
-        push(@contextArgument, "context");
+        push(@beforeArgumentList, "context");
         push(@implContent, <<END);
 
     ScriptExecutionContext* context = getScriptExecutionContext();
@@ -1558,7 +1556,7 @@
     }
 
     if ($dataNode->extendedAttributes->{"ConstructorRaisesException"}) {
-        push(@extraArgumentList, "ec");
+        push(@afterArgumentList, "ec");
     }
 
     my @argumentList;
@@ -1569,7 +1567,7 @@
         $index++;
     }
 
-    my $argumentString = join(", ", @contextArgument, @argumentList, @extraArgumentList);
+    my $argumentString = join(", ", @beforeArgumentList, @argumentList, @afterArgumentList);
     push(@implContent, "\n");
     push(@implContent, "    RefPtr<${implClassName}> obj = ${implClassName}::create(${argumentString});\n");
 
@@ -3519,7 +3517,6 @@
 
         %implIncludes = ();
         @implFixedHeader = ();
-        @implHeaderContent = ();
         @implContentDecls = ();
         @implContent = ();
     }

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h (99462 => 99463)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h	2011-11-07 20:48:35 UTC (rev 99462)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h	2011-11-07 20:50:13 UTC (rev 99463)
@@ -26,16 +26,16 @@
 #include "TestInterface.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
-#include <wtf/text/StringHash.h>
 #include <v8.h>
 #include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
 
 namespace WebCore {
 
 class V8TestInterface {
 public:
     static const bool hasDependentLifetime = true;
-    static bool HasInstance(v8::Handle<v8::Value> value);
+    static bool HasInstance(v8::Handle<v8::Value>);
     static v8::Persistent<v8::FunctionTemplate> GetRawTemplate();
     static v8::Persistent<v8::FunctionTemplate> GetTemplate();
     static TestInterface* toNative(v8::Handle<v8::Object> object)
@@ -46,7 +46,7 @@
     static void derefObject(void*);
     static WrapperTypeInfo info;
     static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);
-    static v8::Handle<v8::Value> constructorCallback(const v8::Arguments& args);
+    static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
     static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
     static v8::Handle<v8::Object> existingWrapper(TestInterface*);
 

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h (99462 => 99463)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h	2011-11-07 20:48:35 UTC (rev 99462)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestMediaQueryListListener.h	2011-11-07 20:50:13 UTC (rev 99463)
@@ -24,16 +24,16 @@
 #include "TestMediaQueryListListener.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
-#include <wtf/text/StringHash.h>
 #include <v8.h>
 #include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
 
 namespace WebCore {
 
 class V8TestMediaQueryListListener {
 public:
     static const bool hasDependentLifetime = false;
-    static bool HasInstance(v8::Handle<v8::Value> value);
+    static bool HasInstance(v8::Handle<v8::Value>);
     static v8::Persistent<v8::FunctionTemplate> GetRawTemplate();
     static v8::Persistent<v8::FunctionTemplate> GetTemplate();
     static TestMediaQueryListListener* toNative(v8::Handle<v8::Object> object)

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h (99462 => 99463)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h	2011-11-07 20:48:35 UTC (rev 99462)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestObj.h	2011-11-07 20:50:13 UTC (rev 99463)
@@ -24,16 +24,16 @@
 #include "TestObj.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
-#include <wtf/text/StringHash.h>
 #include <v8.h>
 #include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
 
 namespace WebCore {
 
 class V8TestObj {
 public:
     static const bool hasDependentLifetime = false;
-    static bool HasInstance(v8::Handle<v8::Value> value);
+    static bool HasInstance(v8::Handle<v8::Value>);
     static v8::Persistent<v8::FunctionTemplate> GetRawTemplate();
     static v8::Persistent<v8::FunctionTemplate> GetTemplate();
     static TestObj* toNative(v8::Handle<v8::Object> object)
@@ -45,7 +45,7 @@
     static WrapperTypeInfo info;
     static v8::Handle<v8::Value> customMethodCallback(const v8::Arguments&);
     static v8::Handle<v8::Value> customMethodWithArgsCallback(const v8::Arguments&);
-    static v8::Handle<v8::Value> constructorCallback(const v8::Arguments& args);
+    static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);
     static v8::Handle<v8::Value> customAttrAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info);
     static void customAttrAccessorSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info);
     static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;

Modified: trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h (99462 => 99463)


--- trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h	2011-11-07 20:48:35 UTC (rev 99462)
+++ trunk/Source/WebCore/bindings/scripts/test/V8/V8TestSerializedScriptValueInterface.h	2011-11-07 20:50:13 UTC (rev 99463)
@@ -26,16 +26,16 @@
 #include "TestSerializedScriptValueInterface.h"
 #include "V8DOMWrapper.h"
 #include "WrapperTypeInfo.h"
-#include <wtf/text/StringHash.h>
 #include <v8.h>
 #include <wtf/HashMap.h>
+#include <wtf/text/StringHash.h>
 
 namespace WebCore {
 
 class V8TestSerializedScriptValueInterface {
 public:
     static const bool hasDependentLifetime = false;
-    static bool HasInstance(v8::Handle<v8::Value> value);
+    static bool HasInstance(v8::Handle<v8::Value>);
     static v8::Persistent<v8::FunctionTemplate> GetRawTemplate();
     static v8::Persistent<v8::FunctionTemplate> GetTemplate();
     static TestSerializedScriptValueInterface* toNative(v8::Handle<v8::Object> object)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to