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

Side by Side Diff: Source/bindings/tests/results/V8TestInterface.cpp

Issue 265293004: Create fewer local v8::TryCatch objects in generated bindings code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: added comment Created 6 years, 7 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #if ENABLE(CONDITION) 8 #if ENABLE(CONDITION)
9 #include "V8TestInterface.h" 9 #include "V8TestInterface.h"
10 10
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 TestInterfaceImplementationV8Internal::TestInterfaceImplementationReplaceabl eAttributeSetter(name, v8Value, info); 793 TestInterfaceImplementationV8Internal::TestInterfaceImplementationReplaceabl eAttributeSetter(name, v8Value, info);
794 } 794 }
795 795
796 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info) 796 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info)
797 { 797 {
798 if (UNLIKELY(info.Length() < 1)) { 798 if (UNLIKELY(info.Length() < 1)) {
799 throwMinimumArityTypeErrorForMethod("voidMethodTestInterfaceEmptyArg", " TestInterface", 1, info.Length(), info.GetIsolate()); 799 throwMinimumArityTypeErrorForMethod("voidMethodTestInterfaceEmptyArg", " TestInterface", 1, info.Length(), info.GetIsolate());
800 return; 800 return;
801 } 801 }
802 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 802 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
803 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], info.Ge tIsolate())) { 803 TestInterfaceEmpty* testInterfaceEmptyArg;
804 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfa ceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'." ), info.GetIsolate()); 804 {
805 return; 805 v8::TryCatch block;
806 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], inf o.GetIsolate())) {
807 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInt erfaceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpt y'."), info.GetIsolate());
808 block.ReThrow();
809 return;
810 }
811 TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNa tiveWithTypeCheck(info.GetIsolate(), info[0]));
806 } 812 }
807 TONATIVE_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmp ty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
808 impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg); 813 impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg);
809 } 814 }
810 815
811 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info) 816 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info)
812 { 817 {
813 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 818 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
814 TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod (info); 819 TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod (info);
815 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 820 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
816 } 821 }
817 822
818 static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info) 823 static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info)
819 { 824 {
820 if (UNLIKELY(info.Length() < 2)) { 825 if (UNLIKELY(info.Length() < 2)) {
821 throwMinimumArityTypeErrorForMethod("voidMethodDoubleArgFloatArg", "Test Interface", 2, info.Length(), info.GetIsolate()); 826 throwMinimumArityTypeErrorForMethod("voidMethodDoubleArgFloatArg", "Test Interface", 2, info.Length(), info.GetIsolate());
822 return; 827 return;
823 } 828 }
824 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 829 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
825 TONATIVE_VOID(double, doubleArg, static_cast<double>(info[0]->NumberValue()) ); 830 double doubleArg;
826 if (!std::isfinite(doubleArg)) { 831 float floatArg;
827 throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleArgFl oatArg", "TestInterface", "double parameter 1 is non-finite."), info.GetIsolate( )); 832 {
828 return; 833 v8::TryCatch block;
829 } 834 TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberVal ue()));
830 TONATIVE_VOID(float, floatArg, static_cast<float>(info[1]->NumberValue())); 835 if (!std::isfinite(doubleArg)) {
831 if (!std::isfinite(floatArg)) { 836 throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleA rgFloatArg", "TestInterface", "double parameter 1 is non-finite."), info.GetIsol ate());
832 throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleArgFl oatArg", "TestInterface", "float parameter 2 is non-finite."), info.GetIsolate() ); 837 block.ReThrow();
833 return; 838 return;
839 }
840 TONATIVE_VOID_INTERNAL(floatArg, static_cast<float>(info[1]->NumberValue ()));
841 if (!std::isfinite(floatArg)) {
842 throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleA rgFloatArg", "TestInterface", "float parameter 2 is non-finite."), info.GetIsola te());
843 block.ReThrow();
844 return;
845 }
834 } 846 }
835 impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg); 847 impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg);
836 } 848 }
837 849
838 static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info) 850 static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info)
839 { 851 {
840 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 852 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
841 TestInterfaceImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(inf o); 853 TestInterfaceImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(inf o);
842 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 854 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
843 } 855 }
844 856
845 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8:: FunctionCallbackInfo<v8::Value>& info) 857 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8:: FunctionCallbackInfo<v8::Value>& info)
846 { 858 {
847 if (UNLIKELY(info.Length() < 2)) { 859 if (UNLIKELY(info.Length() < 2)) {
848 throwMinimumArityTypeErrorForMethod("voidMethodUnrestrictedDoubleArgUnre strictedFloatArg", "TestInterface", 2, info.Length(), info.GetIsolate()); 860 throwMinimumArityTypeErrorForMethod("voidMethodUnrestrictedDoubleArgUnre strictedFloatArg", "TestInterface", 2, info.Length(), info.GetIsolate());
849 return; 861 return;
850 } 862 }
851 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 863 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
852 TONATIVE_VOID(double, unrestrictedDoubleArg, static_cast<double>(info[0]->Nu mberValue())); 864 double unrestrictedDoubleArg;
853 TONATIVE_VOID(float, unrestrictedFloatArg, static_cast<float>(info[1]->Numbe rValue())); 865 float unrestrictedFloatArg;
866 {
867 v8::TryCatch block;
868 TONATIVE_VOID_INTERNAL(unrestrictedDoubleArg, static_cast<double>(info[0 ]->NumberValue()));
869 TONATIVE_VOID_INTERNAL(unrestrictedFloatArg, static_cast<float>(info[1]- >NumberValue()));
870 }
854 impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDouble Arg, unrestrictedFloatArg); 871 impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDouble Arg, unrestrictedFloatArg);
855 } 872 }
856 873
857 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(co nst v8::FunctionCallbackInfo<v8::Value>& info) 874 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(co nst v8::FunctionCallbackInfo<v8::Value>& info)
858 { 875 {
859 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 876 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
860 TestInterfaceImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrest rictedFloatArgMethod(info); 877 TestInterfaceImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrest rictedFloatArgMethod(info);
861 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 878 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
862 } 879 }
863 880
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 } 918 }
902 919
903 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info) 920 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info)
904 { 921 {
905 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC omplexMethod", "TestInterface", info.Holder(), info.GetIsolate()); 922 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC omplexMethod", "TestInterface", info.Holder(), info.GetIsolate());
906 if (UNLIKELY(info.Length() < 2)) { 923 if (UNLIKELY(info.Length() < 2)) {
907 throwMinimumArityTypeError(exceptionState, 2, info.Length()); 924 throwMinimumArityTypeError(exceptionState, 2, info.Length());
908 return; 925 return;
909 } 926 }
910 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 927 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
911 TOSTRING_VOID(V8StringResource<>, strArg, info[0]); 928 V8StringResource<> strArg;
912 if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], info.Ge tIsolate())) { 929 TestInterfaceEmpty* testInterfaceEmptyArg;
913 exceptionState.throwTypeError("parameter 2 is not of type 'TestInterface Empty'."); 930 {
914 exceptionState.throwIfNeeded(); 931 v8::TryCatch block;
915 return; 932 TOSTRING_VOID_INTERNAL_RETHROW(strArg, info[0], block);
933 if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], inf o.GetIsolate())) {
934 exceptionState.throwTypeError("parameter 2 is not of type 'TestInter faceEmpty'.");
935 exceptionState.throwIfNeeded();
936 block.ReThrow();
937 return;
938 }
939 TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNa tiveWithTypeCheck(info.GetIsolate(), info[1]));
916 } 940 }
917 TONATIVE_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmp ty::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
918 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()) ; 941 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()) ;
919 RefPtr<TestInterfaceEmpty> result = impl->implementsComplexMethod(scriptCont ext, strArg, testInterfaceEmptyArg, exceptionState); 942 RefPtr<TestInterfaceEmpty> result = impl->implementsComplexMethod(scriptCont ext, strArg, testInterfaceEmptyArg, exceptionState);
920 if (exceptionState.throwIfNeeded()) 943 if (exceptionState.throwIfNeeded())
921 return; 944 return;
922 v8SetReturnValue(info, result.release()); 945 v8SetReturnValue(info, result.release());
923 } 946 }
924 947
925 static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo <v8::Value>& info) 948 static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo <v8::Value>& info)
926 { 949 {
927 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 950 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 1044
1022 #if ENABLE(PARTIAL_CONDITION) 1045 #if ENABLE(PARTIAL_CONDITION)
1023 static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info) 1046 static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info)
1024 { 1047 {
1025 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoid MethodLongArg", "TestInterface", info.Holder(), info.GetIsolate()); 1048 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoid MethodLongArg", "TestInterface", info.Holder(), info.GetIsolate());
1026 if (UNLIKELY(info.Length() < 1)) { 1049 if (UNLIKELY(info.Length() < 1)) {
1027 throwMinimumArityTypeError(exceptionState, 1, info.Length()); 1050 throwMinimumArityTypeError(exceptionState, 1, info.Length());
1028 return; 1051 return;
1029 } 1052 }
1030 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 1053 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
1031 TONATIVE_VOID_EXCEPTIONSTATE(int, longArg, toInt32(info[0], exceptionState), exceptionState); 1054 int longArg;
1055 {
1056 v8::TryCatch block;
1057 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptio nState), exceptionState);
1058 }
1032 TestPartialInterface::partialVoidMethodLongArg(*impl, longArg); 1059 TestPartialInterface::partialVoidMethodLongArg(*impl, longArg);
1033 } 1060 }
1034 #endif // ENABLE(PARTIAL_CONDITION) 1061 #endif // ENABLE(PARTIAL_CONDITION)
1035 1062
1036 #if ENABLE(PARTIAL_CONDITION) 1063 #if ENABLE(PARTIAL_CONDITION)
1037 static void partialVoidMethodLongArgMethodCallback(const v8::FunctionCallbackInf o<v8::Value>& info) 1064 static void partialVoidMethodLongArgMethodCallback(const v8::FunctionCallbackInf o<v8::Value>& info)
1038 { 1065 {
1039 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 1066 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
1040 TestInterfaceImplementationV8Internal::partialVoidMethodLongArgMethod(info); 1067 TestInterfaceImplementationV8Internal::partialVoidMethodLongArgMethod(info);
1041 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 1068 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
(...skipping 22 matching lines...) Expand all
1064 #endif // ENABLE(PARTIAL_CONDITION) 1091 #endif // ENABLE(PARTIAL_CONDITION)
1065 1092
1066 #if ENABLE(PARTIAL_CONDITION) 1093 #if ENABLE(PARTIAL_CONDITION)
1067 static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCall backInfo<v8::Value>& info) 1094 static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCall backInfo<v8::Value>& info)
1068 { 1095 {
1069 if (UNLIKELY(info.Length() < 1)) { 1096 if (UNLIKELY(info.Length() < 1)) {
1070 throwMinimumArityTypeErrorForMethod("partialVoidMethodPartialCallbackTyp eArg", "TestInterface", 1, info.Length(), info.GetIsolate()); 1097 throwMinimumArityTypeErrorForMethod("partialVoidMethodPartialCallbackTyp eArg", "TestInterface", 1, info.Length(), info.GetIsolate());
1071 return; 1098 return;
1072 } 1099 }
1073 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 1100 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
1074 TONATIVE_VOID(ScriptValue, partialCallbackTypeArg, ScriptValue(ScriptState:: current(info.GetIsolate()), info[0])); 1101 ScriptValue partialCallbackTypeArg;
1102 {
1103 v8::TryCatch block;
1104 TONATIVE_VOID_INTERNAL(partialCallbackTypeArg, ScriptValue(ScriptState:: current(info.GetIsolate()), info[0]));
1105 }
1075 TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partial CallbackTypeArg); 1106 TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partial CallbackTypeArg);
1076 } 1107 }
1077 #endif // ENABLE(PARTIAL_CONDITION) 1108 #endif // ENABLE(PARTIAL_CONDITION)
1078 1109
1079 #if ENABLE(PARTIAL_CONDITION) 1110 #if ENABLE(PARTIAL_CONDITION)
1080 static void partialVoidMethodPartialCallbackTypeArgMethodCallback(const v8::Func tionCallbackInfo<v8::Value>& info) 1111 static void partialVoidMethodPartialCallbackTypeArgMethodCallback(const v8::Func tionCallbackInfo<v8::Value>& info)
1081 { 1112 {
1082 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 1113 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
1083 TestInterfaceImplementationV8Internal::partialVoidMethodPartialCallbackTypeA rgMethod(info); 1114 TestInterfaceImplementationV8Internal::partialVoidMethodPartialCallbackTypeA rgMethod(info);
1084 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 1115 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 } 1505 }
1475 1506
1476 template<> 1507 template<>
1477 v8::Handle<v8::Value> toV8NoInline(TestInterfaceImplementation* impl, v8::Handle <v8::Object> creationContext, v8::Isolate* isolate) 1508 v8::Handle<v8::Value> toV8NoInline(TestInterfaceImplementation* impl, v8::Handle <v8::Object> creationContext, v8::Isolate* isolate)
1478 { 1509 {
1479 return toV8(impl, creationContext, isolate); 1510 return toV8(impl, creationContext, isolate);
1480 } 1511 }
1481 1512
1482 } // namespace WebCore 1513 } // namespace WebCore
1483 #endif // ENABLE(CONDITION) 1514 #endif // ENABLE(CONDITION)
OLDNEW
« no previous file with comments | « Source/bindings/templates/methods.cpp ('k') | Source/bindings/tests/results/V8TestInterface2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698