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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl

Issue 2809543002: bindings: Pass is_null flag to attribute setters when they are nullable (Closed)
Patch Set: Created 3 years, 8 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 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t o_local_cpp_value %} 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t o_local_cpp_value %}
2 2
3 {##############################################################################} 3 {##############################################################################}
4 {% macro attribute_getter(attribute, world_suffix) %} 4 {% macro attribute_getter(attribute, world_suffix) %}
5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( 5 static void {{attribute.name}}AttributeGetter{{world_suffix}}(
6 {%- if attribute.is_data_type_property %} 6 {%- if attribute.is_data_type_property %}
7 const v8::PropertyCallbackInfo<v8::Value>& info 7 const v8::PropertyCallbackInfo<v8::Value>& info
8 {%- else %} 8 {%- else %}
9 const v8::FunctionCallbackInfo<v8::Value>& info 9 const v8::FunctionCallbackInfo<v8::Value>& info
10 {%- endif %}) { 10 {%- endif %}) {
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 {% if attribute.is_static %} 389 {% if attribute.is_static %}
390 ScriptState* scriptState = ScriptState::ForFunctionObject(info); 390 ScriptState* scriptState = ScriptState::ForFunctionObject(info);
391 {% else %} 391 {% else %}
392 ScriptState* scriptState = ScriptState::ForReceiverObject(info); 392 ScriptState* scriptState = ScriptState::ForReceiverObject(info);
393 {% endif %} 393 {% endif %}
394 {% endif %} 394 {% endif %}
395 395
396 {% if attribute.is_replaceable %} 396 {% if attribute.is_replaceable %}
397 v8::Local<v8::String> propertyName = V8AtomicString(isolate, "{{attribute.name }}"); 397 v8::Local<v8::String> propertyName = V8AtomicString(isolate, "{{attribute.name }}");
398 {% endif %} 398 {% endif %}
399 {% if attribute.is_explicit_nullable %}
400 bool isNull = IsUndefinedOrNull(v8Value);
401 {% endif %}
399 {{attribute.cpp_setter}}; 402 {{attribute.cpp_setter}};
400 403
401 {% if attribute.cached_attribute_validation_method %} 404 {% if attribute.cached_attribute_validation_method %}
402 // [CachedAttribute] 405 // [CachedAttribute]
403 // Invalidate the cached value. 406 // Invalidate the cached value.
404 V8PrivateProperty::GetSymbol( 407 V8PrivateProperty::GetSymbol(
405 isolate, "{{cpp_class}}#{{attribute.name.capitalize()}}") 408 isolate, "{{cpp_class}}#{{attribute.name.capitalize()}}")
406 .DeleteProperty(holder, v8::Undefined(isolate)); 409 .DeleteProperty(holder, v8::Undefined(isolate));
407 {% endif %} 410 {% endif %}
408 } 411 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration[] = { 518 static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration[] = {
516 {{attribute_configuration(attribute)}} 519 {{attribute_configuration(attribute)}}
517 }; 520 };
518 for (const auto& accessorConfig : accessorConfiguration) 521 for (const auto& accessorConfig : accessorConfiguration)
519 V8DOMConfiguration::InstallAccessor(isolate, world, v8::Local<v8::Object>(), p rototypeObject, interfaceObject, signature, accessorConfig); 522 V8DOMConfiguration::InstallAccessor(isolate, world, v8::Local<v8::Object>(), p rototypeObject, interfaceObject, signature, accessorConfig);
520 {% endfilter %}{# runtime_enabled #} 523 {% endfilter %}{# runtime_enabled #}
521 {% endfilter %}{# secure_context #} 524 {% endfilter %}{# secure_context #}
522 {% endfilter %}{# exposed #} 525 {% endfilter %}{# exposed #}
523 {% endfor %} 526 {% endfor %}
524 {% endmacro %} 527 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698