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

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

Issue 2301993002: binding: Introduces ExceptionToPromiseScope. (Closed)
Patch Set: . Created 4 years, 3 months 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 {% set has_prepare_prototype_and_interface_object = 3 {% set has_prepare_prototype_and_interface_object =
4 unscopeables or has_conditional_attributes_on_prototype or 4 unscopeables 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 return; 538 return;
539 } 539 }
540 {% endfor %} 540 {% endfor %}
541 break; 541 break;
542 {% endfor %} 542 {% endfor %}
543 default: 543 default:
544 {# Invalid arity, throw error #} 544 {# Invalid arity, throw error #}
545 {# Report full list of valid arities if gaps and above minimum #} 545 {# Report full list of valid arities if gaps and above minimum #}
546 {% if constructor_overloads.valid_arities %} 546 {% if constructor_overloads.valid_arities %}
547 if (info.Length() >= {{constructor_overloads.length}}) { 547 if (info.Length() >= {{constructor_overloads.length}}) {
548 setArityTypeError(exceptionState, "{{constructor_overloads.valid_ari ties}}", info.Length()); 548 throwInvalidArityError(exceptionState, "{{constructor_overloads.vali d_arities}}", info.Length());
549 return; 549 return;
550 } 550 }
551 {% endif %} 551 {% endif %}
552 {# Otherwise just report "not enough arguments" #} 552 {# Otherwise just report "not enough arguments" #}
553 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments({{co nstructor_overloads.length}}, info.Length())); 553 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments({{co nstructor_overloads.length}}, info.Length()));
554 return; 554 return;
555 } 555 }
556 {# No match, throw error #} 556 {# No match, throw error #}
557 exceptionState.throwTypeError("No matching constructor signature."); 557 exceptionState.throwTypeError("No matching constructor signature.");
558 } 558 }
559 559
560 {% endif %} 560 {% endif %}
561 {% endblock %} 561 {% endblock %}
562 562
563
563 {##############################################################################} 564 {##############################################################################}
564 {% block visit_dom_wrapper %} 565 {% block visit_dom_wrapper %}
565 {% if has_visit_dom_wrapper %} 566 {% if has_visit_dom_wrapper %}
566 void {{v8_class}}::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* script Wrappable, const v8::Persistent<v8::Object>& wrapper) 567 void {{v8_class}}::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* script Wrappable, const v8::Persistent<v8::Object>& wrapper)
567 { 568 {
568 {% if has_visit_dom_wrapper_custom %} 569 {% if has_visit_dom_wrapper_custom %}
569 {{v8_class}}::visitDOMWrapperCustom(isolate, scriptWrappable, wrapper); 570 {{v8_class}}::visitDOMWrapperCustom(isolate, scriptWrappable, wrapper);
570 {% endif %} 571 {% endif %}
571 {% if set_wrapper_reference_to or set_wrapper_reference_from %} 572 {% if set_wrapper_reference_to or set_wrapper_reference_from %}
572 {{cpp_class}}* impl = scriptWrappable->toImpl<{{cpp_class}}>(); 573 {{cpp_class}}* impl = scriptWrappable->toImpl<{{cpp_class}}>();
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 namedPropertiesObjectTemplate->SetInternalFieldCount({{v8_class}}::internalF ieldCount); 739 namedPropertiesObjectTemplate->SetInternalFieldCount({{v8_class}}::internalF ieldCount);
739 V8DOMConfiguration::setClassString(isolate, namedPropertiesObjectTemplate, " {{interface_name}}Properties"); 740 V8DOMConfiguration::setClassString(isolate, namedPropertiesObjectTemplate, " {{interface_name}}Properties");
740 {{install_named_property_handler('namedPropertiesObjectTemplate') | indent}} 741 {{install_named_property_handler('namedPropertiesObjectTemplate') | indent}}
741 742
742 return namedPropertiesObjectFunctionTemplate; 743 return namedPropertiesObjectFunctionTemplate;
743 } 744 }
744 745
745 {% endif %} 746 {% endif %}
746 {% endblock %} 747 {% endblock %}
747 748
749
748 {##############################################################################} 750 {##############################################################################}
749 {% block has_instance %} 751 {% block has_instance %}
750 {% if not is_array_buffer_or_view %} 752 {% if not is_array_buffer_or_view %}
751 753
752 bool {{v8_class}}::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolat e) 754 bool {{v8_class}}::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolat e)
753 { 755 {
754 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e); 756 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e);
755 } 757 }
756 758
757 v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::V alue> v8Value, v8::Isolate* isolate) 759 v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::V alue> v8Value, v8::Isolate* isolate)
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 936
935 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 937 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
936 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) 938 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&))
937 { 939 {
938 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 940 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
939 } 941 }
940 942
941 {% endfor %} 943 {% endfor %}
942 {% endif %} 944 {% endif %}
943 {% endblock %} 945 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698