| OLD | NEW |
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {% macro attribute_getter(cpp_class, attribute) %} | 2 {% macro attribute_getter(cpp_class, attribute) %} |
| 3 static void {{static_attribute_name(attribute, 'Getter')}}(Dart_NativeArguments
args) { | 3 static void {{static_attribute_name(attribute, 'Getter')}}(Dart_NativeArguments
args) { |
| 4 {% if attribute.is_getter_raises_exception or attribute.is_call_with_execution_c
ontext %} | 4 {% if attribute.is_getter_raises_exception or attribute.is_call_with_execution_c
ontext %} |
| 5 Dart_Handle exception = nullptr; | 5 Dart_Handle exception = nullptr; |
| 6 {% endif %} | 6 {% endif %} |
| 7 { | 7 { |
| 8 {% if attribute.is_call_with_execution_context %} | 8 {% if attribute.is_call_with_execution_context %} |
| 9 ExecutionContext* context = DOMDartState::CurrentDocument(); | 9 ExecutionContext* context = DOMDartState::CurrentDocument(); |
| 10 if (!context) { | 10 if (!context) { |
| 11 exception = Dart_NewStringFromCString("Failed to retrieve a context"); | 11 exception = ToDart("Failed to retrieve a context"); |
| 12 goto fail; | 12 goto fail; |
| 13 } | 13 } |
| 14 {% endif %} | 14 {% endif %} |
| 15 {% if attribute.is_call_with_script_state %} | 15 {% if attribute.is_call_with_script_state %} |
| 16 DartState* dart_state = DartState::Current(); | 16 DartState* dart_state = DartState::Current(); |
| 17 DCHECK(state); | 17 DCHECK(state); |
| 18 {% endif %} | 18 {% endif %} |
| 19 {% if attribute.dart_set_return_value and not attribute.is_static %} | 19 {% if attribute.dart_set_return_value and not attribute.is_static %} |
| 20 {{cpp_class}}* receiver = GetReceiver<{{cpp_class}}>(args); | 20 {{cpp_class}}* receiver = GetReceiver<{{cpp_class}}>(args); |
| 21 {% else %} | 21 {% else %} |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 {% set attribute_name = attribute.name if not attribute.put_forwards else 'value
' %} | 88 {% set attribute_name = attribute.name if not attribute.put_forwards else 'value
' %} |
| 89 | 89 |
| 90 {{attribute.local_cpp_type}} {{attribute.setter_lvalue}} = {{attribute.d
art_value_to_local_cpp_value}}; | 90 {{attribute.local_cpp_type}} {{attribute.setter_lvalue}} = {{attribute.d
art_value_to_local_cpp_value}}; |
| 91 if (exception) | 91 if (exception) |
| 92 goto fail; | 92 goto fail; |
| 93 {% if attribute.is_call_with_execution_context or | 93 {% if attribute.is_call_with_execution_context or |
| 94 attribute.is_setter_call_with_execution_context %} | 94 attribute.is_setter_call_with_execution_context %} |
| 95 | 95 |
| 96 ExecutionContext* context = DOMDartState::CurrentDocument(); | 96 ExecutionContext* context = DOMDartState::CurrentDocument(); |
| 97 if (!context) { | 97 if (!context) { |
| 98 exception = Dart_NewStringFromCString("Failed to retrieve a context"
); | 98 exception = ToDart("Failed to retrieve a context"); |
| 99 goto fail; | 99 goto fail; |
| 100 } | 100 } |
| 101 | 101 |
| 102 {% endif %} | 102 {% endif %} |
| 103 | 103 |
| 104 {% if attribute.is_call_with_script_state %} | 104 {% if attribute.is_call_with_script_state %} |
| 105 ScriptState* state = DartUtilities::currentScriptState(); | 105 ScriptState* state = DartUtilities::currentScriptState(); |
| 106 if (!state) { | 106 if (!state) { |
| 107 exception = Dart_NewStringFromCString("Failed to retrieve a script s
tate"); | 107 exception = ToDart("Failed to retrieve a script state"); |
| 108 goto fail; | 108 goto fail; |
| 109 } | 109 } |
| 110 {% endif %} | 110 {% endif %} |
| 111 {% if attribute.is_setter_raises_exception %} | 111 {% if attribute.is_setter_raises_exception %} |
| 112 ExceptionState es; | 112 ExceptionState es; |
| 113 {% endif %} | 113 {% endif %} |
| 114 {{attribute.cpp_setter}}; | 114 {{attribute.cpp_setter}}; |
| 115 {% if attribute.is_setter_raises_exception %} | 115 {% if attribute.is_setter_raises_exception %} |
| 116 if (es.had_exception()) { | 116 if (es.had_exception()) { |
| 117 exception = es.GetDartException(args, {{attribute.auto_scope}}); | 117 exception = es.GetDartException(args, {{attribute.auto_scope}}); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 {% macro generate_attribute_symbolizer_body(dart_class, class_name, attribute) %
} | 195 {% macro generate_attribute_symbolizer_body(dart_class, class_name, attribute) %
} |
| 196 if (native_function == {{dart_class}}Internal::{{static_attribute_name(attribute
, 'Getter')}}) { | 196 if (native_function == {{dart_class}}Internal::{{static_attribute_name(attribute
, 'Getter')}}) { |
| 197 return reinterpret_cast<const uint8_t*>("{{attribute.native_entry_getter.res
olver_string}}"); | 197 return reinterpret_cast<const uint8_t*>("{{attribute.native_entry_getter.res
olver_string}}"); |
| 198 } | 198 } |
| 199 {% if not attribute.is_read_only %} | 199 {% if not attribute.is_read_only %} |
| 200 if (native_function == {{dart_class}}Internal::{{static_attribute_name(attribute
, 'Setter')}}) { | 200 if (native_function == {{dart_class}}Internal::{{static_attribute_name(attribute
, 'Setter')}}) { |
| 201 return reinterpret_cast<const uint8_t*>("{{attribute.native_entry_setter.res
olver_string}}"); | 201 return reinterpret_cast<const uint8_t*>("{{attribute.native_entry_setter.res
olver_string}}"); |
| 202 } | 202 } |
| 203 {% endif %} | 203 {% endif %} |
| 204 {% endmacro %} | 204 {% endmacro %} |
| OLD | NEW |