| OLD | NEW | 
|     1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |     1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 
|     2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> |     2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> | 
|     3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |     3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 
|     4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> |     4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> | 
|     5 # Copyright (C) 2006 Apple Computer, Inc. |     5 # Copyright (C) 2006 Apple Computer, Inc. | 
|     6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. |     6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. | 
|     7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |     7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 
|     8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. |     8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. | 
|     9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |     9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 
|    10 # Copyright (C) 2012 Ericsson AB. All rights reserved. |    10 # Copyright (C) 2012 Ericsson AB. All rights reserved. | 
| (...skipping 4135 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4146             AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implement
      edByImplName)); |  4146             AddToImplIncludes(HeaderFilesForInterface($implementedBy, $implement
      edByImplName)); | 
|  4147         } |  4147         } | 
|  4148         if ($attrExt->{"EnabledAtRuntime"}) { |  4148         if ($attrExt->{"EnabledAtRuntime"}) { | 
|  4149             push(@constantsEnabledAtRuntime, $constant); |  4149             push(@constantsEnabledAtRuntime, $constant); | 
|  4150         } else { |  4150         } else { | 
|  4151             my $conditionalString = GenerateConditionalString($constant); |  4151             my $conditionalString = GenerateConditionalString($constant); | 
|  4152             $code .= "#if ${conditionalString}\n" if $conditionalString; |  4152             $code .= "#if ${conditionalString}\n" if $conditionalString; | 
|  4153             $code .= <<END; |  4153             $code .= <<END; | 
|  4154     {"${name}", $value}, |  4154     {"${name}", $value}, | 
|  4155 END |  4155 END | 
|  4156             $code .= "#endif\n" if $conditionalString; |  4156             $code .= "#endif // $conditionalString\n" if $conditionalString; | 
|  4157         } |  4157         } | 
|  4158     } |  4158     } | 
|  4159     if ($has_constants) { |  4159     if ($has_constants) { | 
|  4160         $code .= "};\n\n"; |  4160         $code .= "};\n\n"; | 
|  4161         $code .= join "", GenerateCompileTimeCheckForEnumsIfNeeded($interface); |  4161         $code .= join "", GenerateCompileTimeCheckForEnumsIfNeeded($interface); | 
|  4162         $implementation{nameSpaceWebCore}->add($code); |  4162         $implementation{nameSpaceWebCore}->add($code); | 
|  4163     } |  4163     } | 
|  4164  |  4164  | 
|  4165     if (!HasCustomConstructor($interface)) { |  4165     if (!HasCustomConstructor($interface)) { | 
|  4166         if ($interface->extendedAttributes->{"NamedConstructor"}) { |  4166         if ($interface->extendedAttributes->{"NamedConstructor"}) { | 
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4234         ${v8ClassName}Methods, WTF_ARRAY_LENGTH(${v8ClassName}Methods), isolate,
       currentWorldType); |  4234         ${v8ClassName}Methods, WTF_ARRAY_LENGTH(${v8ClassName}Methods), isolate,
       currentWorldType); | 
|  4235 END |  4235 END | 
|  4236     } else { |  4236     } else { | 
|  4237         $code .= <<END; |  4237         $code .= <<END; | 
|  4238         0, 0, isolate, currentWorldType); |  4238         0, 0, isolate, currentWorldType); | 
|  4239 END |  4239 END | 
|  4240     } |  4240     } | 
|  4241  |  4241  | 
|  4242     AddToImplIncludes("wtf/UnusedParam.h"); |  4242     AddToImplIncludes("wtf/UnusedParam.h"); | 
|  4243     $code .= <<END; |  4243     $code .= <<END; | 
|  4244     UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. |  4244     UNUSED_PARAM(defaultSignature); | 
|  4245 END |  4245 END | 
|  4246  |  4246  | 
|  4247     if (IsConstructable($interface)) { |  4247     if (IsConstructable($interface)) { | 
|  4248         $code .= "    desc->SetCallHandler(${v8ClassName}::constructorCallback);
      \n"; |  4248         $code .= "    desc->SetCallHandler(${v8ClassName}::constructorCallback);
      \n"; | 
|  4249         my $interfaceLength = GetInterfaceLength($interface); |  4249         my $interfaceLength = GetInterfaceLength($interface); | 
|  4250         $code .= "    desc->SetLength(${interfaceLength});\n"; |  4250         $code .= "    desc->SetLength(${interfaceLength});\n"; | 
|  4251     } |  4251     } | 
|  4252  |  4252  | 
|  4253     if ($access_check or @enabledAtRuntimeAttributes or @normalFunctions or $has
      _constants) { |  4253     if ($access_check or @enabledAtRuntimeAttributes or @normalFunctions or $has
      _constants) { | 
|  4254         $code .=  <<END; |  4254         $code .=  <<END; | 
|  4255     v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); |  4255     v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); | 
|  4256     v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); |  4256     v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); | 
|  4257     UNUSED_PARAM(instance); // In some cases, it will not be used. |  4257     UNUSED_PARAM(instance); | 
|  4258     UNUSED_PARAM(proto); // In some cases, it will not be used. |  4258     UNUSED_PARAM(proto); | 
|  4259 END |  4259 END | 
|  4260     } |  4260     } | 
|  4261  |  4261  | 
|  4262     if ($access_check) { |  4262     if ($access_check) { | 
|  4263         $code .=  "    $access_check\n"; |  4263         $code .=  "    $access_check\n"; | 
|  4264     } |  4264     } | 
|  4265  |  4265  | 
|  4266     # Setup the enable-at-runtime attributes if we have them |  4266     # Setup the enable-at-runtime attributes if we have them | 
|  4267     foreach my $runtime_attr (@enabledAtRuntimeAttributes) { |  4267     foreach my $runtime_attr (@enabledAtRuntimeAttributes) { | 
|  4268         next if grep { $_ eq $runtime_attr } @enabledPerContextAttributes; |  4268         next if grep { $_ eq $runtime_attr } @enabledPerContextAttributes; | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|  4288         $code .= "\n#if ${conditionalString}\n" if $conditionalString; |  4288         $code .= "\n#if ${conditionalString}\n" if $conditionalString; | 
|  4289         $code .= "    if (${enable_function}()) {\n"; |  4289         $code .= "    if (${enable_function}()) {\n"; | 
|  4290         $code .= <<END; |  4290         $code .= <<END; | 
|  4291         static const V8DOMConfiguration::ConstantConfiguration constantConfigura
      tion = {"${name}", static_cast<signed int>(${value})}; |  4291         static const V8DOMConfiguration::ConstantConfiguration constantConfigura
      tion = {"${name}", static_cast<signed int>(${value})}; | 
|  4292         V8DOMConfiguration::installConstants(desc, proto, &constantConfiguration
      , 1, isolate); |  4292         V8DOMConfiguration::installConstants(desc, proto, &constantConfiguration
      , 1, isolate); | 
|  4293 END |  4293 END | 
|  4294         $code .= "    }\n"; |  4294         $code .= "    }\n"; | 
|  4295         $code .= "\n#endif // ${conditionalString}\n" if $conditionalString; |  4295         $code .= "\n#endif // ${conditionalString}\n" if $conditionalString; | 
|  4296     } |  4296     } | 
|  4297  |  4297  | 
 |  4298     if ($has_constants) { | 
 |  4299         $code .= <<END; | 
 |  4300     V8DOMConfiguration::installConstants(desc, proto, ${v8ClassName}Constants, W
      TF_ARRAY_LENGTH(${v8ClassName}Constants), isolate); | 
 |  4301 END | 
 |  4302     } | 
 |  4303  | 
