Chromium Code Reviews| 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 {# FIXME: consider always using a local variable for value #} |
|
bashi
2014/06/27 06:20:31
BTW, what's your take on this comment? There is a
Jens Widell
2014/06/27 06:31:23
If we keep the use of a local optional, then we co
haraken
2014/06/27 06:35:09
You can run Dromaeo to see performance (http://dro
| |
| 52 {% if attribute.cached_attribute_validation_method or | 52 {% if attribute.cached_attribute_validation_method or |
| 53 attribute.is_getter_raises_exception or | 53 attribute.is_getter_raises_exception or |
| 54 attribute.is_nullable or | 54 attribute.is_nullable or |
| 55 attribute.reflect_only or | 55 attribute.reflect_only or |
| 56 attribute.idl_type == 'EventHandler' %} | 56 attribute.idl_type == 'EventHandler' %} |
| 57 {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_origi nal}}; | 57 {{attribute.cpp_type}} {{attribute.cpp_value}} = {{attribute.cpp_value_origi nal}}; |
| 58 {% endif %} | 58 {% endif %} |
| 59 {# Checks #} | 59 {# Checks #} |
| 60 {% if attribute.is_getter_raises_exception %} | 60 {% if attribute.is_getter_raises_exception %} |
| 61 if (UNLIKELY(exceptionState.throwIfNeeded())) | 61 if (UNLIKELY(exceptionState.throwIfNeeded())) |
| 62 return; | 62 return; |
| 63 {% endif %} | 63 {% endif %} |
| 64 {% if attribute.is_check_security_for_node %} | 64 {% if attribute.is_check_security_for_node %} |
| 65 {# FIXME: use a local variable to not call getter twice #} | |
| 66 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), {{attribute .cpp_value}}, exceptionState)) { | 65 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), {{attribute .cpp_value}}, exceptionState)) { |
| 67 v8SetReturnValueNull(info); | 66 v8SetReturnValueNull(info); |
| 68 exceptionState.throwIfNeeded(); | 67 exceptionState.throwIfNeeded(); |
| 69 return; | 68 return; |
| 70 } | 69 } |
| 71 {% endif %} | 70 {% endif %} |
| 72 {% if attribute.reflect_only %} | 71 {% if attribute.reflect_only %} |
| 73 {{release_only_check(attribute.reflect_only, attribute.reflect_missing, | 72 {{release_only_check(attribute.reflect_only, attribute.reflect_missing, |
| 74 attribute.reflect_invalid, attribute.reflect_empty) | 73 attribute.reflect_invalid, attribute.reflect_empty) |
| 75 | indent}} | 74 | indent}} |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 {% endif %} | 337 {% endif %} |
| 339 {% if attribute.has_custom_setter %} | 338 {% if attribute.has_custom_setter %} |
| 340 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info); | 339 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info); |
| 341 {% else %} | 340 {% else %} |
| 342 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v 8Value, info); | 341 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v 8Value, info); |
| 343 {% endif %} | 342 {% endif %} |
| 344 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 343 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 345 } | 344 } |
| 346 {% endfilter %} | 345 {% endfilter %} |
| 347 {% endmacro %} | 346 {% endmacro %} |
| OLD | NEW |