OLD | NEW |
(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 %} |
OLD | NEW |