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

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

Issue 347773003: IDL: Remove holder lookup in attribute_getter macro (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 {
11 {% if attribute.is_reflect and not attribute.is_url and 11 {% if attribute.is_reflect and not attribute.is_url and
12 attribute.idl_type == 'DOMString' and is_node %} 12 attribute.idl_type == 'DOMString' and is_node %}
13 {% set cpp_class, v8_class = 'Element', 'V8Element' %} 13 {% set cpp_class, v8_class = 'Element', 'V8Element' %}
14 {% endif %} 14 {% endif %}
15 {# holder #} 15 {# holder #}
16 {% if attribute.is_unforgeable and interface_name != 'Window' %} 16 {% if not attribute.is_static %}
17 {# perform lookup first #}
18 {# FIXME: can we remove this lookup? #}
19 v8::Handle<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(i nfo.This(), info.GetIsolate());
20 if (holder.IsEmpty())
21 return;
22 {% elif not attribute.is_static %}
23 v8::Handle<v8::Object> holder = info.Holder(); 17 v8::Handle<v8::Object> holder = info.Holder();
24 {% endif %} 18 {% endif %}
25 {# impl #} 19 {# impl #}
26 {% if attribute.cached_attribute_validation_method %} 20 {% if attribute.cached_attribute_validation_method %}
27 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{a ttribute.name}}"); 21 v8::Handle<v8::String> propertyName = v8AtomicString(info.GetIsolate(), "{{a ttribute.name}}");
28 {{cpp_class}}* impl = {{v8_class}}::toNative(holder); 22 {{cpp_class}}* impl = {{v8_class}}::toNative(holder);
29 if (!impl->{{attribute.cached_attribute_validation_method}}()) { 23 if (!impl->{{attribute.cached_attribute_validation_method}}()) {
30 v8::Handle<v8::Value> v8Value = V8HiddenValue::getHiddenValue(info.GetIs olate(), holder, propertyName); 24 v8::Handle<v8::Value> v8Value = V8HiddenValue::getHiddenValue(info.GetIs olate(), holder, propertyName);
31 if (!v8Value.IsEmpty()) { 25 if (!v8Value.IsEmpty()) {
32 v8SetReturnValue(info, v8Value); 26 v8SetReturnValue(info, v8Value);
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 {% endif %} 338 {% endif %}
345 {% if attribute.has_custom_setter %} 339 {% if attribute.has_custom_setter %}
346 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info); 340 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info);
347 {% else %} 341 {% else %}
348 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v 8Value, info); 342 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v 8Value, info);
349 {% endif %} 343 {% endif %}
350 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 344 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
351 } 345 }
352 {% endfilter %} 346 {% endfilter %}
353 {% endmacro %} 347 {% endmacro %}
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8TestObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698