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

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

Issue 340443004: IDL: reuse more code between CG for methods and constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rename scriptContext -> executionContext 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 | « Source/bindings/scripts/v8_utilities.py ('k') | Source/bindings/templates/methods.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 {
(...skipping 24 matching lines...) Expand all
35 } 35 }
36 {% elif not attribute.is_static %} 36 {% elif not attribute.is_static %}
37 {{cpp_class}}* impl = {{v8_class}}::toNative(holder); 37 {{cpp_class}}* impl = {{v8_class}}::toNative(holder);
38 {% endif %} 38 {% endif %}
39 {% if interface_name == 'Window' and attribute.idl_type == 'EventHandler' %} 39 {% if interface_name == 'Window' and attribute.idl_type == 'EventHandler' %}
40 if (!impl->document()) 40 if (!impl->document())
41 return; 41 return;
42 {% endif %} 42 {% endif %}
43 {# Local variables #} 43 {# Local variables #}
44 {% if attribute.is_call_with_execution_context %} 44 {% if attribute.is_call_with_execution_context %}
45 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()) ; 45 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
46 {% endif %} 46 {% endif %}
47 {% if attribute.is_call_with_script_state %} 47 {% if attribute.is_call_with_script_state %}
48 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); 48 ScriptState* scriptState = ScriptState::current(info.GetIsolate());
49 {% endif %} 49 {% endif %}
50 {% if attribute.is_check_security_for_node or 50 {% if attribute.is_check_security_for_node or
51 attribute.is_getter_raises_exception %} 51 attribute.is_getter_raises_exception %}
52 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na me}}", "{{interface_name}}", holder, info.GetIsolate()); 52 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na me}}", "{{interface_name}}", holder, info.GetIsolate());
53 {% endif %} 53 {% endif %}
54 {% if attribute.is_nullable and not attribute.has_type_checking_nullable %} 54 {% if attribute.is_nullable and not attribute.has_type_checking_nullable %}
55 bool isNull = false; 55 bool isNull = false;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 {% endif %} 269 {% endif %}
270 {# Pre-set context #} 270 {# Pre-set context #}
271 {% if attribute.is_custom_element_callbacks or 271 {% if attribute.is_custom_element_callbacks or
272 (attribute.is_reflect and 272 (attribute.is_reflect and
273 not(attribute.idl_type == 'DOMString' and is_node)) %} 273 not(attribute.idl_type == 'DOMString' and is_node)) %}
274 {# Skip on compact node DOMString getters #} 274 {# Skip on compact node DOMString getters #}
275 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 275 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
276 {% endif %} 276 {% endif %}
277 {% if attribute.is_call_with_execution_context or 277 {% if attribute.is_call_with_execution_context or
278 attribute.is_setter_call_with_execution_context %} 278 attribute.is_setter_call_with_execution_context %}
279 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()) ; 279 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
280 {% endif %} 280 {% endif %}
281 {# Set #} 281 {# Set #}
282 {{attribute.cpp_setter}}; 282 {{attribute.cpp_setter}};
283 {# Post-set #} 283 {# Post-set #}
284 {% if attribute.is_setter_raises_exception %} 284 {% if attribute.is_setter_raises_exception %}
285 exceptionState.throwIfNeeded(); 285 exceptionState.throwIfNeeded();
286 {% endif %} 286 {% endif %}
287 {% if attribute.cached_attribute_validation_method %} 287 {% if attribute.cached_attribute_validation_method %}
288 V8HiddenValue::deleteHiddenValue(info.GetIsolate(), holder, v8AtomicString(i nfo.GetIsolate(), "{{attribute.name}}")); // Invalidate the cached value. 288 V8HiddenValue::deleteHiddenValue(info.GetIsolate(), holder, v8AtomicString(i nfo.GetIsolate(), "{{attribute.name}}")); // Invalidate the cached value.
289 {% endif %} 289 {% endif %}
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 {% endif %} 334 {% endif %}
335 {% if attribute.has_custom_setter %} 335 {% if attribute.has_custom_setter %}
336 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info); 336 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info);
337 {% else %} 337 {% else %}
338 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v 8Value, info); 338 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v 8Value, info);
339 {% endif %} 339 {% endif %}
340 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 340 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
341 } 341 }
342 {% endfilter %} 342 {% endfilter %}
343 {% endmacro %} 343 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_utilities.py ('k') | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698