Changeset 96227 in webkit


Ignore:
Timestamp:
Sep 28, 2011 9:57:17 AM (13 years ago)
Author:
loislo@chromium.org
Message:

Web Inspector: optional arguments support for the frontend needs to be extended.
https://bugs.webkit.org/show_bug.cgi?id=69005

Generator supports optional arguments but they are transferred by value.
It is not suitable if the used type doesn't have operator bool.
I'll transfer such arguments by pointer.

Reviewed by Pavel Feldman.

Build is the test.

  • inspector/CodeGeneratorInspector.pm:

(generateFrontendFunction):
(paramTypeTraits):

  • inspector/InspectorDebuggerAgent.cpp:

(WebCore::InspectorDebuggerAgent::didParseSource):

  • inspector/InspectorResourceAgent.cpp:

(WebCore::InspectorResourceAgent::didFailLoading):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96224 r96227  
     12011-09-28  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Web Inspector: optional arguments support for the frontend needs to be extended.
     4        https://bugs.webkit.org/show_bug.cgi?id=69005
     5
     6        Generator supports optional arguments but they are transferred by value.
     7        It is not suitable if the used type doesn't have operator bool.
     8        I'll transfer such arguments by pointer.
     9
     10        Reviewed by Pavel Feldman.
     11
     12        Build is the test.
     13
     14        * inspector/CodeGeneratorInspector.pm:
     15        (generateFrontendFunction):
     16        (paramTypeTraits):
     17        * inspector/InspectorDebuggerAgent.cpp:
     18        (WebCore::InspectorDebuggerAgent::didParseSource):
     19        * inspector/InspectorResourceAgent.cpp:
     20        (WebCore::InspectorResourceAgent::didFailLoading):
     21
    1222011-09-28  Antaryami Pandia  <antaryami.pandia@motorola.com>
    223
  • trunk/Source/WebCore/inspector/CodeGeneratorInspector.pm

    r96222 r96227  
    135135$typeTransform{"String"} = {
    136136    "param" => "const String&",
     137    "optional_param" => "const String* const",
     138    "optional_valueAccessor" => "*",
    137139    "variable" => "String",
    138140    "return" => "String",
     
    145147$typeTransform{"long"} = {
    146148    "param" => "long",
     149    "optional_param" => "const long* const",
     150    "optional_valueAccessor" => "*",
    147151    "variable" => "long",
    148152    "defaultValue" => "0",
     
    154158$typeTransform{"int"} = {
    155159    "param" => "int",
     160    "optional_param" => "const int* const",
     161    "optional_valueAccessor" => "*",
    156162    "variable" => "int",
    157163    "defaultValue" => "0",
     
    163169$typeTransform{"unsigned long"} = {
    164170    "param" => "unsigned long",
     171    "optional_param" => "const unsigned long* const",
     172    "optional_valueAccessor" => "*",
    165173    "variable" => "unsigned long",
    166174    "defaultValue" => "0u",
     
    172180$typeTransform{"unsigned int"} = {
    173181    "param" => "unsigned int",
     182    "optional_param" => "const unsigned int* const",
     183    "optional_valueAccessor" => "*",
    174184    "variable" => "unsigned int",
    175185    "defaultValue" => "0u",
     
    181191$typeTransform{"double"} = {
    182192    "param" => "double",
     193    "optional_param" => "const double* const",
     194    "optional_valueAccessor" => "*",
    183195    "variable" => "double",
    184196    "defaultValue" => "0.0",
     
    190202$typeTransform{"boolean"} = {
    191203    "param" => "bool",
     204    "optional_param" => "const bool* const",
     205    "optional_valueAccessor" => "*",
    192206    "variable"=> "bool",
    193207    "defaultValue" => "false",
     
    377391    my @argsFiltered = grep($_->direction eq "out", @{$function->parameters}); # just keep only out parameters for frontend interface.
    378392    map($frontendTypes{$_->type} = 1, @argsFiltered); # register required types.
    379     my $arguments = join(", ", map(typeTraits($_->type, "param") . " " . $_->name, @argsFiltered)); # prepare arguments for function signature.
     393    my $arguments = join(", ", map(paramTypeTraits($_, "param") . " " . $_->name, @argsFiltered)); # prepare arguments for function signature.
    380394
    381395    my $signature = "        void ${functionName}(${arguments});";
     
    394408        foreach my $parameter (@argsFiltered) {
    395409            my $optional = $parameter->extendedAttributes->{"optional"} ? "if (" . $parameter->name . ")\n        " : "";
    396             push(@function, "    " . $optional . "paramsObject->set" . typeTraits($parameter->type, "JSONType") . "(\"" . $parameter->name . "\", " . $parameter->name . ");");
     410            push(@function, "    " . $optional . "paramsObject->set" . paramTypeTraits($parameter, "JSONType") . "(\"" . $parameter->name . "\", " . paramTypeTraits($parameter, "valueAccessor") . $parameter->name . ");");
    397411        }
    398412        push(@function, "    ${functionName}Message->setObject(\"params\", paramsObject);");
     
    10951109    my $trait = shift;
    10961110    return $typeTransform{$type}->{$trait};
     1111}
     1112
     1113sub paramTypeTraits
     1114{
     1115    my $paramDescription = shift;
     1116    my $trait = shift;
     1117    if ($paramDescription->extendedAttributes->{"optional"}) {
     1118        my $optionalResult = typeTraits($paramDescription->type, "optional_" . $trait);
     1119        return $optionalResult if defined $optionalResult;
     1120    }
     1121    my $result = typeTraits($paramDescription->type, $trait);
     1122    return defined $result ? $result : "";
    10971123}
    10981124
  • trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp

    r95901 r96227  
    438438{
    439439    // Don't send script content to the front end until it's really needed.
    440     m_frontend->scriptParsed(scriptId, script.url, script.startLine, script.startColumn, script.endLine, script.endColumn, script.isContentScript);
     440    m_frontend->scriptParsed(scriptId, script.url, script.startLine, script.startColumn, script.endLine, script.endColumn, script.isContentScript ? &script.isContentScript : 0);
    441441
    442442    m_scripts.set(scriptId, script);
  • trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp

    r95901 r96227  
    300300    }
    301301
    302     m_frontend->loadingFailed(requestId, currentTime(), error.localizedDescription(), error.isCancellation());
     302    bool canceled = error.isCancellation();
     303    m_frontend->loadingFailed(requestId, currentTime(), error.localizedDescription(), canceled ? &canceled : 0);
    303304}
    304305
Note: See TracChangeset for help on using the changeset viewer.