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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 430 return; | 430 return; |
| 431 } | 431 } |
| 432 {# No match, throw error #} | 432 {# No match, throw error #} |
| 433 exceptionState.throwTypeError("No function was found that matched the signat ure provided."); | 433 exceptionState.throwTypeError("No function was found that matched the signat ure provided."); |
| 434 exceptionState.throwIfNeeded(); | 434 exceptionState.throwIfNeeded(); |
| 435 } | 435 } |
| 436 {% endmacro %} | 436 {% endmacro %} |
| 437 | 437 |
| 438 | 438 |
| 439 {##############################################################################} | 439 {##############################################################################} |
| 440 {% macro method_callback(method, world_suffix) %} | 440 {% macro method_callback(method, world_suffix, internal_namespace=None) %} |
| 441 {% filter conditional(method.conditional_string) %} | 441 {% filter conditional(method.conditional_string) %} |
| 442 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall backInfo<v8::Value>& info) | 442 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall backInfo<v8::Value>& info) |
| 443 { | 443 { |
| 444 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); | 444 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); |
| 445 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #} | 445 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #} |
| 446 {% if method.measure_as %} | 446 {% if method.measure_as %} |
| 447 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::{{ method.measure_as}}); | 447 UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::{{ method.measure_as}}); |
| 448 {% endif %} | 448 {% endif %} |
| 449 {% if method.deprecate_as %} | 449 {% if method.deprecate_as %} |
| 450 UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), Use Counter::{{method.deprecate_as}}); | 450 UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), Use Counter::{{method.deprecate_as}}); |
| 451 {% endif %} | 451 {% endif %} |
| 452 {% endif %}{# not method.overloads #} | 452 {% endif %}{# not method.overloads #} |
| 453 {% if world_suffix in method.activity_logging_world_list %} | 453 {% if world_suffix in method.activity_logging_world_list %} |
| 454 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext()); | 454 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext()); |
| 455 V8PerContextData* contextData = scriptState->perContextData(); | 455 V8PerContextData* contextData = scriptState->perContextData(); |
| 456 {% if method.activity_logging_world_check %} | 456 {% if method.activity_logging_world_check %} |
| 457 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger()) | 457 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger()) |
| 458 {% else %} | 458 {% else %} |
| 459 if (contextData && contextData->activityLogger()) { | 459 if (contextData && contextData->activityLogger()) { |
| 460 {% endif %} | 460 {% endif %} |
| 461 Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle <v8::Value> >(info, 0); | 461 Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle <v8::Value> >(info, 0); |
| 462 contextData->activityLogger()->logMethod("{{interface_name}}.{{method.na me}}", info.Length(), loggerArgs.data()); | 462 contextData->activityLogger()->logMethod("{{interface_name}}.{{method.na me}}", info.Length(), loggerArgs.data()); |
| 463 } | 463 } |
| 464 {% endif %} | 464 {% endif %} |
| 465 {% if method.is_custom %} | 465 {% if method.is_custom %} |
| 466 {{v8_class}}::{{method.name}}MethodCustom(info); | 466 {{v8_class}}::{{method.name}}MethodCustom(info); |
| 467 {% elif internal_namespace %} | |
|
Jens Widell
2014/08/21 13:08:53
You could skip this conditional if |internal_names
yhirano
2014/08/21 13:19:58
Done.
I introduced a new namespace to avoid name c
Jens Widell
2014/08/21 13:58:01
Thanks.
| |
| 468 {{cpp_class}}V8Internal::{{internal_namespace}}::{{method.name}}Method{{worl d_suffix}}(info); | |
| 467 {% else %} | 469 {% else %} |
| 468 {{cpp_class}}V8Internal::{{method.name}}Method{{world_suffix}}(info); | 470 {{cpp_class}}V8Internal::{{method.name}}Method{{world_suffix}}(info); |
| 469 {% endif %} | 471 {% endif %} |
| 470 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 472 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 471 } | 473 } |
| 472 {% endfilter %} | 474 {% endfilter %} |
| 473 {% endmacro %} | 475 {% endmacro %} |
| 474 | 476 |
| 475 | 477 |
| 476 {##############################################################################} | 478 {##############################################################################} |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 619 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate ()); | 621 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate ()); |
| 620 {% else %} | 622 {% else %} |
| 621 {% set constructor_class = v8_class + ('Constructor' | 623 {% set constructor_class = v8_class + ('Constructor' |
| 622 if constructor.is_named_constructor else | 624 if constructor.is_named_constructor else |
| 623 '') %} | 625 '') %} |
| 624 v8::Handle<v8::Object> wrapper = info.Holder(); | 626 v8::Handle<v8::Object> wrapper = info.Holder(); |
| 625 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configurat ion}}); | 627 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configurat ion}}); |
| 626 {% endif %} | 628 {% endif %} |
| 627 v8SetReturnValue(info, wrapper); | 629 v8SetReturnValue(info, wrapper); |
| 628 {% endmacro %} | 630 {% endmacro %} |
| OLD | NEW |