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

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: Simpler loop 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.data}}, static_cast<v8::AccessC ontrol>({{attribute.access_control_list | join(' | ')}}), static_cast<v8::Proper tyAttribute>({{attribute.property_attributes | join(' | ')}}), 0 /* on instance */}{% endmacro %}
7
8
9 {##############################################################################}
10 {% block constructor_getter %}
11 {% if has_constructor_getter %}
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;
haraken 2013/10/24 03:33:03 Not related to your CL, I'd guess this should be A
Nils Barth (inactive) 2013/10/24 05:33:03 Will do!
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_constructor_getters or has_replaceable_attributes %}
haraken 2013/10/24 03:33:03 This looks strange. Why do we need to generate Rep
Nils Barth (inactive) 2013/10/24 05:33:03 This is strange, but it is used. Fixing this would
12 static void {{interface_name}}ReplaceableAttributeSetter(v8::Local<v8::String> n ame, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 29 static void {{interface_name}}ReplaceableAttributeSetter(v8::Local<v8::String> n ame, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
13 { 30 {
14 info.This()->ForceSet(name, jsValue); 31 info.This()->ForceSet(name, jsValue);
15 } 32 }
16 33
17 static void {{interface_name}}ReplaceableAttributeSetterCallback(v8::Local<v8::S tring> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) 34 static void {{interface_name}}ReplaceableAttributeSetterCallback(v8::Local<v8::S tring> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
18 { 35 {
19 {{interface_name}}V8Internal::{{interface_name}}ReplaceableAttributeSetter(n ame, jsValue, info); 36 {{interface_name}}V8Internal::{{interface_name}}ReplaceableAttributeSetter(n ame, jsValue, info);
20 } 37 }
21 38
(...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); 205 V8DOMWrapper::associateObjectWithWrapper<{{v8_class_name}}>(impl, &info, wra pper, isolate, WrapperConfiguration::Independent);
189 return wrapper; 206 return wrapper;
190 } 207 }
191 208
192 void {{v8_class_name}}::derefObject(void* object) 209 void {{v8_class_name}}::derefObject(void* object)
193 { 210 {
194 fromInternalPointer(object)->deref(); 211 fromInternalPointer(object)->deref();
195 } 212 }
196 213
197 {% endblock %} 214 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698