|  4298     $code .= GenerateImplementationIndexedPropertyAccessors($interface); |  4304     $code .= GenerateImplementationIndexedPropertyAccessors($interface); | 
|  4299     $code .= GenerateImplementationNamedPropertyAccessors($interface); |  4305     $code .= GenerateImplementationNamedPropertyAccessors($interface); | 
|  4300     $code .= GenerateImplementationLegacyCall($interface); |  4306     $code .= GenerateImplementationLegacyCall($interface); | 
|  4301     $code .= GenerateImplementationMasqueradesAsUndefined($interface); |  4307     $code .= GenerateImplementationMasqueradesAsUndefined($interface); | 
|  4302  |  4308  | 
|  4303     # Define our functions with Set() or SetAccessor() |  4309     # Define our functions with Set() or SetAccessor() | 
|  4304     my $total_functions = 0; |  4310     my $total_functions = 0; | 
|  4305     foreach my $function (@normalFunctions) { |  4311     foreach my $function (@normalFunctions) { | 
|  4306         # Only one accessor is needed for overloaded methods: |  4312         # Only one accessor is needed for overloaded methods: | 
|  4307         next if $function->{overloadIndex} > 1; |  4313         next if $function->{overloadIndex} > 1; | 
|  4308         next if $function->name eq ""; |  4314         next if $function->name eq ""; | 
|  4309  |  4315  | 
|  4310         $total_functions++; |  4316         $total_functions++; | 
|  4311         next if IsStandardFunction($interface, $function); |  4317         next if IsStandardFunction($interface, $function); | 
|  4312         $code .= GenerateNonStandardFunction($interface, $function); |  4318         $code .= GenerateNonStandardFunction($interface, $function); | 
|  4313         $num_callbacks++; |  4319         $num_callbacks++; | 
|  4314     } |  4320     } | 
|  4315  |  4321  | 
|  4316     die "Wrong number of callbacks generated for $interfaceName ($num_callbacks,
       should be $total_functions)" if $num_callbacks != $total_functions; |  4322     die "Wrong number of callbacks generated for $interfaceName ($num_callbacks,
       should be $total_functions)" if $num_callbacks != $total_functions; | 
