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

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

Issue 352643005: Drop [TypeChecking=Nullable]; deduce from attribute type instead (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@cleanup-typechecking
Patch Set: rebased Created 6 years, 5 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_attributes.py ('k') | Source/bindings/tests/idls/TestInterface.idl » ('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 27 matching lines...) Expand all
38 {% if attribute.is_call_with_execution_context %} 38 {% if attribute.is_call_with_execution_context %}
39 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ()); 39 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
40 {% endif %} 40 {% endif %}
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.is_nullable_simple %}
49 bool isNull = false; 49 bool isNull = false;
50 {% endif %} 50 {% endif %}
51 {% if attribute.cpp_value_original %} 51 {% if attribute.cpp_value_original %}
52 {{attribute.cpp_type}} {{attribute.cpp_value}}({{attribute.cpp_value_origina l}}); 52 {{attribute.cpp_type}} {{attribute.cpp_value}}({{attribute.cpp_value_origina l}});
53 {% endif %} 53 {% endif %}
54 {# Checks #} 54 {# Checks #}
55 {% if attribute.is_getter_raises_exception %} 55 {% if attribute.is_getter_raises_exception %}
56 if (UNLIKELY(exceptionState.throwIfNeeded())) 56 if (UNLIKELY(exceptionState.throwIfNeeded()))
57 return; 57 return;
58 {% endif %} 58 {% endif %}
59 {% if attribute.is_check_security_for_node %} 59 {% if attribute.is_check_security_for_node %}
60 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), {{attribute .cpp_value}}, exceptionState)) { 60 if (!BindingSecurity::shouldAllowAccessToNode(info.GetIsolate(), {{attribute .cpp_value}}, exceptionState)) {
61 v8SetReturnValueNull(info); 61 v8SetReturnValueNull(info);
62 exceptionState.throwIfNeeded(); 62 exceptionState.throwIfNeeded();
63 return; 63 return;
64 } 64 }
65 {% endif %} 65 {% endif %}
66 {% if attribute.reflect_only %} 66 {% if attribute.reflect_only %}
67 {{release_only_check(attribute.reflect_only, attribute.reflect_missing, 67 {{release_only_check(attribute.reflect_only, attribute.reflect_missing,
68 attribute.reflect_invalid, attribute.reflect_empty, 68 attribute.reflect_invalid, attribute.reflect_empty,
69 attribute.cpp_value) 69 attribute.cpp_value)
70 | indent}} 70 | indent}}
71 {% endif %} 71 {% endif %}
72 {% if attribute.is_nullable %} 72 {% if attribute.is_nullable %}
73 {% if attribute.has_type_checking_nullable %} 73 {% if attribute.is_nullable_simple %}
74 if (!{{attribute.cpp_value}}) { 74 if (!{{attribute.cpp_value}}) {
75 {% else %} 75 {% else %}
76 if (isNull) { 76 if (isNull) {
77 {% endif %} 77 {% endif %}
78 v8SetReturnValueNull(info); 78 v8SetReturnValueNull(info);
79 return; 79 return;
80 } 80 }
81 {% endif %} 81 {% endif %}
82 {% if attribute.cached_attribute_validation_method %} 82 {% if attribute.cached_attribute_validation_method %}
83 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}});
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 {% endif %} 331 {% endif %}
332 {% if attribute.has_custom_setter %} 332 {% if attribute.has_custom_setter %}
333 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info); 333 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info);
334 {% else %} 334 {% else %}
335 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v 8Value, info); 335 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v 8Value, info);
336 {% endif %} 336 {% endif %}
337 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 337 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
338 } 338 }
339 {% endfilter %} 339 {% endfilter %}
340 {% endmacro %} 340 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_attributes.py ('k') | Source/bindings/tests/idls/TestInterface.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698