| OLD | NEW |
| 1 {% extends 'interface_base.cpp' %} | 1 {% extends 'interface_base.cpp' %} |
| 2 | 2 |
| 3 | 3 |
| 4 {##############################################################################} | 4 {##############################################################################} |
| 5 {% block class_attributes %} | 5 {% block class_attributes %} |
| 6 {# FIXME: rename to install_attributes and put into configure_class_template #} | 6 {# FIXME: rename to install_attributes and put into configure_class_template #} |
| 7 {% if attributes %} | 7 {% if attributes %} |
| 8 static const V8DOMConfiguration::AttributeConfiguration {{v8_class_name}}Attribu
tes[] = { | 8 static const V8DOMConfiguration::AttributeConfiguration {{v8_class_name}}Attribu
tes[] = { |
| 9 {% for attribute in attributes %} | 9 {% for attribute in attributes if not attribute.is_static %} |
| 10 {"{{attribute.name}}", {{cpp_class_name}}V8Internal::{{attribute.name}}Attri
buteGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), sta
tic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, | 10 {"{{attribute.name}}", {{cpp_class_name}}V8Internal::{{attribute.name}}Attri
buteGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), sta
tic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, |
| 11 {% endfor %} | 11 {% endfor %} |
| 12 }; | 12 }; |
| 13 | 13 |
| 14 {% endif %} | 14 {% endif %} |
| 15 {% endblock %} | 15 {% endblock %} |
| 16 | 16 |
| 17 | 17 |
| 18 {##############################################################################} | 18 {##############################################################################} |
| 19 {% block configure_class_template %} | 19 {% block configure_class_template %} |
| 20 {# FIXME: rename to install_dom_template and Install{{v8_class_name}}DOMTemplate
#} | 20 {# FIXME: rename to install_dom_template and Install{{v8_class_name}}DOMTemplate
#} |
| 21 static v8::Handle<v8::FunctionTemplate> Configure{{v8_class_name}}Template(v8::H
andle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType current
WorldType) | 21 static v8::Handle<v8::FunctionTemplate> Configure{{v8_class_name}}Template(v8::H
andle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType current
WorldType) |
| 22 { | 22 { |
| 23 desc->ReadOnlyPrototype(); | 23 desc->ReadOnlyPrototype(); |
| 24 | 24 |
| 25 v8::Local<v8::Signature> defaultSignature; | 25 v8::Local<v8::Signature> defaultSignature; |
| 26 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "{{inte
rface_name}}", v8::Local<v8::FunctionTemplate>(), {{v8_class_name}}::internalFie
ldCount, | 26 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "{{inte
rface_name}}", v8::Local<v8::FunctionTemplate>(), {{v8_class_name}}::internalFie
ldCount, |
| 27 {{attribute_templates}}, {{number_of_attributes}}, | 27 {{attribute_templates}}, {{number_of_attributes}}, |
| 28 0, 0, isolate, currentWorldType); | 28 0, 0, isolate, currentWorldType); |
| 29 UNUSED_PARAM(defaultSignature); | 29 UNUSED_PARAM(defaultSignature); |
| 30 {% if constants %}{# In general more checks than just constants #} | 30 {% for attribute in attributes if attribute.is_static %} |
| 31 desc->SetNativeDataProperty(v8::String::NewSymbol("{{attribute.name}}"), {{c
pp_class_name}}V8Internal::{{attribute.name}}AttributeGetterCallback, 0, v8::Ext
ernal::New(0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::Acce
ssorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); |
| 32 {% endfor %} |
| 33 {% if constants %}{# In general more checks than just constants #} |
| 31 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); | 34 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); |
| 32 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); | 35 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); |
| 33 UNUSED_PARAM(instance); | 36 UNUSED_PARAM(instance); |
| 34 UNUSED_PARAM(proto); | 37 UNUSED_PARAM(proto); |
| 35 {% endif %} | 38 {% endif %} |
| 36 {% if constants %} | 39 {% if constants %} |
| 37 {{install_constants() | indent}} | 40 {{install_constants() | indent}} |
| 38 {% endif %} | 41 {% endif %} |
| 39 | 42 |
| 40 // Custom toString template | 43 // Custom toString template |
| 41 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); | 44 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to
StringTemplate()); |
| 42 return desc; | 45 return desc; |
| 43 } | 46 } |
| 44 | 47 |
| 45 {% endblock %} | 48 {% endblock %} |
| 46 | 49 |
| 47 | 50 |
| 48 {######################################} | 51 {######################################} |
| 49 {% macro install_constants() %} | 52 {% macro install_constants() %} |
| 50 {# FIXME: should use reflected_name instead of name #} | 53 {# FIXME: should use reflected_name instead of name #} |
| 51 {# Normal (always enabled) constants #} | 54 {# Normal (always enabled) constants #} |
| 52 static const V8DOMConfiguration::ConstantConfiguration {{v8_class_name}}Constant
s[] = { | 55 static const V8DOMConfiguration::ConstantConfiguration {{v8_class_name}}Constant
s[] = { |
| 53 {% for constant in constants if not constant.enabled_at_runtime %} | 56 {% for constant in constants if not constant.enabled_at_runtime %} |
| 54 {"{{constant.name}}", {{constant.value}}}, | 57 {"{{constant.name}}", {{constant.value}}}, |
| 55 {% endfor %} | 58 {% endfor %} |
| 56 }; | 59 }; |
| 57 V8DOMConfiguration::installConstants(desc, proto, {{v8_class_name}}Constants, WT
F_ARRAY_LENGTH({{v8_class_name}}Constants), isolate); | 60 V8DOMConfiguration::installConstants(desc, proto, {{v8_class_name}}Constants, WT
F_ARRAY_LENGTH({{v8_class_name}}Constants), isolate); |
| 58 {# Runtime-enabled constants #} | 61 {# Runtime-enabled constants #} |
| 59 {% for constant in constants if constant.enabled_at_runtime %} | 62 {% for constant in constants if constant.enabled_at_runtime %} |
| 60 if ({{constant.runtime_enable_function_name}}()) { | 63 if ({{constant.runtime_enable_function_name}}()) { |
| 61 static const V8DOMConfiguration::ConstantConfiguration constantConfiguration
= {"{{constant.name}}", static_cast<signed int>({{constant.value}})}; | 64 static const V8DOMConfiguration::ConstantConfiguration constantConfiguration
= {"{{constant.name}}", static_cast<signed int>({{constant.value}})}; |
| 62 V8DOMConfiguration::installConstants(desc, proto, &constantConfiguration, 1,
isolate); | 65 V8DOMConfiguration::installConstants(desc, proto, &constantConfiguration, 1,
isolate); |
| 63 } | 66 } |
| 64 {% endfor %} | 67 {% endfor %} |
| 65 {# Check constants #} | 68 {# Check constants #} |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &info, wra
pper, isolate, WrapperConfiguration::Independent); | 133 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &info, wra
pper, isolate, WrapperConfiguration::Independent); |
| 131 return wrapper; | 134 return wrapper; |
| 132 } | 135 } |
| 133 | 136 |
| 134 void {{v8_class_name}}::derefObject(void* object) | 137 void {{v8_class_name}}::derefObject(void* object) |
| 135 { | 138 { |
| 136 fromInternalPointer(object)->deref(); | 139 fromInternalPointer(object)->deref(); |
| 137 } | 140 } |
| 138 | 141 |
| 139 {% endblock %} | 142 {% endblock %} |
| OLD | NEW |