|  4317  |  4323  | 
|  4318     if ($has_constants) { |  | 
|  4319         $code .= <<END; |  | 
|  4320     V8DOMConfiguration::installConstants(desc, proto, ${v8ClassName}Constants, W
      TF_ARRAY_LENGTH(${v8ClassName}Constants), isolate); |  | 
|  4321 END |  | 
|  4322     } |  | 
|  4323  |  | 
|  4324     # Special cases |  4324     # Special cases | 
|  4325     if ($interfaceName eq "Window") { |  4325     if ($interfaceName eq "Window") { | 
|  4326         $code .= <<END; |  4326         $code .= <<END; | 
|  4327  |  4327  | 
|  4328     proto->SetInternalFieldCount(V8Window::internalFieldCount); |  4328     proto->SetInternalFieldCount(V8Window::internalFieldCount); | 
|  4329     desc->SetHiddenPrototype(true); |  4329     desc->SetHiddenPrototype(true); | 
|  4330     instance->SetInternalFieldCount(V8Window::internalFieldCount); |  4330     instance->SetInternalFieldCount(V8Window::internalFieldCount); | 
|  4331     // Set access check callbacks, but turned off initially. |  4331     // Set access check callbacks, but turned off initially. | 
|  4332     // When a context is detached from a frame, turn on the access check. |  4332     // When a context is detached from a frame, turn on the access check. | 
|  4333     // Turning on checks also invalidates inline caches of the object. |  4333     // Turning on checks also invalidates inline caches of the object. | 
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  4422     if (@enabledPerContextFunctions) { |  4422     if (@enabledPerContextFunctions) { | 
|  4423         my $code = ""; |  4423         my $code = ""; | 
|  4424         $code .= <<END; |  4424         $code .= <<END; | 
|  4425 void ${v8ClassName}::installPerContextPrototypeProperties(v8::Handle<v8::Object>
       proto, v8::Isolate* isolate) |  4425 void ${v8ClassName}::installPerContextPrototypeProperties(v8::Handle<v8::Object>
       proto, v8::Isolate* isolate) | 
|  4426 { |  4426 { | 
|  4427     UNUSED_PARAM(proto); |  4427     UNUSED_PARAM(proto); | 
|  4428 END |  4428 END | 
|  4429         # Setup the enable-by-settings functions if we have them |  4429         # Setup the enable-by-settings functions if we have them | 
|  4430         $code .=  <<END; |  4430         $code .=  <<END; | 
|  4431     v8::Local<v8::Signature> defaultSignature = v8::Signature::New(GetTemplate(i
      solate, worldType(isolate))); |  4431     v8::Local<v8::Signature> defaultSignature = v8::Signature::New(GetTemplate(i
      solate, worldType(isolate))); | 
|  4432     UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. |  4432     UNUSED_PARAM(defaultSignature); | 
|  4433  |  4433  | 
|  4434     ScriptExecutionContext* context = toScriptExecutionContext(proto->CreationCo
      ntext()); |  4434     ScriptExecutionContext* context = toScriptExecutionContext(proto->CreationCo
      ntext()); | 
|  4435 END |  4435 END | 
|  4436  |  4436  | 
|  4437         foreach my $runtimeFunc (@enabledPerContextFunctions) { |  4437         foreach my $runtimeFunc (@enabledPerContextFunctions) { | 
|  4438             my $enableFunction = GetContextEnableFunction($runtimeFunc); |  4438             my $enableFunction = GetContextEnableFunction($runtimeFunc); | 
|  4439             my $functionLength = GetFunctionLength($runtimeFunc); |  4439             my $functionLength = GetFunctionLength($runtimeFunc); | 
|  4440             my $conditionalString = GenerateConditionalString($runtimeFunc); |  4440             my $conditionalString = GenerateConditionalString($runtimeFunc); | 
|  4441             $code .= "\n#if ${conditionalString}\n" if $conditionalString; |  4441             $code .= "\n#if ${conditionalString}\n" if $conditionalString; | 
|  4442             $code .= "    if (context && context->isDocument() && ${enableFuncti
      on}(toDocument(context)))\n"; |  4442             $code .= "    if (context && context->isDocument() && ${enableFuncti
      on}(toDocument(context)))\n"; | 
| (...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5974             my $conditionalString = GenerateConditionalString($constant); |  5974             my $conditionalString = GenerateConditionalString($constant); | 
|  5975             push(@checks, "#if ${conditionalString}\n") if $conditionalString; |  5975             push(@checks, "#if ${conditionalString}\n") if $conditionalString; | 
|  5976  |  5976  | 
|  5977             if ($constant->extendedAttributes->{"ImplementedBy"}) { |  5977             if ($constant->extendedAttributes->{"ImplementedBy"}) { | 
|  5978                 my $implementedByImplName = GetImplNameFromImplementedBy($consta
      nt->extendedAttributes->{"ImplementedBy"}); |  5978                 my $implementedByImplName = GetImplNameFromImplementedBy($consta
      nt->extendedAttributes->{"ImplementedBy"}); | 
|  5979                 push(@checks, "COMPILE_ASSERT($value == " . $implementedByImplNa
      me . "::$name, ${implClassName}Enum${name}IsWrongUseDoNotCheckConstants);\n"); |  5979                 push(@checks, "COMPILE_ASSERT($value == " . $implementedByImplNa
      me . "::$name, ${implClassName}Enum${name}IsWrongUseDoNotCheckConstants);\n"); | 
|  5980             } else { |  5980             } else { | 
|  5981                 push(@checks, "COMPILE_ASSERT($value == ${implClassName}::$name,
       ${implClassName}Enum${name}IsWrongUseDoNotCheckConstants);\n"); |  5981                 push(@checks, "COMPILE_ASSERT($value == ${implClassName}::$name,
       ${implClassName}Enum${name}IsWrongUseDoNotCheckConstants);\n"); | 
|  5982             } |  5982             } | 
|  5983  |  5983  | 
|  5984             push(@checks, "#endif\n") if $conditionalString; |  5984             push(@checks, "#endif // $conditionalString\n") if $conditionalStrin
      g; | 
|  5985         } |  5985         } | 
|  5986         push(@checks, "\n"); |  5986         push(@checks, "\n"); | 
|  5987     } |  5987     } | 
|  5988     return @checks; |  5988     return @checks; | 
|  5989 } |  5989 } | 
|  5990  |  5990  | 
|  5991 sub ExtendedAttributeContains |  5991 sub ExtendedAttributeContains | 
|  5992 { |  5992 { | 
|  5993     my $callWith = shift; |  5993     my $callWith = shift; | 
|  5994     return 0 unless $callWith; |  5994     return 0 unless $callWith; | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  6028         if ($currentInterface->extendedAttributes->{$extendedAttribute}) { |  6028         if ($currentInterface->extendedAttributes->{$extendedAttribute}) { | 
|  6029             $found = 1; |  6029             $found = 1; | 
|  6030         } |  6030         } | 
|  6031         return 1 if $found; |  6031         return 1 if $found; | 
|  6032     }, 0); |  6032     }, 0); | 
|  6033  |  6033  | 
|  6034     return $found; |  6034     return $found; | 
|  6035 } |  6035 } | 
|  6036  |  6036  | 
|  6037 1; |  6037 1; | 
| OLD | NEW |