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 %}) { |
11 {% filter format_remove_duplicates(['ExceptionState exceptionState']) %} | 11 {% filter format_remove_duplicates(['ExceptionState exceptionState']) %} |
12 {% set define_exception_state -%} | 12 {% set define_exception_state -%} |
13 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kGetterContex t, "{{interface_name}}", "{{attribute.name}}"); | 13 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kGetterContex t, "{{interface_name}}", "{{attribute.name}}"); |
14 {%- endset %} | 14 {%- endset %} |
15 | 15 |
16 {% if attribute.is_lenient_this %} | 16 {% if attribute.is_lenient_this %} |
17 // [LenientThis] | 17 // [LenientThis] |
18 // Make sure that info.Holder() really points to an instance if [LenientThis]. | 18 // Make sure that info.Holder() really points to an instance if [LenientThis]. |
19 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) | 19 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) |
20 return; // Return silently because of [LenientThis]. | 20 return; // Return silently because of [LenientThis]. |
21 {% endif %} | 21 {% endif %} |
22 | 22 |
23 {% if not attribute.is_static %} | 23 {% if not attribute.is_static or attribute.is_save_same_object %} |
24 v8::Local<v8::Object> holder = info.Holder(); | 24 v8::Local<v8::Object> holder = info.Holder(); |
Peter Beverloo
2017/05/05 13:18:59
SaveSameObject uses |holder| (see lines 27-43 belo
| |
25 {% endif %} | 25 {% endif %} |
26 | 26 |
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}}) |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration[] = { | 518 static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration[] = { |
519 {{attribute_configuration(attribute)}} | 519 {{attribute_configuration(attribute)}} |
520 }; | 520 }; |
521 for (const auto& accessorConfig : accessorConfiguration) | 521 for (const auto& accessorConfig : accessorConfiguration) |
522 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); |
523 {% endfilter %}{# runtime_enabled #} | 523 {% endfilter %}{# runtime_enabled #} |
524 {% endfilter %}{# secure_context #} | 524 {% endfilter %}{# secure_context #} |
525 {% endfilter %}{# exposed #} | 525 {% endfilter %}{# exposed #} |
526 {% endfor %} | 526 {% endfor %} |
527 {% endmacro %} | 527 {% endmacro %} |
OLD | NEW |