Changeset 96409 in webkit


Ignore:
Timestamp:
Sep 30, 2011 11:20:22 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

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

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

  • bindings/scripts/CodeGeneratorV8.pm:

(GenerateImplementation):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96408 r96409  
     12011-09-30  Aaron Colwell  <acolwell@chromium.org>
     2
     3        Fix EnabledAtRuntime support for constants.
     4        https://bugs.webkit.org/show_bug.cgi?id=67311
     5
     6        Reviewed by Adam Barth.
     7
     8        * bindings/scripts/CodeGeneratorV8.pm:
     9        (GenerateImplementation):
     10
    1112011-09-29  David Hyatt  <hyatt@apple.com>
    212
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r96030 r96409  
    21002100    # Setup constants
    21012101    my $has_constants = 0;
     2102    my @constantsEnabledAtRuntime;
    21022103    if (@{$dataNode->constants}) {
    21032104        $has_constants = 1;
     
    21072108        my $name = $constant->name;
    21082109        my $value = $constant->value;
    2109         # FIXME: we need the static_cast here only because of one constant, NodeFilter.idl
    2110         # defines "const unsigned long SHOW_ALL = 0xFFFFFFFF".  It would be better if we
    2111         # handled this here, and converted it to a -1 constant in the c++ output.
    2112         push(@implContent, <<END);
     2110        my $attrExt = $constant->extendedAttributes;
     2111        if ($attrExt->{"EnabledAtRuntime"}) {
     2112            push(@constantsEnabledAtRuntime, $constant);
     2113        } else {
     2114            # FIXME: we need the static_cast here only because of one constant, NodeFilter.idl
     2115            # defines "const unsigned long SHOW_ALL = 0xFFFFFFFF".  It would be better if we
     2116            # handled this here, and converted it to a -1 constant in the c++ output.
     2117            push(@implContent, <<END);
    21132118    {"${name}", static_cast<signed int>($value)},
    21142119END
     2120        }
    21152121    }
    21162122    if ($has_constants) {
     
    22322238    }
    22332239END
     2240        push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
     2241    }
     2242
     2243    # Setup the enable-at-runtime constants if we have them
     2244    foreach my $runtime_const (@constantsEnabledAtRuntime) {
     2245        my $enable_function = GetRuntimeEnableFunctionName($runtime_const);
     2246        my $conditionalString = GenerateConditionalString($runtime_const);
     2247        my $name = $runtime_const->name;
     2248        my $value = $runtime_const->value;
     2249        push(@implContent, "\n#if ${conditionalString}\n") if $conditionalString;
     2250        push(@implContent, "    if (${enable_function}()) {\n");
     2251        push(@implContent, <<END);
     2252        static const BatchedConstant constData = {"${name}", static_cast<signed int>(${value})};
     2253        batchConfigureConstants(desc, proto, &constData, 1);
     2254END
     2255        push(@implContent, "    }\n");
    22342256        push(@implContent, "\n#endif // ${conditionalString}\n") if $conditionalString;
    22352257    }
Note: See TracChangeset for help on using the changeset viewer.