Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: Source/bindings/templates/attributes.cpp

Issue 1012713003: IDL: Improve CG for attributes with [CachedAttribute] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 {% from 'conversions.cpp' import v8_value_to_local_cpp_value %} 1 {% from 'conversions.cpp' import v8_value_to_local_cpp_value %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro attribute_getter(attribute, world_suffix) %} 5 {% macro attribute_getter(attribute, world_suffix) %}
6 {% filter conditional(attribute.conditional_string) %} 6 {% filter conditional(attribute.conditional_string) %}
7 static void {{attribute.name}}AttributeGetter{{world_suffix}}( 7 static void {{attribute.name}}AttributeGetter{{world_suffix}}(
8 {%- if attribute.is_expose_js_accessors %} 8 {%- if attribute.is_expose_js_accessors %}
9 const v8::FunctionCallbackInfo<v8::Value>& info 9 const v8::FunctionCallbackInfo<v8::Value>& info
10 {%- else %} 10 {%- else %}
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 attribute.cpp_value) 77 attribute.cpp_value)
78 | indent}} 78 | indent}}
79 {% endif %} 79 {% endif %}
80 {% if attribute.is_explicit_nullable %} 80 {% if attribute.is_explicit_nullable %}
81 if (isNull) { 81 if (isNull) {
82 v8SetReturnValueNull(info); 82 v8SetReturnValueNull(info);
83 return; 83 return;
84 } 84 }
85 {% endif %} 85 {% endif %}
86 {% if attribute.cached_attribute_validation_method %} 86 {% if attribute.cached_attribute_validation_method %}
87 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, propertyName, {{att ribute.cpp_value_to_v8_value}}); 87 v8::Local<v8::Value> v8Value({{attribute.cpp_value_to_v8_value}});
88 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, propertyName, v8Val ue);
88 {% endif %} 89 {% endif %}
89 {# v8SetReturnValue #} 90 {# v8SetReturnValue #}
90 {% if attribute.is_keep_alive_for_gc %} 91 {% if attribute.is_keep_alive_for_gc %}
91 if ({{attribute.cpp_value}} && DOMDataStore::setReturnValue{{world_suffix}}( info.GetReturnValue(), {{attribute.cpp_value}}.get())) 92 if ({{attribute.cpp_value}} && DOMDataStore::setReturnValue{{world_suffix}}( info.GetReturnValue(), {{attribute.cpp_value}}.get()))
92 return; 93 return;
93 v8::Local<v8::Value> wrapper = toV8({{attribute.cpp_value}}.get(), holder, i nfo.GetIsolate()); 94 v8::Local<v8::Value> v8Value(toV8({{attribute.cpp_value}}.get(), holder, inf o.GetIsolate()));
94 if (!wrapper.IsEmpty()) { 95 if (!v8Value.IsEmpty()) {
95 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString( info.GetIsolate(), "{{attribute.name}}"), wrapper); 96 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString( info.GetIsolate(), "{{attribute.name}}"), v8Value);
96 {{attribute.v8_set_return_value}}; 97 {{attribute.v8_set_return_value}};
97 } 98 }
98 {% elif world_suffix %} 99 {% elif world_suffix %}
99 {{attribute.v8_set_return_value_for_main_world}}; 100 {{attribute.v8_set_return_value_for_main_world}};
100 {% else %} 101 {% else %}
101 {% if attribute.use_output_parameter_for_result %} 102 {% if attribute.use_output_parameter_for_result %}
102 {{attribute.cpp_type}} result; 103 {{attribute.cpp_type}} result;
103 {{attribute.cpp_value}}; 104 {{attribute.cpp_value}};
104 {% endif %} 105 {% endif %}
105 {{attribute.v8_set_return_value}}; 106 {{attribute.v8_set_return_value}};
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 access_control, 449 access_control,
449 property_attribute, 450 property_attribute,
450 only_exposed_to_private_script, 451 only_exposed_to_private_script,
451 ] %} 452 ] %}
452 {% if not attribute.is_expose_js_accessors %} 453 {% if not attribute.is_expose_js_accessors %}
453 {% set attribute_configuration_list = attribute_configuration_list 454 {% set attribute_configuration_list = attribute_configuration_list
454 + [on_prototype] %} 455 + [on_prototype] %}
455 {% endif %} 456 {% endif %}
456 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} 457 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}}
457 {%- endmacro %} 458 {%- endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_attributes.py ('k') | Source/bindings/tests/results/core/V8TestInterfaceEventConstructor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698