Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 {% extends 'interface_base.cpp.tmpl' %} | 1 {% extends 'interface_base.cpp.tmpl' %} |
| 2 | 2 |
| 3 {% set has_prepare_prototype_and_interface_object = | 3 {% set has_prepare_prototype_and_interface_object = |
| 4 unscopables or has_conditional_attributes_on_prototype or | 4 unscopables or has_conditional_attributes_on_prototype or |
| 5 methods | conditionally_exposed(is_partial) %} | 5 methods | conditionally_exposed(is_partial) %} |
| 6 {% set prepare_prototype_and_interface_object_func = | 6 {% set prepare_prototype_and_interface_object_func = |
| 7 '%s::preparePrototypeAndInterfaceObject' % v8_class | 7 '%s::preparePrototypeAndInterfaceObject' % v8_class |
| 8 if has_prepare_prototype_and_interface_object | 8 if has_prepare_prototype_and_interface_object |
| 9 else 'nullptr' %} | 9 else 'nullptr' %} |
| 10 | 10 |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 834 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); | 834 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); |
| 835 return toScriptWrappable(object)->toImpl<{{cpp_class}}>(); | 835 return toScriptWrappable(object)->toImpl<{{cpp_class}}>(); |
| 836 } | 836 } |
| 837 | 837 |
| 838 // Transfer the ownership of the allocated memory to an {{interface_name}} w ithout | 838 // Transfer the ownership of the allocated memory to an {{interface_name}} w ithout |
| 839 // copying. | 839 // copying. |
| 840 v8::{{interface_name}}::Contents v8Contents = v8buffer->Externalize(); | 840 v8::{{interface_name}}::Contents v8Contents = v8buffer->Externalize(); |
| 841 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength() , WTF::ArrayBufferContents::{% if interface_name == 'ArrayBuffer' %}Not{% endif %}Shared); | 841 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength() , WTF::ArrayBufferContents::{% if interface_name == 'ArrayBuffer' %}Not{% endif %}Shared); |
| 842 {{cpp_class}}* buffer = {{cpp_class}}::create(contents); | 842 {{cpp_class}}* buffer = {{cpp_class}}::create(contents); |
| 843 v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::I solate::GetCurrent(), buffer->wrapperTypeInfo(), object); | 843 v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::I solate::GetCurrent(), buffer->wrapperTypeInfo(), object); |
| 844 ASSERT_UNUSED(associatedWrapper, associatedWrapper == object); | 844 DCHECK(associatedWrapper == object); |
|
Yuta Kitamura
2016/10/06 10:50:04
Does DCHECK_EQ cause some problem?
tkent
2016/10/06 14:07:19
DCHECK_EQ requires operator<< for v8::Local<>, and
| |
| 845 | 845 |
| 846 return buffer; | 846 return buffer; |
| 847 } | 847 } |
| 848 | 848 |
| 849 {% elif interface_name == 'ArrayBufferView' %} | 849 {% elif interface_name == 'ArrayBufferView' %} |
| 850 {{cpp_class}}* V8ArrayBufferView::toImpl(v8::Local<v8::Object> object) | 850 {{cpp_class}}* V8ArrayBufferView::toImpl(v8::Local<v8::Object> object) |
| 851 { | 851 { |
| 852 ASSERT(object->IsArrayBufferView()); | 852 ASSERT(object->IsArrayBufferView()); |
| 853 ScriptWrappable* scriptWrappable = toScriptWrappable(object); | 853 ScriptWrappable* scriptWrappable = toScriptWrappable(object); |
| 854 if (scriptWrappable) | 854 if (scriptWrappable) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 891 v8::Local<v8::Object> arrayBuffer = v8View->Buffer(); | 891 v8::Local<v8::Object> arrayBuffer = v8View->Buffer(); |
| 892 {{cpp_class}}* typedArray = nullptr; | 892 {{cpp_class}}* typedArray = nullptr; |
| 893 if (arrayBuffer->IsArrayBuffer()) { | 893 if (arrayBuffer->IsArrayBuffer()) { |
| 894 typedArray = {{cpp_class}}::create(V8ArrayBuffer::toImpl(arrayBuffer), v 8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif % }Length()); | 894 typedArray = {{cpp_class}}::create(V8ArrayBuffer::toImpl(arrayBuffer), v 8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif % }Length()); |
| 895 } else if (arrayBuffer->IsSharedArrayBuffer()) { | 895 } else if (arrayBuffer->IsSharedArrayBuffer()) { |
| 896 typedArray = {{cpp_class}}::create(V8SharedArrayBuffer::toImpl(arrayBuff er), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% e ndif %}Length()); | 896 typedArray = {{cpp_class}}::create(V8SharedArrayBuffer::toImpl(arrayBuff er), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% e ndif %}Length()); |
| 897 } else { | 897 } else { |
| 898 ASSERT_NOT_REACHED(); | 898 ASSERT_NOT_REACHED(); |
| 899 } | 899 } |
| 900 v8::Local<v8::Object> associatedWrapper = typedArray->associateWithWrapper(v 8::Isolate::GetCurrent(), typedArray->wrapperTypeInfo(), object); | 900 v8::Local<v8::Object> associatedWrapper = typedArray->associateWithWrapper(v 8::Isolate::GetCurrent(), typedArray->wrapperTypeInfo(), object); |
| 901 ASSERT_UNUSED(associatedWrapper, associatedWrapper == object); | 901 DCHECK(associatedWrapper == object); |
| 902 | 902 |
| 903 return typedArray->toImpl<{{cpp_class}}>(); | 903 return typedArray->toImpl<{{cpp_class}}>(); |
| 904 } | 904 } |
| 905 | 905 |
| 906 {% endif %} | 906 {% endif %} |
| 907 {% endblock %} | 907 {% endblock %} |
| 908 | 908 |
| 909 | 909 |
| 910 {##############################################################################} | 910 {##############################################################################} |
| 911 {% block to_impl_with_type_check %} | 911 {% block to_impl_with_type_check %} |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 992 | 992 |
| 993 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} | 993 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} |
| 994 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) | 994 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
| 995 { | 995 { |
| 996 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; | 996 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; |
| 997 } | 997 } |
| 998 | 998 |
| 999 {% endfor %} | 999 {% endfor %} |
| 1000 {% endif %} | 1000 {% endif %} |
| 1001 {% endblock %} | 1001 {% endblock %} |
| OLD | NEW |