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

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

Issue 23068032: Add constants and primitive type readonly attributes to Python IDL compiler (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix spacing Created 7 years, 4 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
(Empty)
1 {% macro attribute_getter(attribute) %}
2 static void {{attribute.name}}AttributeGetter(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info)
3 {
4 {{cpp_class_name}}* imp = {{v8_class_name}}::toNative(info.Holder());
5 {% if attribute.should_keep_attribute_alive %}
6 {{attribute.cpp_type}} result = imp->{{attribute.cpp_method_name}}();
7 if (result.get() && DOMDataStore::setReturnValueFromWrapper<{{attribute.v8_t ype}}>(info.GetReturnValue(), result.get()))
8 return;
9 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIs olate());
10 if (!wrapper.IsEmpty()) {
11 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "{{attribut e.name}}", wrapper);
12 v8SetReturnValue(info, wrapper);
13 }
14 {% else %}
15 {{attribute.return_v8_value_statement | indent}}
16 {% endif %}
17 return;
18 }
19 {% endmacro %}
20
21
22 {##############################################################################}
23 {% macro attribute_getter_callback(attribute) %}
24 static void {{attribute.name}}AttributeGetterCallback(v8::Local<v8::String> name , const v8::PropertyCallbackInfo<v8::Value>& info)
25 {
26 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
27 {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeGetter(name, info);
28 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
29 }
30 {% endmacro %}
31
32
33 {##############################################################################}
34 {% macro class_attributes() %}
haraken 2013/08/26 09:33:40 Where is install_attributes() or something like th
Nils Barth (inactive) 2013/08/27 02:59:27 V8DOMConfiguration::installAttributes is only call
35 static const V8DOMConfiguration::AttributeConfiguration {{v8_class_name}}Attribu tes[] = {
36 {% for attribute in attributes %}
37 {"{{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 */},
38 {% endfor %}
39 };
40 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698