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

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: Revised Created 7 years, 2 months 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 {# Constructor attributes use ReplaceableAttributeSetter as an interface-level s etter #}
haraken 2013/10/24 09:13:54 Thanks, I understood the situation. Both replaceab
Nils Barth (inactive) 2013/10/24 09:41:51 Will do in quick followup CL (b/c generated code a
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
17 static void {{interface_name}}ReplaceableAttributeSetterCallback(v8::Local<v8::S tring> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 35 static void {{interface_name}}ReplaceableAttributeSetterCallback(v8::Local<v8::S tring> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
18 { 36 {
19 {{interface_name}}V8Internal::{{interface_name}}ReplaceableAttributeSetter(n ame, jsValue, info); 37 {{interface_name}}V8Internal::{{interface_name}}ReplaceableAttributeSetter(n ame, jsValue, info);
20 } 38 }
21 39
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &info, wra pper, isolate, WrapperConfiguration::Independent); 206 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &info, wra pper, isolate, WrapperConfiguration::Independent);
189 return wrapper; 207 return wrapper;
190 } 208 }
191 209
192 void {{v8_class_name}}::derefObject(void* object) 210 void {{v8_class_name}}::derefObject(void* object)
193 { 211 {
194 fromInternalPointer(object)->deref(); 212 fromInternalPointer(object)->deref();
195 } 213 }
196 214
197 {% endblock %} 215 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698