Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1098)

Side by Side Diff: Source/bindings/scripts/CodeGeneratorV8.pm

Issue 15556003: Auto-generate V8HTMLFormElement::namedPropertyGetter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Introduce DoNotCheckJSProperty Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/bindings/bindings.gypi ('k') | Source/bindings/scripts/IDLAttributes.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3218 matching lines...) Expand 10 before | Expand all | Expand 10 after
3229 my $returnType = $namedGetterFunction->signature->type; 3229 my $returnType = $namedGetterFunction->signature->type;
3230 my $isNull = GenerateIsNullExpression($returnType, "element"); 3230 my $isNull = GenerateIsNullExpression($returnType, "element");
3231 my $nativeValue = "element"; 3231 my $nativeValue = "element";
3232 $nativeValue .= ".release()" if (IsRefPtrType($returnType)); 3232 $nativeValue .= ".release()" if (IsRefPtrType($returnType));
3233 my $returnJSValueCode = NativeToJSValue($namedGetterFunction->signature->typ e, $namedGetterFunction->signature->extendedAttributes, $nativeValue, " ", "r eturn", "info.Holder()", "info.GetIsolate()", "info", "collection"); 3233 my $returnJSValueCode = NativeToJSValue($namedGetterFunction->signature->typ e, $namedGetterFunction->signature->extendedAttributes, $nativeValue, " ", "r eturn", "info.Holder()", "info.GetIsolate()", "info", "collection");
3234 my $raisesExceptions = $namedGetterFunction->signature->extendedAttributes-> {"RaisesException"}; 3234 my $raisesExceptions = $namedGetterFunction->signature->extendedAttributes-> {"RaisesException"};
3235 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection- >${methodName}", "propertyName", $raisesExceptions); 3235 my $methodCallCode = GenerateMethodCall($returnType, "element", "collection- >${methodName}", "propertyName", $raisesExceptions);
3236 3236
3237 my $code = "v8::Handle<v8::Value> ${v8ClassName}::namedPropertyGetter(v8::Lo cal<v8::String> name, const v8::AccessorInfo& info)\n"; 3237 my $code = "v8::Handle<v8::Value> ${v8ClassName}::namedPropertyGetter(v8::Lo cal<v8::String> name, const v8::AccessorInfo& info)\n";
3238 $code .= "{\n"; 3238 $code .= "{\n";
3239 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name) .IsEmpty())\n"; 3239 if (!$namedGetterFunction->signature->extendedAttributes->{"DoNotCheckJSProp erty"}) {
3240 $code .= " return v8Undefined();\n"; 3240 $code .= " if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(n ame).IsEmpty())\n";
3241 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n"; 3241 $code .= " return v8Undefined();\n";
3242 $code .= " return v8Undefined();\n"; 3242 $code .= " if (info.Holder()->HasRealNamedCallbackProperty(name))\n";
3243 $code .= " return v8Undefined();\n";
3244 }
3243 $code .= "\n"; 3245 $code .= "\n";
3244 $code .= " ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));\n"; 3246 $code .= " ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder()));\n";
3245 $code .= " ${implClassName}* collection = toNative(info.Holder());\n"; 3247 $code .= " ${implClassName}* collection = toNative(info.Holder());\n";
3246 $code .= " AtomicString propertyName = toWebCoreAtomicString(name);\n"; 3248 $code .= " AtomicString propertyName = toWebCoreAtomicString(name);\n";
3247 if ($raisesExceptions) { 3249 if ($raisesExceptions) {
3248 $code .= " ExceptionCode ec = 0;\n"; 3250 $code .= " ExceptionCode ec = 0;\n";
3249 } 3251 }
3250 $code .= $methodCallCode . "\n"; 3252 $code .= $methodCallCode . "\n";
3251 if ($raisesExceptions) { 3253 if ($raisesExceptions) {
3252 $code .= " if (ec)\n"; 3254 $code .= " if (ec)\n";
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
3427 ASSERT(impl); 3429 ASSERT(impl);
3428 v8::Handle<v8::Object> wrapper = ${v8ClassName}::createWrapper(impl, creatio nContext, isolate); 3430 v8::Handle<v8::Object> wrapper = ${v8ClassName}::createWrapper(impl, creatio nContext, isolate);
3429 if (!wrapper.IsEmpty()) 3431 if (!wrapper.IsEmpty())
3430 wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), $v iewType, impl->length()); 3432 wrapper->SetIndexedPropertiesToExternalArrayData(impl->baseAddress(), $v iewType, impl->length());
3431 return wrapper; 3433 return wrapper;
3432 } 3434 }
3433 3435
3434 END 3436 END
3435 } 3437 }
3436 3438
3437 my $indexer;
3438 my @enabledPerContextFunctions; 3439 my @enabledPerContextFunctions;
3439 my @normalFunctions; 3440 my @normalFunctions;
3440 my $needsDomainSafeFunctionSetter = 0; 3441 my $needsDomainSafeFunctionSetter = 0;
3441 # Generate methods for functions. 3442 # Generate methods for functions.
3442 foreach my $function (@{$interface->functions}) { 3443 foreach my $function (@{$interface->functions}) {
3444 next if $function->signature->name eq "";
3443 GenerateFunction($function, $interface, ""); 3445 GenerateFunction($function, $interface, "");
3444 if ($function->signature->extendedAttributes->{"PerWorldBindings"}) { 3446 if ($function->signature->extendedAttributes->{"PerWorldBindings"}) {
3445 GenerateFunction($function, $interface, "ForMainWorld"); 3447 GenerateFunction($function, $interface, "ForMainWorld");
3446 } 3448 }
3447 if ($function->{overloadIndex} == @{$function->{overloads}}) { 3449 if ($function->{overloadIndex} == @{$function->{overloads}}) {
3448 if ($function->{overloadIndex} > 1) { 3450 if ($function->{overloadIndex} > 1) {
3449 GenerateOverloadedFunction($function, $interface, ""); 3451 GenerateOverloadedFunction($function, $interface, "");
3450 if ($function->signature->extendedAttributes->{"PerWorldBindings "}) { 3452 if ($function->signature->extendedAttributes->{"PerWorldBindings "}) {
3451 GenerateOverloadedFunction($function, $interface, "ForMainWo rld"); 3453 GenerateOverloadedFunction($function, $interface, "ForMainWo rld");
3452 } 3454 }
3453 } 3455 }
3454 GenerateFunctionCallback($function, $interface, ""); 3456 GenerateFunctionCallback($function, $interface, "");
3455 if ($function->signature->extendedAttributes->{"PerWorldBindings"}) { 3457 if ($function->signature->extendedAttributes->{"PerWorldBindings"}) {
3456 GenerateFunctionCallback($function, $interface, "ForMainWorld"); 3458 GenerateFunctionCallback($function, $interface, "ForMainWorld");
3457 } 3459 }
3458 } 3460 }
3459 3461
3460 if ($function->signature->name eq "item") {
3461 $indexer = $function->signature;
3462 }
3463
3464 # If the function does not need domain security check, we need to 3462 # If the function does not need domain security check, we need to
3465 # generate an access getter that returns different function objects 3463 # generate an access getter that returns different function objects
3466 # for different calling context. 3464 # for different calling context.
3467 if ($interface->extendedAttributes->{"CheckSecurity"} && $function->sign ature->extendedAttributes->{"DoNotCheckSecurity"}) { 3465 if ($interface->extendedAttributes->{"CheckSecurity"} && $function->sign ature->extendedAttributes->{"DoNotCheckSecurity"}) {
3468 if (!HasCustomMethod($function->signature->extendedAttributes) || $f unction->{overloadIndex} == 1) { 3466 if (!HasCustomMethod($function->signature->extendedAttributes) || $f unction->{overloadIndex} == 1) {
3469 GenerateDomainSafeFunctionGetter($function, $interface); 3467 GenerateDomainSafeFunctionGetter($function, $interface);
3470 $needsDomainSafeFunctionSetter = 1; 3468 $needsDomainSafeFunctionSetter = 1;
3471 } 3469 }
3472 } 3470 }
3473 3471
(...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after
5398 if ($currentInterface->extendedAttributes->{$extendedAttribute}) { 5396 if ($currentInterface->extendedAttributes->{$extendedAttribute}) {
5399 $found = 1; 5397 $found = 1;
5400 } 5398 }
5401 return 1 if $found; 5399 return 1 if $found;
5402 }, 0); 5400 }, 0);
5403 5401
5404 return $found; 5402 return $found;
5405 } 5403 }
5406 5404
5407 1; 5405 1;
OLDNEW
« no previous file with comments | « Source/bindings/bindings.gypi ('k') | Source/bindings/scripts/IDLAttributes.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698