Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {% macro generate_method(method, world_suffix) %} | 2 {% macro generate_method(method, world_suffix) %} |
| 3 {% filter conditional(method.conditional_string) %} | 3 {% filter conditional(method.conditional_string) %} |
| 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) | 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 5 { | 5 { |
| 6 {# Local variables #} | 6 {# Local variables #} |
| 7 {% if method.has_exception_state %} | 7 {% if method.has_exception_state %} |
| 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 9 {% endif %} | 9 {% endif %} |
| 10 {# Overloaded methods have length checked during overload resolution #} | 10 {# Overloaded methods have length checked during overload resolution #} |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 {% else %} | 413 {% else %} |
| 414 {{cpp_class}}V8Internal::{{method.name}}Method{{world_suffix}}(info); | 414 {{cpp_class}}V8Internal::{{method.name}}Method{{world_suffix}}(info); |
| 415 {% endif %} | 415 {% endif %} |
| 416 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 416 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
| 417 } | 417 } |
| 418 {% endfilter %} | 418 {% endfilter %} |
| 419 {% endmacro %} | 419 {% endmacro %} |
| 420 | 420 |
| 421 | 421 |
| 422 {##############################################################################} | 422 {##############################################################################} |
| 423 {% macro method_length(method) %} | |
|
Nils Barth (inactive)
2014/06/04 07:22:02
Could you put this in Python instead, as it's logi
Nils Barth (inactive)
2014/06/04 07:30:50
Also, could you quote the spec?
The value of the
Jens Widell
2014/06/04 11:12:54
Done. Although not quite as suggested I think, sin
Nils Barth (inactive)
2014/06/05 00:26:22
=P good point that...
| |
| 424 {% if method.overloads %} | |
| 425 {{method.overloads.minarg}} | |
| 426 {%- else %} | |
| 427 {{method.number_of_required_arguments}} | |
| 428 {%- endif %} | |
| 429 {% endmacro %} | |
| 430 | |
| 431 | |
| 432 {##############################################################################} | |
| 423 {% macro origin_safe_method_getter(method, world_suffix) %} | 433 {% macro origin_safe_method_getter(method, world_suffix) %} |
| 424 static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop ertyCallbackInfo<v8::Value>& info) | 434 static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop ertyCallbackInfo<v8::Value>& info) |
| 425 { | 435 { |
| 426 {% set signature = 'v8::Local<v8::Signature>()' | 436 {% set signature = 'v8::Local<v8::Signature>()' |
| 427 if method.is_do_not_check_signature else | 437 if method.is_do_not_check_signature else |
| 428 'v8::Signature::New(isolate, %s::domTemplate(isolate))' % v8_class %} | 438 'v8::Signature::New(isolate, %s::domTemplate(isolate))' % v8_class %} |
| 429 v8::Isolate* isolate = info.GetIsolate(); | 439 v8::Isolate* isolate = info.GetIsolate(); |
| 430 static int domTemplateKey; // This address is used for a key to look up the dom template. | 440 static int domTemplateKey; // This address is used for a key to look up the dom template. |
| 431 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 441 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 432 {# FIXME: 1 case of [DoNotCheckSignature] in Window.idl may differ #} | 442 {# FIXME: 1 case of [DoNotCheckSignature] in Window.idl may differ #} |
| 433 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTem plateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_suffix}} , v8Undefined(), {{signature}}, {{method.number_of_required_or_variadic_argument s}}); | 443 v8::Handle<v8::FunctionTemplate> privateTemplate = data->domTemplate(&domTem plateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_suffix}} , v8Undefined(), {{signature}}, {{method_length(method)}}); |
| 434 | 444 |
| 435 v8::Handle<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(i nfo.This(), isolate); | 445 v8::Handle<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(i nfo.This(), isolate); |
| 436 if (holder.IsEmpty()) { | 446 if (holder.IsEmpty()) { |
| 437 // This is only reachable via |object.__proto__.func|, in which case it | 447 // This is only reachable via |object.__proto__.func|, in which case it |
| 438 // has already passed the same origin security check | 448 // has already passed the same origin security check |
| 439 v8SetReturnValue(info, privateTemplate->GetFunction()); | 449 v8SetReturnValue(info, privateTemplate->GetFunction()); |
| 440 return; | 450 return; |
| 441 } | 451 } |
| 442 {{cpp_class}}* impl = {{v8_class}}::toNative(holder); | 452 {{cpp_class}}* impl = {{v8_class}}::toNative(holder); |
| 443 if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), DoNot ReportSecurityError)) { | 453 if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), DoNot ReportSecurityError)) { |
| 444 static int sharedTemplateKey; // This address is used for a key to look up the dom template. | 454 static int sharedTemplateKey; // This address is used for a key to look up the dom template. |
| 445 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sha redTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_su ffix}}, v8Undefined(), {{signature}}, {{method.number_of_required_or_variadic_ar guments}}); | 455 v8::Handle<v8::FunctionTemplate> sharedTemplate = data->domTemplate(&sha redTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_su ffix}}, v8Undefined(), {{signature}}, {{method_length(method)}}); |
| 446 v8SetReturnValue(info, sharedTemplate->GetFunction()); | 456 v8SetReturnValue(info, sharedTemplate->GetFunction()); |
| 447 return; | 457 return; |
| 448 } | 458 } |
| 449 | 459 |
| 450 {# The findInstanceInPrototypeChain() call above only returns a non-empty ha ndle if info.This() is an Object. #} | 460 {# The findInstanceInPrototypeChain() call above only returns a non-empty ha ndle if info.This() is an Object. #} |
| 451 v8::Local<v8::Value> hiddenValue = v8::Handle<v8::Object>::Cast(info.This()) ->GetHiddenValue(v8AtomicString(isolate, "{{method.name}}")); | 461 v8::Local<v8::Value> hiddenValue = v8::Handle<v8::Object>::Cast(info.This()) ->GetHiddenValue(v8AtomicString(isolate, "{{method.name}}")); |
| 452 if (!hiddenValue.IsEmpty()) { | 462 if (!hiddenValue.IsEmpty()) { |
| 453 v8SetReturnValue(info, hiddenValue); | 463 v8SetReturnValue(info, hiddenValue); |
| 454 return; | 464 return; |
| 455 } | 465 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 553 {% endif %} | 563 {% endif %} |
| 554 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons tructor.argument_list | join(', ')}}); | 564 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons tructor.argument_list | join(', ')}}); |
| 555 {% if is_constructor_raises_exception %} | 565 {% if is_constructor_raises_exception %} |
| 556 if (exceptionState.throwIfNeeded()) | 566 if (exceptionState.throwIfNeeded()) |
| 557 return; | 567 return; |
| 558 {% endif %} | 568 {% endif %} |
| 559 | 569 |
| 560 {{generate_constructor_wrapper(constructor) | indent}} | 570 {{generate_constructor_wrapper(constructor) | indent}} |
| 561 } | 571 } |
| 562 {% endmacro %} | 572 {% endmacro %} |
| OLD | NEW |