| OLD | NEW |
| 1 {% extends 'interface_base.cpp' %} | 1 {% extends 'interface_base.cpp' %} |
| 2 | 2 |
| 3 | 3 |
| 4 {##############################################################################} | 4 {##############################################################################} |
| 5 {% block indexed_property_getter %} | 5 {% block indexed_property_getter %} |
| 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} | 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} |
| 7 {% set getter = indexed_property_getter %} | 7 {% set getter = indexed_property_getter %} |
| 8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | 8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) |
| 9 { | 9 { |
| 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| (...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); | 757 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); |
| 758 RELEASE_ASSERT(wrapperTypeInfo); | 758 RELEASE_ASSERT(wrapperTypeInfo); |
| 759 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); | 759 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); |
| 760 return toScriptWrappable(object)->toImpl<{{cpp_class}}>(); | 760 return toScriptWrappable(object)->toImpl<{{cpp_class}}>(); |
| 761 } | 761 } |
| 762 | 762 |
| 763 // Transfer the ownership of the allocated memory to an {{interface_name}} w
ithout | 763 // Transfer the ownership of the allocated memory to an {{interface_name}} w
ithout |
| 764 // copying. | 764 // copying. |
| 765 v8::{{interface_name}}::Contents v8Contents = v8buffer->Externalize(); | 765 v8::{{interface_name}}::Contents v8Contents = v8buffer->Externalize(); |
| 766 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength()
, WTF::ArrayBufferContents::{% if interface_name == 'ArrayBuffer' %}Not{% endif
%}Shared); | 766 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength()
, WTF::ArrayBufferContents::{% if interface_name == 'ArrayBuffer' %}Not{% endif
%}Shared); |
| 767 {{cpp_class}}* buffer = {{cpp_class}}::create(contents); | 767 RefPtr<{{cpp_class}}> buffer = {{cpp_class}}::create(contents); |
| 768 v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::I
solate::GetCurrent(), buffer->wrapperTypeInfo(), object); | 768 v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::I
solate::GetCurrent(), buffer->wrapperTypeInfo(), object); |
| 769 ASSERT_UNUSED(associatedWrapper, associatedWrapper == object); | 769 ASSERT_UNUSED(associatedWrapper, associatedWrapper == object); |
| 770 | 770 |
| 771 return buffer; | 771 return buffer.get(); |
| 772 } | 772 } |
| 773 | 773 |
| 774 {% elif interface_name == 'ArrayBufferView' %} | 774 {% elif interface_name == 'ArrayBufferView' %} |
| 775 {{cpp_class}}* V8ArrayBufferView::toImpl(v8::Local<v8::Object> object) | 775 {{cpp_class}}* V8ArrayBufferView::toImpl(v8::Local<v8::Object> object) |
| 776 { | 776 { |
| 777 ASSERT(object->IsArrayBufferView()); | 777 ASSERT(object->IsArrayBufferView()); |
| 778 ScriptWrappable* scriptWrappable = toScriptWrappable(object); | 778 ScriptWrappable* scriptWrappable = toScriptWrappable(object); |
| 779 if (scriptWrappable) | 779 if (scriptWrappable) |
| 780 return scriptWrappable->toImpl<{{cpp_class}}>(); | 780 return scriptWrappable->toImpl<{{cpp_class}}>(); |
| 781 | 781 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 807 {% elif is_array_buffer_or_view %} | 807 {% elif is_array_buffer_or_view %} |
| 808 {{cpp_class}}* {{v8_class}}::toImpl(v8::Local<v8::Object> object) | 808 {{cpp_class}}* {{v8_class}}::toImpl(v8::Local<v8::Object> object) |
| 809 { | 809 { |
| 810 ASSERT(object->Is{{interface_name}}()); | 810 ASSERT(object->Is{{interface_name}}()); |
| 811 ScriptWrappable* scriptWrappable = toScriptWrappable(object); | 811 ScriptWrappable* scriptWrappable = toScriptWrappable(object); |
| 812 if (scriptWrappable) | 812 if (scriptWrappable) |
| 813 return scriptWrappable->toImpl<{{cpp_class}}>(); | 813 return scriptWrappable->toImpl<{{cpp_class}}>(); |
| 814 | 814 |
| 815 v8::Local<v8::{{interface_name}}> v8View = object.As<v8::{{interface_name}}>
(); | 815 v8::Local<v8::{{interface_name}}> v8View = object.As<v8::{{interface_name}}>
(); |
| 816 v8::Local<v8::Object> arrayBuffer = v8View->Buffer(); | 816 v8::Local<v8::Object> arrayBuffer = v8View->Buffer(); |
| 817 {{cpp_class}}* typedArray = nullptr; | 817 RefPtr<{{cpp_class}}> typedArray; |
| 818 if (arrayBuffer->IsArrayBuffer()) { | 818 if (arrayBuffer->IsArrayBuffer()) { |
| 819 typedArray = {{cpp_class}}::create(V8ArrayBuffer::toImpl(arrayBuffer), v
8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %
}Length()); | 819 typedArray = {{cpp_class}}::create(V8ArrayBuffer::toImpl(arrayBuffer), v
8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %
}Length()); |
| 820 } else if (arrayBuffer->IsSharedArrayBuffer()) { | 820 } else if (arrayBuffer->IsSharedArrayBuffer()) { |
| 821 typedArray = {{cpp_class}}::create(V8SharedArrayBuffer::toImpl(arrayBuff
er), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% e
ndif %}Length()); | 821 typedArray = {{cpp_class}}::create(V8SharedArrayBuffer::toImpl(arrayBuff
er), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% e
ndif %}Length()); |
| 822 } else { | 822 } else { |
| 823 ASSERT_NOT_REACHED(); | 823 ASSERT_NOT_REACHED(); |
| 824 } | 824 } |
| 825 v8::Local<v8::Object> associatedWrapper = typedArray->associateWithWrapper(v
8::Isolate::GetCurrent(), typedArray->wrapperTypeInfo(), object); | 825 v8::Local<v8::Object> associatedWrapper = typedArray->associateWithWrapper(v
8::Isolate::GetCurrent(), typedArray->wrapperTypeInfo(), object); |
| 826 ASSERT_UNUSED(associatedWrapper, associatedWrapper == object); | 826 ASSERT_UNUSED(associatedWrapper, associatedWrapper == object); |
| 827 | 827 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 | 952 |
| 953 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} | 953 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} |
| 954 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) | 954 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
| 955 { | 955 { |
| 956 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; | 956 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; |
| 957 } | 957 } |
| 958 | 958 |
| 959 {% endfor %} | 959 {% endfor %} |
| 960 {% endif %} | 960 {% endif %} |
| 961 {% endblock %} | 961 {% endblock %} |
| OLD | NEW |