OLD | NEW |
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 16 matching lines...) Expand all Loading... |
27 {% if attribute.is_save_same_object %} | 27 {% if attribute.is_save_same_object %} |
28 // [SaveSameObject] | 28 // [SaveSameObject] |
29 {% set same_object_private_key = interface_name + attribute.name[0]|capitalize
+ attribute.name[1:] %} | 29 {% set same_object_private_key = interface_name + attribute.name[0]|capitalize
+ attribute.name[1:] %} |
30 // If you see a compile error that | 30 // If you see a compile error that |
31 // V8PrivateProperty::getSameObject{{same_object_private_key}} | 31 // V8PrivateProperty::getSameObject{{same_object_private_key}} |
32 // is not defined, then you need to register your attribute at | 32 // is not defined, then you need to register your attribute at |
33 // V8_PRIVATE_PROPERTY_FOR_EACH defined in V8PrivateProperty.h as | 33 // V8_PRIVATE_PROPERTY_FOR_EACH defined in V8PrivateProperty.h as |
34 // X(SameObject, {{same_object_private_key}}) | 34 // X(SameObject, {{same_object_private_key}}) |
35 auto privateSameObject = V8PrivateProperty::getSameObject{{same_object_private
_key}}(info.GetIsolate()); | 35 auto privateSameObject = V8PrivateProperty::getSameObject{{same_object_private
_key}}(info.GetIsolate()); |
36 { | 36 { |
37 v8::Local<v8::Value> v8Value = privateSameObject.get(info.GetIsolate()->GetC
urrentContext(), holder); | 37 v8::Local<v8::Value> v8Value = privateSameObject.getOrEmpty(holder); |
38 if (!v8Value.IsEmpty()) { | 38 if (!v8Value.IsEmpty()) { |
39 v8SetReturnValue(info, v8Value); | 39 v8SetReturnValue(info, v8Value); |
40 return; | 40 return; |
41 } | 41 } |
42 } | 42 } |
43 {% endif %} | 43 {% endif %} |
44 | 44 |
45 {% if not attribute.is_static %} | 45 {% if not attribute.is_static %} |
46 {% set local_dom_window_only = interface_name == 'Window' and not attribute.ha
s_cross_origin_getter %} | 46 {% set local_dom_window_only = interface_name == 'Window' and not attribute.ha
s_cross_origin_getter %} |
47 {% if local_dom_window_only %} | 47 {% if local_dom_window_only %} |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 {% endif %} | 156 {% endif %} |
157 | 157 |
158 {% if world_suffix %} | 158 {% if world_suffix %} |
159 {{attribute.v8_set_return_value_for_main_world}}; | 159 {{attribute.v8_set_return_value_for_main_world}}; |
160 {% else %} | 160 {% else %} |
161 {{attribute.v8_set_return_value}}; | 161 {{attribute.v8_set_return_value}}; |
162 {% endif %} | 162 {% endif %} |
163 | 163 |
164 {% if attribute.is_save_same_object %} | 164 {% if attribute.is_save_same_object %} |
165 // [SaveSameObject] | 165 // [SaveSameObject] |
166 privateSameObject.set(info.GetIsolate()->GetCurrentContext(), holder, info.Get
ReturnValue().Get()); | 166 privateSameObject.set(holder, info.GetReturnValue().Get()); |
167 {% endif %} | 167 {% endif %} |
168 {% endfilter %}{# format_remove_duplicates #} | 168 {% endfilter %}{# format_remove_duplicates #} |
169 } | 169 } |
170 {% endmacro %} | 170 {% endmacro %} |
171 | 171 |
172 | 172 |
173 {######################################} | 173 {######################################} |
174 {% macro release_only_check(reflect_only_values, reflect_missing, | 174 {% macro release_only_check(reflect_only_values, reflect_missing, |
175 reflect_invalid, reflect_empty, cpp_value) %} | 175 reflect_invalid, reflect_empty, cpp_value) %} |
176 {# Attribute is limited to only known values: check that the attribute value is | 176 {# Attribute is limited to only known values: check that the attribute value is |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration[] =
{ | 506 static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration[] =
{ |
507 {{attribute_configuration(attribute)}} | 507 {{attribute_configuration(attribute)}} |
508 }; | 508 }; |
509 for (const auto& accessorConfig : accessorConfiguration) | 509 for (const auto& accessorConfig : accessorConfiguration) |
510 V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), p
rototypeObject, interfaceObject, signature, accessorConfig); | 510 V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), p
rototypeObject, interfaceObject, signature, accessorConfig); |
511 {% endfilter %}{# runtime_enabled #} | 511 {% endfilter %}{# runtime_enabled #} |
512 {% endfilter %}{# secure_context #} | 512 {% endfilter %}{# secure_context #} |
513 {% endfilter %}{# exposed #} | 513 {% endfilter %}{# exposed #} |
514 {% endfor %} | 514 {% endfor %} |
515 {% endmacro %} | 515 {% endmacro %} |
OLD | NEW |