| OLD | NEW |
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {# FIXME: We should return a rejected Promise if an error occurs in this | 2 {# FIXME: We should return a rejected Promise if an error occurs in this |
| 3 function when ALL methods in this overload return Promise. In order to do so, | 3 function when ALL methods in this overload return Promise. In order to do so, |
| 4 we must ensure either ALL or NO methods in this overload return Promise #} | 4 we must ensure either ALL or NO methods in this overload return Promise #} |
| 5 {% macro overload_resolution_method(method) %} | 5 {% macro overload_resolution_method(method) %} |
| 6 {% set overloads = method.overloads %} | 6 {% set overloads = method.overloads %} |
| 7 {% if method.is_static %} | 7 {% if method.is_static %} |
| 8 {% set offset = 0 %} | 8 {% set offset = 0 %} |
| 9 {% else %} | 9 {% else %} |
| 10 {% set offset = 1 %} | 10 {% set offset = 1 %} |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 method.has_exception_state or | 87 method.has_exception_state or |
| 88 method.is_call_with_script_state or | 88 method.is_call_with_script_state or |
| 89 method.is_call_with_execution_context or | 89 method.is_call_with_execution_context or |
| 90 method.is_call_with_script_arguments %} | 90 method.is_call_with_script_arguments %} |
| 91 Dart_Handle exception = nullptr; | 91 Dart_Handle exception = nullptr; |
| 92 {% endif %} | 92 {% endif %} |
| 93 { | 93 { |
| 94 {% if method.is_call_with_script_state %} | 94 {% if method.is_call_with_script_state %} |
| 95 ScriptState* state = DartUtilities::currentScriptState(); | 95 ScriptState* state = DartUtilities::currentScriptState(); |
| 96 if (!state) { | 96 if (!state) { |
| 97 exception = Dart_NewStringFromCString("Failed to retrieve a script s
tate"); | 97 exception = ToDart("Failed to retrieve a script state"); |
| 98 goto fail; | 98 goto fail; |
| 99 } | 99 } |
| 100 {% endif %} | 100 {% endif %} |
| 101 {% if method.is_call_with_execution_context %} | 101 {% if method.is_call_with_execution_context %} |
| 102 ExecutionContext* context = DOMDartState::CurrentDocument(); | 102 ExecutionContext* context = DOMDartState::CurrentDocument(); |
| 103 if (!context) { | 103 if (!context) { |
| 104 exception = Dart_NewStringFromCString("Failed to retrieve a context"
); | 104 exception = ToDart("Failed to retrieve a context"); |
| 105 goto fail; | 105 goto fail; |
| 106 } | 106 } |
| 107 {% endif %} | 107 {% endif %} |
| 108 {% if method.is_call_with_script_arguments %} | 108 {% if method.is_call_with_script_arguments %} |
| 109 {# Last parameter is the customArgument #} | 109 {# Last parameter is the customArgument #} |
| 110 Dart_Handle customArgument = Dart_GetNativeArgument(args, Dart_GetNative
ArgumentCount(args) - 1); | 110 Dart_Handle customArgument = Dart_GetNativeArgument(args, Dart_GetNative
ArgumentCount(args) - 1); |
| 111 RefPtr<ScriptArguments> scriptArguments(DartUtilities::createScriptArgum
ents(customArgument, exception)); | 111 RefPtr<ScriptArguments> scriptArguments(DartUtilities::createScriptArgum
ents(customArgument, exception)); |
| 112 if (!scriptArguments) | 112 if (!scriptArguments) |
| 113 goto fail; | 113 goto fail; |
| 114 {% endif %} | 114 {% endif %} |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 constructor.has_exception_state or | 311 constructor.has_exception_state or |
| 312 is_constructor_call_with_execution_context or | 312 is_constructor_call_with_execution_context or |
| 313 is_constructor_call_with_document or | 313 is_constructor_call_with_document or |
| 314 (constructor == named_constructor) %} | 314 (constructor == named_constructor) %} |
| 315 Dart_Handle exception = nullptr; | 315 Dart_Handle exception = nullptr; |
| 316 {% endif %} | 316 {% endif %} |
| 317 { | 317 { |
| 318 {% if is_constructor_call_with_execution_context %} | 318 {% if is_constructor_call_with_execution_context %} |
| 319 ExecutionContext* context = DOMDartState::CurrentDocument(); | 319 ExecutionContext* context = DOMDartState::CurrentDocument(); |
| 320 if (!context) { | 320 if (!context) { |
| 321 exception = Dart_NewStringFromCString("Failed to retrieve a context"
); | 321 exception = ToDart("Failed to retrieve a context"); |
| 322 goto fail; | 322 goto fail; |
| 323 } | 323 } |
| 324 {% endif %} | 324 {% endif %} |
| 325 {% if is_constructor_call_with_document or (constructor == named_constructor) %} | 325 {% if is_constructor_call_with_document or (constructor == named_constructor) %} |
| 326 LocalDOMWindow* domWindow = DOMDartState::CurrentWindow(); | 326 LocalDOMWindow* domWindow = DOMDartState::CurrentWindow(); |
| 327 if (!domWindow) { | 327 if (!domWindow) { |
| 328 exception = Dart_NewStringFromCString("Failed to fetch domWindow"); | 328 exception = ToDart("Failed to fetch domWindow"); |
| 329 goto fail; | 329 goto fail; |
| 330 } | 330 } |
| 331 Document& document = *domWindow->document(); | 331 Document& document = *domWindow->document(); |
| 332 {% endif %} | 332 {% endif %} |
| 333 int argCount /* FIXME(vsm): Remove this. */ ALLOW_UNUSED = Dart_GetNativ
eArgumentCount(args); | 333 int argCount /* FIXME(vsm): Remove this. */ ALLOW_UNUSED = Dart_GetNativ
eArgumentCount(args); |
| 334 {% if constructor.has_exception_state %} | 334 {% if constructor.has_exception_state %} |
| 335 ExceptionState es; | 335 ExceptionState es; |
| 336 {% endif %} | 336 {% endif %} |
| 337 {{generate_arguments(constructor) | indent(8)}} | 337 {{generate_arguments(constructor) | indent(8)}} |
| 338 {{callback_return(constructor, constructor.dart_set_return_value, constr
uctor.cpp_value) | indent(8)}} | 338 {{callback_return(constructor, constructor.dart_set_return_value, constr
uctor.cpp_value) | indent(8)}} |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 397 |
| 398 {##############################################################################} | 398 {##############################################################################} |
| 399 {% macro generate_symbolizer_constructor(dart_class, class_name, constructor) %} | 399 {% macro generate_symbolizer_constructor(dart_class, class_name, constructor) %} |
| 400 {% for native_entry in constructor.native_entries %} | 400 {% for native_entry in constructor.native_entries %} |
| 401 {% set resolver_string = native_entry.resolver_string %} | 401 {% set resolver_string = native_entry.resolver_string %} |
| 402 if (native_function == {{dart_class}}Internal::{{static_method_name(constructor.
name, constructor.overload_index)}}) { | 402 if (native_function == {{dart_class}}Internal::{{static_method_name(constructor.
name, constructor.overload_index)}}) { |
| 403 return reinterpret_cast<const uint8_t*>("{{resolver_string}}"); | 403 return reinterpret_cast<const uint8_t*>("{{resolver_string}}"); |
| 404 } | 404 } |
| 405 {% endfor %} | 405 {% endfor %} |
| 406 {% endmacro %} | 406 {% endmacro %} |
| OLD | NEW |