Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: third_party/WebKit/Source/bindings/templates/interface.cpp

Issue 1414553002: Fix out-of-memory crashes related to ArrayBuffer allocation Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase+more tweaks Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 if (v8buffer->IsExternal()) { 774 if (v8buffer->IsExternal()) {
775 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); 775 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object);
776 RELEASE_ASSERT(wrapperTypeInfo); 776 RELEASE_ASSERT(wrapperTypeInfo);
777 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink); 777 RELEASE_ASSERT(wrapperTypeInfo->ginEmbedder == gin::kEmbedderBlink);
778 return toScriptWrappable(object)->toImpl<{{cpp_class}}>(); 778 return toScriptWrappable(object)->toImpl<{{cpp_class}}>();
779 } 779 }
780 780
781 // Transfer the ownership of the allocated memory to an {{interface_name}} w ithout 781 // Transfer the ownership of the allocated memory to an {{interface_name}} w ithout
782 // copying. 782 // copying.
783 v8::{{interface_name}}::Contents v8Contents = v8buffer->Externalize(); 783 v8::{{interface_name}}::Contents v8Contents = v8buffer->Externalize();
784 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength() , WTF::ArrayBufferContents::{% if interface_name == 'ArrayBuffer' %}Not{% endif %}Shared); 784 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength() , WTF::ArrayBufferContents::{% if interface_name == 'ArrayBuffer' %}Not{% endif %}Shared, WTF::ArrayBufferContents::CrashIfOutOfMemory_DEPRECATED);
785 RefPtr<{{cpp_class}}> buffer = {{cpp_class}}::create(contents); 785 RefPtr<{{cpp_class}}> buffer = {{cpp_class}}::create(contents);
786 v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::I solate::GetCurrent(), buffer->wrapperTypeInfo(), object); 786 v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::I solate::GetCurrent(), buffer->wrapperTypeInfo(), object);
787 ASSERT_UNUSED(associatedWrapper, associatedWrapper == object); 787 ASSERT_UNUSED(associatedWrapper, associatedWrapper == object);
788 788
789 return buffer.get(); 789 return buffer.get();
790 } 790 }
791 791
792 {% elif interface_name == 'ArrayBufferView' %} 792 {% elif interface_name == 'ArrayBufferView' %}
793 {{cpp_class}}* V8ArrayBufferView::toImpl(v8::Local<v8::Object> object) 793 {{cpp_class}}* V8ArrayBufferView::toImpl(v8::Local<v8::Object> object)
794 { 794 {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 978
979 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 979 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
980 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) 980 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&))
981 { 981 {
982 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 982 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
983 } 983 }
984 984
985 {% endfor %} 985 {% endfor %}
986 {% endif %} 986 {% endif %}
987 {% endblock %} 987 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698