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

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

Issue 357413003: IDL: Drop redundant null check for string and wrapper type attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: updated 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
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 and not attribute.is_nullable_simple %}
73 {% if attribute.is_nullable_simple %}
74 if (!{{attribute.cpp_value}}) {
75 {% else %}
76 if (isNull) { 73 if (isNull) {
77 {% endif %}
78 v8SetReturnValueNull(info); 74 v8SetReturnValueNull(info);
79 return; 75 return;
80 } 76 }
81 {% endif %} 77 {% endif %}
82 {% if attribute.cached_attribute_validation_method %} 78 {% if attribute.cached_attribute_validation_method %}
83 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, propertyName, {{att ribute.cpp_value_to_v8_value}}); 79 V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, propertyName, {{att ribute.cpp_value_to_v8_value}});
84 {% endif %} 80 {% endif %}
85 {# v8SetReturnValue #} 81 {# v8SetReturnValue #}
86 {% if attribute.is_keep_alive_for_gc %} 82 {% if attribute.is_keep_alive_for_gc %}
87 if ({{attribute.cpp_value}} && DOMDataStore::setReturnValueFromWrapper{{worl d_suffix}}<{{attribute.v8_type}}>(info.GetReturnValue(), {{attribute.cpp_value}} .get())) 83 if ({{attribute.cpp_value}} && DOMDataStore::setReturnValueFromWrapper{{worl d_suffix}}<{{attribute.v8_type}}>(info.GetReturnValue(), {{attribute.cpp_value}} .get()))
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext()); 304 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext());
309 V8PerContextData* contextData = scriptState->perContextData(); 305 V8PerContextData* contextData = scriptState->perContextData();
310 {% if attribute.activity_logging_world_check %} 306 {% if attribute.activity_logging_world_check %}
311 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger()) { 307 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger()) {
312 {% else %} 308 {% else %}
313 if (contextData && contextData->activityLogger()) { 309 if (contextData && contextData->activityLogger()) {
314 {% endif %} 310 {% endif %}
315 {% if attribute.activity_logging_include_old_value_for_setter %} 311 {% if attribute.activity_logging_include_old_value_for_setter %}
316 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder()); 312 {{cpp_class}}* impl = {{v8_class}}::toNative(info.Holder());
317 {% if attribute.cpp_value_original %} 313 {% if attribute.cpp_value_original %}
318 {{attribute.cpp_type}} original = {{attribute.cpp_value_original}}; 314 {{attribute.cpp_type}} {{attribute.cpp_value}}({{attribute.cpp_value_ori ginal}});
319 {% else %}
320 {{attribute.cpp_type}} original = {{attribute.cpp_value}};
321 {% endif %} 315 {% endif %}
322 v8::Handle<v8::Value> originalValue = {{attribute.cpp_value_to_v8_value} }; 316 v8::Handle<v8::Value> originalValue = {{attribute.cpp_value_to_v8_value} };
323 contextData->activityLogger()->logSetter("{{interface_name}}.{{attribute .name}}", v8Value, originalValue); 317 contextData->activityLogger()->logSetter("{{interface_name}}.{{attribute .name}}", v8Value, originalValue);
324 {% else %} 318 {% else %}
325 contextData->activityLogger()->logSetter("{{interface_name}}.{{attribute .name}}", v8Value); 319 contextData->activityLogger()->logSetter("{{interface_name}}.{{attribute .name}}", v8Value);
326 {% endif %} 320 {% endif %}
327 } 321 }
328 {% endif %} 322 {% endif %}
329 {% if attribute.is_custom_element_callbacks or attribute.is_reflect %} 323 {% if attribute.is_custom_element_callbacks or attribute.is_reflect %}
330 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 324 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
331 {% endif %} 325 {% endif %}
332 {% if attribute.has_custom_setter %} 326 {% if attribute.has_custom_setter %}
333 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info); 327 {{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info);
334 {% else %} 328 {% else %}
335 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v 8Value, info); 329 {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v 8Value, info);
336 {% endif %} 330 {% endif %}
337 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 331 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
338 } 332 }
339 {% endfilter %} 333 {% endfilter %}
340 {% endmacro %} 334 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698