Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: Source/bindings/templates/interface.cpp

Issue 36793003: IDL compiler: constructor attributes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased 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}}, 0, static_cast<v8::AccessControl>({{attribu te.access_control_list | join(' | ')}}), static_cast<v8::PropertyAttribute>({{at tribute.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 */}{% endmacro %}
7
8
9 {##############################################################################}
10 {% block constructor_getter %}
11 {% if has_constructor_attributes %}
12 static void {{interface_name}}ConstructorGetter(v8::Local<v8::String> name, cons t v8::PropertyCallbackInfo<v8::Value>& info)
13 {
14 v8::Handle<v8::Value> data = info.Data();
15 ASSERT(data->IsExternal());
16 V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->Cre ationContext());
17 if (!perContextData)
18 return;
19 v8SetReturnValue(info, perContextData->constructorForType(WrapperTypeInfo::u nwrap(data)));
20 }
21
22 {% endif %}
23 {% endblock %}
7 24
8 25
9 {##############################################################################} 26 {##############################################################################}
10 {% block replaceable_attribute_setter_and_callback %} 27 {% block replaceable_attribute_setter_and_callback %}
11 {% if has_replaceable_attributes %} 28 {% if has_replaceable_attributes or has_constructor_attributes %}
29 {# FIXME: rename to ForceSetAttributeOnThis, since also used for Constructors #}
12 static void {{interface_name}}ReplaceableAttributeSetter(v8::Local<v8::String> n ame, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 30 static void {{interface_name}}ReplaceableAttributeSetter(v8::Local<v8::String> n ame, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
13 { 31 {
14 info.This()->ForceSet(name, jsValue); 32 info.This()->ForceSet(name, jsValue);
15 } 33 }
16 34
35 {# FIXME: rename to ForceSetAttributeOnThisCallback, since also used for Constru ctors #}
17 static void {{interface_name}}ReplaceableAttributeSetterCallback(v8::Local<v8::S tring> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 36 static void {{interface_name}}ReplaceableAttributeSetterCallback(v8::Local<v8::S tring> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
18 { 37 {
19 {{interface_name}}V8Internal::{{interface_name}}ReplaceableAttributeSetter(n ame, jsValue, info); 38 {{interface_name}}V8Internal::{{interface_name}}ReplaceableAttributeSetter(n ame, jsValue, info);
20 } 39 }
21 40
22 {% endif %} 41 {% endif %}
23 {% endblock %} 42 {% endblock %}
24 43
25 44
26 {##############################################################################} 45 {##############################################################################}
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &info, wra pper, isolate, WrapperConfiguration::Independent); 207 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &info, wra pper, isolate, WrapperConfiguration::Independent);
189 return wrapper; 208 return wrapper;
190 } 209 }
191 210
192 void {{v8_class_name}}::derefObject(void* object) 211 void {{v8_class_name}}::derefObject(void* object)
193 { 212 {
194 fromInternalPointer(object)->deref(); 213 fromInternalPointer(object)->deref();
195 } 214 }
196 215
197 {% endblock %} 216 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/unstable/v8_utilities.py ('k') | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698