Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 {% macro attribute_getter(attribute) %} | |
|
haraken
2013/08/22 07:31:33
attribute_getter => define_attribute_getter
Nils Barth (inactive)
2013/08/22 09:08:13
For functions, I agree that verb names are better,
| |
| 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_return_keep_property_alive(attribute) | indent}} | |
| 7 {% else %} | |
| 8 {{attribute.return_js_value_statement | indent}} | |
| 9 {% endif %} | |
| 10 return; | |
| 11 } | |
| 12 | |
| 13 {% endmacro %} | |
| 14 | |
| 15 | |
| 16 {##############################################################################} | |
| 17 {% macro attribute_return_keep_property_alive(attribute) %} | |
|
haraken
2013/08/22 07:31:33
attribute_return_keep_property_alive => keep_attri
Nils Barth (inactive)
2013/08/22 09:08:13
For these block templates, I'm not sure how to nam
| |
| 18 {{attribute.cpp_type}} result = imp->{{attribute.cpp_method_name}}(); | |
| 19 if (result.get() && DOMDataStore::setReturnValueFromWrapper<{{attribute.v8_type} }>(info.GetReturnValue(), result.get())) | |
| 20 return; | |
| 21 v8::Handle<v8::Value> wrapper = toV8(result.get(), info.Holder(), info.GetIsolat e()); | |
| 22 if (!wrapper.IsEmpty()) { | |
| 23 V8HiddenPropertyName::setNamedHiddenReference(info.Holder(), "{{attribute.na me}}", wrapper); | |
| 24 v8SetReturnValue(info, wrapper); | |
| 25 } | |
| 26 {% endmacro %} | |
| 27 | |
| 28 | |
| 29 {##############################################################################} | |
| 30 {% macro attribute_getter_callback(attribute) %} | |
|
haraken
2013/08/22 07:31:33
attribute_getter_callback => define_attribute_gett
Nils Barth (inactive)
2013/08/22 09:08:13
(As above, declarative template, not function.)
| |
| 31 static void {{attribute.name}}AttrGetterCallback(v8::Local<v8::String> name, con st v8::PropertyCallbackInfo<v8::Value>& info) | |
| 32 { | |
| 33 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); | |
| 34 {{cpp_class_name}}V8Internal::{{attribute.name}}AttrGetter(name, info); | |
| 35 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); | |
| 36 } | |
| 37 | |
| 38 {% endmacro %} | |
| 39 | |
| 40 | |
| 41 {##############################################################################} | |
| 42 {% macro batched_attribute() %} | |
|
haraken
2013/08/22 07:31:33
batched_attribute => install_attributes
"Batched"
Nils Barth (inactive)
2013/08/22 09:08:13
I'm naming the macros after what they define (per
haraken
2013/08/22 11:05:28
I'm suggesting naming everything consistently. For
Nils Barth (inactive)
2013/08/23 01:50:05
Got it, will change in Perl first, then update thi
| |
| 43 static const V8DOMConfiguration::BatchedAttribute {{v8_class_name}}Attrs[] = { | |
|
haraken
2013/08/22 07:31:33
{{v8_class_name}}Attrs[] => {{v8_class_name}}Attri
Nils Barth (inactive)
2013/08/22 09:08:13
(Perl compatibility.)
| |
| 44 {% for attribute in attributes %} | |
| 45 // Attribute '{{attribute.name}}' | |
|
haraken
2013/08/22 07:31:33
You can remove this comment.
Nils Barth (inactive)
2013/08/22 09:08:13
(Perl compatibility.)
| |
| 46 {"{{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 */}, | |
|
haraken
2013/08/22 07:31:33
You can remove /*no data*/. It isn't helpful.
Nils Barth (inactive)
2013/08/22 09:08:13
(Perl compatibility.)
| |
| 47 {% endfor %} | |
| 48 }; | |
| 49 {% endmacro %} | |
| OLD | NEW |