Chromium Code Reviews| 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 attribute.is_normal %} |
|
haraken
2013/09/26 22:48:30
Could you use something like 'not if attribute.is_
Nils Barth (inactive)
2013/09/27 00:26:14
Removing for now.
In future we will need is_normal
| |
| 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 // Attribute '{{attribute.name}}' (Extended Attributes: '{{attribute.extende d_attributes | join(' ')}}') | |
|
haraken
2013/09/26 22:48:30
Let's remove this comment. This comment has been c
Nils Barth (inactive)
2013/09/27 00:26:14
Done, removed in Perl too!
| |
| 32 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)); | |
| 33 {% endfor %} | |
| 34 {% if constants %}{# In general more checks than just constants #} | |
| 31 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); | 35 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); |
| 32 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); | 36 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); |
| 33 UNUSED_PARAM(instance); | 37 UNUSED_PARAM(instance); |
| 34 UNUSED_PARAM(proto); | 38 UNUSED_PARAM(proto); |
| 35 {% endif %} | 39 {% endif %} |
| 36 {% if constants %} | 40 {% if constants %} |
| 37 {{install_constants() | indent}} | 41 {{install_constants() | indent}} |
| 38 {% endif %} | 42 {% endif %} |
| 39 | 43 |
| 40 // Custom toString template | 44 // Custom toString template |
| 41 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to StringTemplate()); | 45 desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->to StringTemplate()); |
| 42 return desc; | 46 return desc; |
| 43 } | 47 } |
| 44 | 48 |
| 45 {% endblock %} | 49 {% endblock %} |
| 46 | 50 |
| 47 | 51 |
| 48 {######################################} | 52 {######################################} |
| 49 {% macro install_constants() %} | 53 {% macro install_constants() %} |
| 50 {# FIXME: should use reflected_name instead of name #} | 54 {# FIXME: should use reflected_name instead of name #} |
| 51 {# Normal (always enabled) constants #} | 55 {# Normal (always enabled) constants #} |
| 52 static const V8DOMConfiguration::ConstantConfiguration {{v8_class_name}}Constant s[] = { | 56 static const V8DOMConfiguration::ConstantConfiguration {{v8_class_name}}Constant s[] = { |
| 53 {% for constant in constants if not constant.enabled_at_runtime %} | 57 {% for constant in constants if not constant.enabled_at_runtime %} |
| 54 {"{{constant.name}}", {{constant.value}}}, | 58 {"{{constant.name}}", {{constant.value}}}, |
| 55 {% endfor %} | 59 {% endfor %} |
| 56 }; | 60 }; |
| 57 V8DOMConfiguration::installConstants(desc, proto, {{v8_class_name}}Constants, WT F_ARRAY_LENGTH({{v8_class_name}}Constants), isolate); | 61 V8DOMConfiguration::installConstants(desc, proto, {{v8_class_name}}Constants, WT F_ARRAY_LENGTH({{v8_class_name}}Constants), isolate); |
| 58 {# Runtime-enabled constants #} | 62 {# Runtime-enabled constants #} |
| 59 {% for constant in constants if constant.enabled_at_runtime %} | 63 {% for constant in constants if constant.enabled_at_runtime %} |
| 60 if ({{constant.runtime_enable_function_name}}()) { | 64 if ({{constant.runtime_enable_function_name}}()) { |
| 61 static const V8DOMConfiguration::ConstantConfiguration constantConfiguration = {"{{constant.name}}", static_cast<signed int>({{constant.value}})}; | 65 static const V8DOMConfiguration::ConstantConfiguration constantConfiguration = {"{{constant.name}}", static_cast<signed int>({{constant.value}})}; |
| 62 V8DOMConfiguration::installConstants(desc, proto, &constantConfiguration, 1, isolate); | 66 V8DOMConfiguration::installConstants(desc, proto, &constantConfiguration, 1, isolate); |
| 63 } | 67 } |
| 64 {% endfor %} | 68 {% endfor %} |
| 65 {# Check constants #} | 69 {# 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); | 134 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &info, wra pper, isolate, WrapperConfiguration::Independent); |
| 131 return wrapper; | 135 return wrapper; |
| 132 } | 136 } |
| 133 | 137 |
| 134 void {{v8_class_name}}::derefObject(void* object) | 138 void {{v8_class_name}}::derefObject(void* object) |
| 135 { | 139 { |
| 136 fromInternalPointer(object)->deref(); | 140 fromInternalPointer(object)->deref(); |
| 137 } | 141 } |
| 138 | 142 |
| 139 {% endblock %} | 143 {% endblock %} |
| OLD | NEW |