Title: [96409] trunk/Source/WebCore
Revision
96409
Author
commit-qu...@webkit.org
Date
2011-09-30 11:20:22 -0700 (Fri, 30 Sep 2011)

Log Message

Fix EnabledAtRuntime support for constants.
https://bugs.webkit.org/show_bug.cgi?id=67311

Patch by Aaron Colwell <acolw...@chromium.org> on 2011-09-30
Reviewed by Adam Barth.

* bindings/scripts/CodeGeneratorV8.pm:
(GenerateImplementation):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (96408 => 96409)


--- trunk/Source/WebCore/ChangeLog	2011-09-30 18:18:15 UTC (rev 96408)
+++ trunk/Source/WebCore/ChangeLog	2011-09-30 18:20:22 UTC (rev 96409)
@@ -1,3 +1,13 @@
+2011-09-30  Aaron Colwell  <acolw...@chromium.org>
+
+        Fix EnabledAtRuntime support for constants.
+        https://bugs.webkit.org/show_bug.cgi?id=67311
+
+        Reviewed by Adam Barth.
+
+        * bindings/scripts/CodeGeneratorV8.pm:
+        (GenerateImplementation):
+
 2011-09-29  David Hyatt  <hy...@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=69043

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm (96408 => 96409)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-09-30 18:18:15 UTC (rev 96408)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm	2011-09-30 18:20:22 UTC (rev 96409)
@@ -2099,6 +2099,7 @@
 
     # Setup constants
     my $has_constants = 0;
+    my @constantsEnabledAtRuntime;
     if (@{$dataNode->constants}) {
         $has_constants = 1;
         push(@implContent, "static const BatchedConstant ${interfaceName}Consts[] = {\n");
@@ -2106,12 +2107,17 @@
     foreach my $constant (@{$dataNode->constants}) {
         my $name = $constant->name;
         my $value = $constant->value;
-        # FIXME: we need the static_cast here only because of one constant, NodeFilter.idl
-        # defines "const unsigned long SHOW_ALL = 0xFFFFFFFF".  It would be better if we
-        # handled this here, and converted it to a -1 constant in the c++ output.
-        push(@implContent, <<END);
+        my $attrExt = $constant->extendedAttributes;
+        if ($attrExt->{"EnabledAtRuntime"}) {
+            push(@constantsEnabledAtRuntime, $constant);
+        } else {
+            # FIXME: we need the static_cast here only because of one constant, NodeFilter.idl
+            # defines "const unsigned long SHOW_ALL = 0xFFFFFFFF".  It would be better if we
+            # handled this here, and converted it to a -1 constant in the c++ output.
+            push(@implContent, <<END);
     {"${name}", static_cast<signed int>($value)},
 END
+        }
     }
     if ($has_constants) {
         push(@implContent, "};\n\n");
@@ -2234,6 +2240,22 @@
         push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
     }
 
+    # Setup the enable-at-runtime constants if we have them
+    foreach my $runtime_const (@constantsEnabledAtRuntime) {
+        my $enable_function = GetRuntimeEnableFunctionName($runtime_const);
+        my $conditionalString = GenerateConditionalString($runtime_const);
+        my $name = $runtime_const->name;
+        my $value = $runtime_const->value;
+        push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
+        push(@implContent, "    if (${enable_function}()) {\n");
+        push(@implContent, <<END);
+        static const BatchedConstant constData = {"${name}", static_cast<signed int>(${value})};
+        batchConfigureConstants(desc, proto, &constData, 1);
+END
+        push(@implContent, "    }\n");
+        push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
+    }
+
     GenerateImplementationIndexer($dataNode, $indexer);
     GenerateImplementationNamedPropertyGetter($dataNode, $namedPropertyGetter);
     GenerateImplementationCustomCall($dataNode);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to