Changeset 70844 in webkit


Ignore:
Timestamp:
Oct 28, 2010 11:32:52 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-10-28 Sergio Villar Senin <svillar@igalia.com>

Reviewed by Xan Lopez.

[GTK] GObject bindings generator issues
https://bugs.webkit.org/show_bug.cgi?id=48135

GObject code generator must not generate conditional API's. This
patch also adds an alternative return value for non-void
conditional methods. With this change the conditionalMethods hack
is no longer needed.

  • bindings/scripts/CodeGeneratorGObject.pm:
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r70843 r70844  
     12010-10-28  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Reviewed by Xan Lopez.
     4
     5        [GTK] GObject bindings generator issues
     6        https://bugs.webkit.org/show_bug.cgi?id=48135
     7
     8        GObject code generator must not generate conditional API's. This
     9        patch also adds an alternative return value for non-void
     10        conditional methods. With this change the conditionalMethods hack
     11        is no longer needed.
     12
     13        * bindings/scripts/CodeGeneratorGObject.pm:
     14
    1152010-10-28  David Hyatt  <hyatt@apple.com>
    216
  • trunk/WebCore/bindings/scripts/CodeGeneratorGObject.pm

    r66308 r70844  
    797797}
    798798
    799 # Some methods' body (only the body, since the public API can't be
    800 # conditional) should be guarded by #ifdefs depending on whether
    801 # certain features in WebKit are enabled.
    802 my %conditionalMethods = ("webkit_dom_geolocation_clear_watch" => "GEOLOCATION");
    803 
    804799sub GenerateFunction {
    805800    my ($object, $interfaceName, $function, $prefix) = @_;
     
    880875    }
    881876
    882     push(@hBody, "#if ${conditionalString}\n") if $conditionalString;
    883877    push(@hBody, "WEBKIT_API $returnType\n$functionName($functionSig);\n");
    884     push(@hBody, "#endif /* ${conditionalString} */\n") if $conditionalString;
    885878    push(@hBody, "\n");
    886879
     880    push(@cBody, "$returnType\n$functionName($functionSig)\n{\n");
    887881    push(@cBody, "#if ${conditionalString}\n") if $conditionalString;
    888     push(@cBody, "$returnType\n$functionName($functionSig)\n{\n");
    889     push(@cBody, "    WebCore::JSMainThreadNullState state;\n");
    890 
    891     if ($conditionalMethods{$functionName}) {
    892         push(@cBody, "#if ENABLE($conditionalMethods{$functionName})\n");
    893     }
    894882
    895883    if ($returnType ne "void") {
     
    899887        push(@cBody, "    g_return_if_fail(self);\n");
    900888    }
     889
     890    push(@cBody, "    WebCore::JSMainThreadNullState state;\n");
    901891
    902892    # The WebKit::core implementations check for NULL already; no need to
     
    10511041    }
    10521042
    1053     if ($conditionalMethods{$functionName}) {
    1054         push(@cBody, "#endif\n");
    1055     }
    1056 
    1057     push(@cBody, "}\n");
    1058     push(@cBody, "#endif /* ${conditionalString} */\n") if $conditionalString;
    1059     push(@cBody, "\n");
     1043    if ($conditionalString) {
     1044        if ($returnType ne "void") {
     1045            push(@cBody, "#else\n");
     1046            if ($codeGenerator->IsNonPointerType($functionSigType)) {
     1047                push(@cBody, "    return static_cast<${returnType}>(0);\n");
     1048            } else {
     1049                push(@cBody, "    return NULL;\n");
     1050            }
     1051        }
     1052        push(@cBody, "#endif /* ${conditionalString} */\n") if $conditionalString;
     1053    }
     1054
     1055    push(@cBody, "}\n\n");
    10601056}
    10611057
Note: See TracChangeset for help on using the changeset viewer.