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: Source/bindings/templates/interface.cpp

Issue 39493002: IDL compiler: void() methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revised Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 {% extends 'interface_base.cpp' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro attribute_configuration(attribute) %} 5 {% macro attribute_configuration(attribute) %}
6 {"{{attribute.name}}", {{attribute.getter_callback_name}}, {{attribute.setter_ca llback_name}}, {{attribute.getter_callback_name_for_main_world}}, {{attribute.se tter_callback_name_for_main_world}}, {{attribute.wrapper_type_info}}, static_cas t<v8::AccessControl>({{attribute.access_control_list | join(' | ')}}), static_ca st<v8::PropertyAttribute>({{attribute.property_attributes | join(' | ')}}), 0 /* on instance */}{% endmacro %} 6 {"{{attribute.name}}", {{attribute.getter_callback_name}}, {{attribute.setter_ca llback_name}}, {{attribute.getter_callback_name_for_main_world}}, {{attribute.se tter_callback_name_for_main_world}}, {{attribute.wrapper_type_info}}, static_cas t<v8::AccessControl>({{attribute.access_control_list | join(' | ')}}), static_ca st<v8::PropertyAttribute>({{attribute.property_attributes | join(' | ')}}), 0 /* on instance */}
7 {%- endmacro %}
7 8
8 9
9 {##############################################################################} 10 {##############################################################################}
11 {% macro method_configuration(method) %}
12 {"{{method.name}}", {{interface_name}}V8Internal::{{method.name}}MethodCallback, 0, 0}
13 {%- endmacro %}
14
15
16 {##############################################################################}
10 {% block constructor_getter %} 17 {% block constructor_getter %}
11 {% if has_constructor_attributes %} 18 {% if has_constructor_attributes %}
12 static void {{interface_name}}ConstructorGetter(v8::Local<v8::String> name, cons t v8::PropertyCallbackInfo<v8::Value>& info) 19 static void {{interface_name}}ConstructorGetter(v8::Local<v8::String> name, cons t v8::PropertyCallbackInfo<v8::Value>& info)
13 { 20 {
14 v8::Handle<v8::Value> data = info.Data(); 21 v8::Handle<v8::Value> data = info.Data();
15 ASSERT(data->IsExternal()); 22 ASSERT(data->IsExternal());
16 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext()); 23 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext());
17 if (!perContextData) 24 if (!perContextData)
18 return; 25 return;
19 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data))); 26 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data)));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 {{attribute_configuration(attribute)}}, 62 {{attribute_configuration(attribute)}},
56 {% endfilter %} 63 {% endfilter %}
57 {% endfor %} 64 {% endfor %}
58 }; 65 };
59 66
60 {% endif %} 67 {% endif %}
61 {% endblock %} 68 {% endblock %}
62 69
63 70
64 {##############################################################################} 71 {##############################################################################}
72 {% block class_methods %}
73 {# FIXME: rename to install_methods and put into configure_class_template #}
74 {% if methods %}
75 static const V8DOMConfiguration::MethodConfiguration {{v8_class_name}}Methods[] = {
76 {% for method in methods %}
77 {{method_configuration(method)}},
78 {% endfor %}
79 };
80
81 {% endif %}
82 {% endblock %}
83
84
85 {##############################################################################}
65 {% block configure_class_template %} 86 {% block configure_class_template %}
66 {# FIXME: rename to install_dom_template and Install{{v8_class_name}}DOMTemplate #} 87 {# FIXME: rename to install_dom_template and Install{{v8_class_name}}DOMTemplate #}
67 static v8::Handle<v8::FunctionTemplate> Configure{{v8_class_name}}Template(v8::H andle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType current WorldType) 88 static v8::Handle<v8::FunctionTemplate> Configure{{v8_class_name}}Template(v8::H andle<v8::FunctionTemplate> desc, v8::Isolate* isolate, WrapperWorldType current WorldType)
68 { 89 {
69 desc->ReadOnlyPrototype(); 90 desc->ReadOnlyPrototype();
70 91
71 v8::Local<v8::Signature> defaultSignature; 92 v8::Local<v8::Signature> defaultSignature;
72 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "{{inte rface_name}}", v8::Local<v8::FunctionTemplate>(), {{v8_class_name}}::internalFie ldCount, 93 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(desc, "{{inte rface_name}}", v8::Local<v8::FunctionTemplate>(), {{v8_class_name}}::internalFie ldCount,
73 {{installed_attributes}}, {{number_of_attributes}}, 94 {{installed_attributes}}, {{number_of_attributes}},
74 0, 0, isolate, currentWorldType); 95 {{installed_methods}}, {{number_of_methods}}, isolate, currentWorldType) ;
75 UNUSED_PARAM(defaultSignature); 96 UNUSED_PARAM(defaultSignature);
76 {% if constants or has_runtime_enabled_attributes %} 97 {% if constants or has_runtime_enabled_attributes %}
77 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); 98 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
78 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); 99 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
79 UNUSED_PARAM(instance); 100 UNUSED_PARAM(instance);
80 UNUSED_PARAM(proto); 101 UNUSED_PARAM(proto);
81 {% endif %} 102 {% endif %}
82 {% for attribute in attributes if attribute.runtime_enabled_function_name %} 103 {% for attribute in attributes if attribute.runtime_enabled_function_name %}
83 {% filter conditional(attribute.conditional_string) %} 104 {% filter conditional(attribute.conditional_string) %}
84 if ({{attribute.runtime_enabled_function_name}}()) { 105 if ({{attribute.runtime_enabled_function_name}}()) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &wrapperTy peInfo, wrapper, isolate, WrapperConfiguration::Independent); 228 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &wrapperTy peInfo, wrapper, isolate, WrapperConfiguration::Independent);
208 return wrapper; 229 return wrapper;
209 } 230 }
210 231
211 void {{v8_class_name}}::derefObject(void* object) 232 void {{v8_class_name}}::derefObject(void* object)
212 { 233 {
213 fromInternalPointer(object)->deref(); 234 fromInternalPointer(object)->deref();
214 } 235 }
215 236
216 {% endblock %} 237 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/unstable/v8_methods.py ('k') | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698