OLD | NEW |
1 {##############################################################################} | 1 {##############################################################################} |
2 {% macro attribute_getter(attribute, world_suffix) %} | 2 {% macro attribute_getter(attribute, world_suffix) %} |
3 {% filter conditional(attribute.conditional_string) %} | 3 {% filter conditional(attribute.conditional_string) %} |
4 static void {{attribute.name}}AttributeGetter{{world_suffix}}( | 4 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
5 {%- if attribute.is_expose_js_accessors %} | 5 {%- if attribute.is_expose_js_accessors %} |
6 const v8::FunctionCallbackInfo<v8::Value>& info | 6 const v8::FunctionCallbackInfo<v8::Value>& info |
7 {%- else %} | 7 {%- else %} |
8 const v8::PropertyCallbackInfo<v8::Value>& info | 8 const v8::PropertyCallbackInfo<v8::Value>& info |
9 {%- endif %}) | 9 {%- endif %}) |
10 { | 10 { |
(...skipping 30 matching lines...) Expand all Loading... |
41 {% if attribute.is_call_with_script_state %} | 41 {% if attribute.is_call_with_script_state %} |
42 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | 42 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
43 {% endif %} | 43 {% endif %} |
44 {% if attribute.is_check_security_for_node or | 44 {% if attribute.is_check_security_for_node or |
45 attribute.is_getter_raises_exception %} | 45 attribute.is_getter_raises_exception %} |
46 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{interface_name}}", holder, info.GetIsolate()); | 46 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{interface_name}}", holder, info.GetIsolate()); |
47 {% endif %} | 47 {% endif %} |
48 {% if attribute.is_nullable and not attribute.has_type_checking_nullable %} | 48 {% if attribute.is_nullable and not attribute.has_type_checking_nullable %} |
49 bool isNull = false; | 49 bool isNull = false; |
50 {% endif %} | 50 {% endif %} |
51 {# FIXME: consider always using a local variable for value #} | 51 {% if attribute.cpp_value_original %} |
52 {% if attribute.cached_attribute_validation_method or | 52 {{attribute.cpp_type}} {{attribute.cpp_value}}({{attribute.cpp_value_origina
l}}); |
53 attribute.is_getter_raises_exception or | |
54 attribute.is_nullable or | |
55 attribute.reflect_only or | |
56 attribute.idl_type == 'EventHandler' %} | |
57 {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_origi
nal}}; | |
58 {% endif %} | 53 {% endif %} |
59 {# Checks #} | 54 {# Checks #} |
60 {% if attribute.is_getter_raises_exception %} | 55 {% if attribute.is_getter_raises_exception %} |
61 if (UNLIKELY(exceptionState.throwIfNeeded())) | 56 if (UNLIKELY(exceptionState.throwIfNeeded())) |
62 return; | 57 return; |
63 {% endif %} | 58 {% endif %} |
64 {% if attribute.is_check_security_for_node %} | 59 {% if attribute.is_check_security_for_node %} |
65 {# FIXME: use a local variable to not call getter twice #} | 60 {# FIXME: use a local variable to not call getter twice #} |
66 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), {{attribute
.cpp_value}}, exceptionState)) { | 61 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), {{attribute
.cpp_value}}, exceptionState)) { |
67 v8SetReturnValueNull(info); | 62 v8SetReturnValueNull(info); |
(...skipping 14 matching lines...) Expand all Loading... |
82 {% endif %} | 77 {% endif %} |
83 v8SetReturnValueNull(info); | 78 v8SetReturnValueNull(info); |
84 return; | 79 return; |
85 } | 80 } |
86 {% endif %} | 81 {% endif %} |
87 {% if attribute.cached_attribute_validation_method %} | 82 {% if attribute.cached_attribute_validation_method %} |
88 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, propertyName, {{att
ribute.cpp_value_to_v8_value}}); | 83 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, propertyName, {{att
ribute.cpp_value_to_v8_value}}); |
89 {% endif %} | 84 {% endif %} |
90 {# v8SetReturnValue #} | 85 {# v8SetReturnValue #} |
91 {% if attribute.is_keep_alive_for_gc %} | 86 {% if attribute.is_keep_alive_for_gc %} |
92 {# FIXME: merge local variable assignment with above #} | 87 if ({{attribute.cpp_value}} && DOMDataStore::setReturnValueFromWrapper{{worl
d_suffix}}<{{attribute.v8_type}}>(info.GetReturnValue(), {{attribute.cpp_value}}
.get())) |
93 {{attribute.cpp_type}} result({{attribute.cpp_value}}); | |
94 if (result && DOMDataStore::setReturnValueFromWrapper{{world_suffix}}<{{attr
ibute.v8_type}}>(info.GetReturnValue(), result.get())) | |
95 return; | 88 return; |
96 v8::Handle<v8::Value> wrapper = toV8(result.get(), holder, info.GetIsolate()
); | 89 v8::Handle<v8::Value> wrapper = toV8({{attribute.cpp_value}}.get(), holder,
info.GetIsolate()); |
97 if (!wrapper.IsEmpty()) { | 90 if (!wrapper.IsEmpty()) { |
98 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(
info.GetIsolate(), "{{attribute.name}}"), wrapper); | 91 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(
info.GetIsolate(), "{{attribute.name}}"), wrapper); |
99 {{attribute.v8_set_return_value}}; | 92 {{attribute.v8_set_return_value}}; |
100 } | 93 } |
101 {% elif world_suffix %} | 94 {% elif world_suffix %} |
102 {{attribute.v8_set_return_value_for_main_world}}; | 95 {{attribute.v8_set_return_value_for_main_world}}; |
103 {% else %} | 96 {% else %} |
104 {{attribute.v8_set_return_value}}; | 97 {{attribute.v8_set_return_value}}; |
105 {% endif %} | 98 {% endif %} |
106 } | 99 } |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 {% endif %} | 331 {% endif %} |
339 {% if attribute.has_custom_setter %} | 332 {% if attribute.has_custom_setter %} |
340 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info); | 333 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info); |
341 {% else %} | 334 {% else %} |
342 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v
8Value, info); | 335 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v
8Value, info); |
343 {% endif %} | 336 {% endif %} |
344 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 337 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
345 } | 338 } |
346 {% endfilter %} | 339 {% endfilter %} |
347 {% endmacro %} | 340 {% endmacro %} |
OLD | NEW |