Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 {% set getter_callback = | 6 {% set getter_callback = |
| 7 '%sV8Internal::%sAttributeGetterCallback' % | 7 '%sV8Internal::%sAttributeGetterCallback' % |
| 8 (cpp_class, attribute.name) | 8 (cpp_class, attribute.name) |
| 9 if not attribute.constructor_type else | 9 if not attribute.constructor_type else |
| 10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} | 10 '{0}V8Internal::{0}ConstructorGetter'.format(interface_name) %} |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 { | 91 { |
| 92 {{cpp_class}}* imp = {{v8_class}}::toNative(host); | 92 {{cpp_class}}* imp = {{v8_class}}::toNative(host); |
| 93 return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe curityError); | 93 return BindingSecurity::shouldAllowAccessToFrame(imp->frame(), DoNotReportSe curityError); |
| 94 } | 94 } |
| 95 | 95 |
| 96 {% endif %} | 96 {% endif %} |
| 97 {% endblock %} | 97 {% endblock %} |
| 98 | 98 |
| 99 | 99 |
| 100 {##############################################################################} | 100 {##############################################################################} |
| 101 {% block anonymous_indexed_property_getter_and_callback %} | |
| 102 {% if anonymous_indexed_property_getter %} | |
| 103 {% set getter = anonymous_indexed_property_getter %} | |
| 104 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) | |
| 105 { | |
| 106 ASSERT(V8DOMWrapper::maybeDOMWrapper(info.Holder())); | |
|
haraken
2014/01/27 06:35:32
You can remove this. It's guaranteed that info.Hol
Nils Barth (inactive)
2014/01/27 06:59:35
Got it, posted CL:
Remove unnecessary maybeDOMWrap
| |
| 107 {{cpp_class}}* collection = {{v8_class}}::toNative(info.Holder()); | |
| 108 {{getter.cpp_type}} element = collection->{{getter.name}}(index); | |
| 109 if ({{getter.is_null_expression}}) | |
| 110 return; | |
| 111 {{getter.v8_set_return_value}}; | |
| 112 } | |
| 113 | |
| 114 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall backInfo<v8::Value>& info) | |
| 115 { | |
| 116 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | |
| 117 {{cpp_class}}V8Internal::indexedPropertyGetter(index, info); | |
| 118 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
| 119 } | |
| 120 | |
| 121 {% endif %} | |
| 122 {% endblock %} | |
| 123 | |
| 124 | |
| 125 {##############################################################################} | |
| 101 {% block origin_safe_method_setter %} | 126 {% block origin_safe_method_setter %} |
| 102 {% if has_origin_safe_method_setter %} | 127 {% if has_origin_safe_method_setter %} |
| 103 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::String> name, v8:: Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) | 128 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::String> name, v8:: Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) |
| 104 { | 129 { |
| 105 {# FIXME: don't call GetIsolate 3 times #} | 130 {# FIXME: don't call GetIsolate 3 times #} |
| 106 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{ v8_class}}::domTemplate(info.GetIsolate(), worldType(info.GetIsolate()))); | 131 v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain({{ v8_class}}::domTemplate(info.GetIsolate(), worldType(info.GetIsolate()))); |
| 107 if (holder.IsEmpty()) | 132 if (holder.IsEmpty()) |
| 108 return; | 133 return; |
| 109 {{cpp_class}}* imp = {{v8_class}}::toNative(holder); | 134 {{cpp_class}}* imp = {{v8_class}}::toNative(holder); |
| 110 v8::String::Utf8Value attributeName(name); | 135 v8::String::Utf8Value attributeName(name); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 if ({{attribute.runtime_enabled_function}}()) { | 482 if ({{attribute.runtime_enabled_function}}()) { |
| 458 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ | 483 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ |
| 459 {{attribute_configuration(attribute)}}; | 484 {{attribute_configuration(attribute)}}; |
| 460 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate, currentWorldType); | 485 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate, currentWorldType); |
| 461 } | 486 } |
| 462 {% endfilter %} | 487 {% endfilter %} |
| 463 {% endfor %} | 488 {% endfor %} |
| 464 {% if constants %} | 489 {% if constants %} |
| 465 {{install_constants() | indent}} | 490 {{install_constants() | indent}} |
| 466 {% endif %} | 491 {% endif %} |
| 492 {% if anonymous_indexed_property_getter %} | |
| 493 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler({{cpp_class} }V8Internal::indexedPropertyGetterCallback, 0, 0, 0, indexedPropertyEnumerator<{ {cpp_class}}>); | |
| 494 {% endif %} | |
| 467 {% if has_custom_legacy_call_as_function %} | 495 {% if has_custom_legacy_call_as_function %} |
| 468 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom); | 496 functionTemplate->InstanceTemplate()->SetCallAsFunctionHandler({{v8_class}}: :legacyCallCustom); |
| 469 {% endif %} | 497 {% endif %} |
| 470 {% if interface_name == 'HTMLAllCollection' %} | 498 {% if interface_name == 'HTMLAllCollection' %} |
| 471 {# Needed for legacy support of document.all #} | 499 {# Needed for legacy support of document.all #} |
| 472 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); | 500 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); |
| 473 {% endif %} | 501 {% endif %} |
| 474 {% for method in methods if not method.do_not_check_signature %} | 502 {% for method in methods if not method.do_not_check_signature %} |
| 475 {# install_custom_signature #} | 503 {# install_custom_signature #} |
| 476 {% if not method.overload_index or method.overload_index == 1 %} | 504 {% if not method.overload_index or method.overload_index == 1 %} |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 758 fromInternalPointer(object)->deref(); | 786 fromInternalPointer(object)->deref(); |
| 759 } | 787 } |
| 760 | 788 |
| 761 template<> | 789 template<> |
| 762 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) | 790 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) |
| 763 { | 791 { |
| 764 return toV8(impl, creationContext, isolate); | 792 return toV8(impl, creationContext, isolate); |
| 765 } | 793 } |
| 766 | 794 |
| 767 {% endblock %} | 795 {% endblock %} |
| OLD | NEW |