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

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

Issue 17572008: WIP IDL compiler rewrite (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Branch: const + primitive type readonly attributes 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
« no previous file with comments | « Source/bindings/scripts/v8_values.py ('k') | Source/bindings/templates/attributes_wip.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 {% macro attribute_getter(attribute) %}
2 static void {{attribute.name}}AttrGetter(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<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 v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMData Store::getWrapper<{{attribute.v8_type}}>(result.get(), info.GetIsolate())) : v8U ndefined();
8 if (wrapper.IsEmpty()) {
9 wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
10 if (!wrapper.IsEmpty())
11 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "{{attr ibute.name}}", wrapper);
12 }
13 v8SetReturnValue(info, wrapper);
14 return;
15 {% else %}
16 {{attribute.return_js_value_statement | indent}}
17 return;
18 {% endif %}
19 }
20
21 {% endmacro %}
22
23
24 {##############################################################################}
25 {% macro attribute_getter_callback(attribute) %}
26 static void {{attribute.name}}AttrGetterCallback(v8::Local<v8::String> name, con st v8::PropertyCallbackInfo<v8::Value>& info)
27 {
28 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
29 {{cpp_class_name}}V8Internal::{{attribute.name}}AttrGetter(name, info);
30 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
31 }
32
33 {% endmacro %}
34
35
36 {##############################################################################}
37 {# FIXME: instead pass a list of normal_attributes #}
38 {% macro batched_attribute() %}
39 static const V8DOMConfiguration::BatchedAttribute {{v8_class_name}}Attrs[] = {
40 {% for attribute in attributes %}
41 // Attribute '{{attribute.name}}'
42 {"{{attribute.name}}", {{cpp_class_name}}V8Internal::{{attribute.name}}AttrG etterCallback, 0, 0, 0, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFA ULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
43 {% endfor %}
44 };
45 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_values.py ('k') | Source/bindings/templates/attributes_wip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698