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 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<{{v8_class
}}>(impl.get(), isolate); | 721 v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapper<{{v8_class
}}>(impl.get(), isolate); |
722 if (!wrapper.IsEmpty()) | 722 if (!wrapper.IsEmpty()) |
723 return wrapper; | 723 return wrapper; |
724 } | 724 } |
725 } | 725 } |
726 {% endif %} | 726 {% endif %} |
727 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | 727 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); |
728 if (UNLIKELY(wrapper.IsEmpty())) | 728 if (UNLIKELY(wrapper.IsEmpty())) |
729 return wrapper; | 729 return wrapper; |
730 | 730 |
| 731 {% if is_audio_buffer %} |
| 732 {# We only setDeallocationObservers on array buffers that are held by some |
| 733 object in the V8 heap, not in the ArrayBuffer constructor itself. |
| 734 This is because V8 GC only cares about memory it can free on GC, and |
| 735 until the object is exposed to JavaScript, V8 GC doesn't affect it. #} |
| 736 for (unsigned i = 0, n = impl->numberOfChannels(); i < n; i++) { |
| 737 Float32Array* channelData = impl->getChannelData(i); |
| 738 channelData->buffer()->setDeallocationObserver(V8ArrayBufferDeallocation
Observer::instanceTemplate()); |
| 739 } |
| 740 {% endif %} |
731 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | 741 installPerContextEnabledProperties(wrapper, impl.get(), isolate); |
732 {% set wrapper_configuration = 'WrapperConfiguration::Dependent' | 742 {% set wrapper_configuration = 'WrapperConfiguration::Dependent' |
733 if (has_visit_dom_wrapper or | 743 if (has_visit_dom_wrapper or |
734 is_active_dom_object or | 744 is_active_dom_object or |
735 is_dependent_lifetime) else | 745 is_dependent_lifetime) else |
736 'WrapperConfiguration::Independent' %} | 746 'WrapperConfiguration::Independent' %} |
737 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl, &wrapperTypeInf
o, wrapper, isolate, {{wrapper_configuration}}); | 747 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl, &wrapperTypeInf
o, wrapper, isolate, {{wrapper_configuration}}); |
738 return wrapper; | 748 return wrapper; |
739 } | 749 } |
740 | 750 |
741 {% endif %} | 751 {% endif %} |
742 {% endblock %} | 752 {% endblock %} |
743 | 753 |
744 | 754 |
745 {##############################################################################} | 755 {##############################################################################} |
746 {% block deref_object_and_to_v8_no_inline %} | 756 {% block deref_object_and_to_v8_no_inline %} |
747 void {{v8_class}}::derefObject(void* object) | 757 void {{v8_class}}::derefObject(void* object) |
748 { | 758 { |
749 fromInternalPointer(object)->deref(); | 759 fromInternalPointer(object)->deref(); |
750 } | 760 } |
751 | 761 |
752 template<> | 762 template<> |
753 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | 763 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
754 { | 764 { |
755 return toV8(impl, creationContext, isolate); | 765 return toV8(impl, creationContext, isolate); |
756 } | 766 } |
757 | 767 |
758 {% endblock %} | 768 {% endblock %} |
OLD | NEW |