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

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

Issue 2884493002: Bindings: Require [CachedAttribute] method to be const (Closed)
Patch Set: update binding test expectations Created 3 years, 7 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 {% else %} 56 {% else %}
57 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); 57 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
58 {% endif %}{# local_dom_window_only #} 58 {% endif %}{# local_dom_window_only #}
59 {% endif %}{# not attribute.is_static #} 59 {% endif %}{# not attribute.is_static #}
60 60
61 {% if attribute.cached_attribute_validation_method %} 61 {% if attribute.cached_attribute_validation_method %}
62 // [CachedAttribute] 62 // [CachedAttribute]
63 V8PrivateProperty::Symbol propertySymbol = 63 V8PrivateProperty::Symbol propertySymbol =
64 V8PrivateProperty::GetSymbol(info.GetIsolate(), 64 V8PrivateProperty::GetSymbol(info.GetIsolate(),
65 "{{cpp_class}}#{{attribute.name.capitalize()}}"); 65 "{{cpp_class}}#{{attribute.name.capitalize()}}");
66 if (!impl->{{attribute.cached_attribute_validation_method}}()) { 66 if (!static_cast<const {{cpp_class}}*>(impl)->{{attribute.cached_attribute_val idation_method}}()) {
67 v8::Local<v8::Value> v8Value = propertySymbol.GetOrUndefined(holder); 67 v8::Local<v8::Value> v8Value = propertySymbol.GetOrUndefined(holder);
68 if (!v8Value->IsUndefined()) { 68 if (!v8Value->IsUndefined()) {
69 V8SetReturnValue(info, v8Value); 69 V8SetReturnValue(info, v8Value);
70 return; 70 return;
71 } 71 }
72 } 72 }
73 {% endif %} 73 {% endif %}
74 74
75 {% if attribute.is_check_security_for_receiver and not attribute.is_data_type_ property %} 75 {% if attribute.is_check_security_for_receiver and not attribute.is_data_type_ property %}
76 // Perform a security check for the receiver object. 76 // Perform a security check for the receiver object.
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration[] = { 579 static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration[] = {
580 {{accessor_configuration(attribute)}} 580 {{accessor_configuration(attribute)}}
581 }; 581 };
582 for (const auto& accessorConfig : accessorConfiguration) 582 for (const auto& accessorConfig : accessorConfiguration)
583 V8DOMConfiguration::InstallAccessor(isolate, world, v8::Local<v8::Object>(), p rototypeObject, interfaceObject, signature, accessorConfig); 583 V8DOMConfiguration::InstallAccessor(isolate, world, v8::Local<v8::Object>(), p rototypeObject, interfaceObject, signature, accessorConfig);
584 {% endfilter %}{# runtime_enabled #} 584 {% endfilter %}{# runtime_enabled #}
585 {% endfilter %}{# secure_context #} 585 {% endfilter %}{# secure_context #}
586 {% endfilter %}{# exposed #} 586 {% endfilter %}{# exposed #}
587 {% endfor %} 587 {% endfor %}
588 {% endmacro %} 588 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698