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

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: call block.ReThrow() when throwing exceptions 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 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 TestInterfaceImplementationV8Internal::TestInterfaceImplementationReplaceabl eAttributeSetter(name, v8Value, info); 805 TestInterfaceImplementationV8Internal::TestInterfaceImplementationReplaceabl eAttributeSetter(name, v8Value, info);
806 } 806 }
807 807
808 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info) 808 static void voidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info)
809 { 809 {
810 if (UNLIKELY(info.Length() < 1)) { 810 if (UNLIKELY(info.Length() < 1)) {
811 throwArityTypeErrorForMethod("voidMethodTestInterfaceEmptyArg", "TestInt erface", 1, info.Length(), info.GetIsolate()); 811 throwArityTypeErrorForMethod("voidMethodTestInterfaceEmptyArg", "TestInt erface", 1, info.Length(), info.GetIsolate());
812 return; 812 return;
813 } 813 }
814 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 814 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
815 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], info.Ge tIsolate())) { 815 TestInterfaceEmpty* testInterfaceEmptyArg;
816 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInterfa ceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'." ), info.GetIsolate()); 816 {
817 return; 817 v8::TryCatch block;
818 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], inf o.GetIsolate())) {
819 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestInt erfaceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpt y'."), info.GetIsolate());
820 block.ReThrow();
821 return;
822 }
823 TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNa tiveWithTypeCheck(info.GetIsolate(), info[0]));
818 } 824 }
819 TONATIVE_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmp ty::toNativeWithTypeCheck(info.GetIsolate(), info[0]));
820 impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg); 825 impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg);
821 } 826 }
822 827
823 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info) 828 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info)
824 { 829 {
825 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 830 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
826 TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod (info); 831 TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod (info);
827 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 832 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
828 } 833 }
829 834
830 static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info) 835 static void voidMethodDoubleArgFloatArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info)
831 { 836 {
832 if (UNLIKELY(info.Length() < 2)) { 837 if (UNLIKELY(info.Length() < 2)) {
833 throwArityTypeErrorForMethod("voidMethodDoubleArgFloatArg", "TestInterfa ce", 2, info.Length(), info.GetIsolate()); 838 throwArityTypeErrorForMethod("voidMethodDoubleArgFloatArg", "TestInterfa ce", 2, info.Length(), info.GetIsolate());
834 return; 839 return;
835 } 840 }
836 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 841 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
837 TONATIVE_VOID(double, doubleArg, static_cast<double>(info[0]->NumberValue()) ); 842 double doubleArg;
838 if (!std::isfinite(doubleArg)) { 843 float floatArg;
839 throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleArgFl oatArg", "TestInterface", "double parameter 1 is non-finite."), info.GetIsolate( )); 844 {
840 return; 845 v8::TryCatch block;
841 } 846 TONATIVE_VOID_INTERNAL(doubleArg, static_cast<double>(info[0]->NumberVal ue()));
842 TONATIVE_VOID(float, floatArg, static_cast<float>(info[1]->NumberValue())); 847 if (!std::isfinite(doubleArg)) {
843 if (!std::isfinite(floatArg)) { 848 throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleA rgFloatArg", "TestInterface", "double parameter 1 is non-finite."), info.GetIsol ate());
844 throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleArgFl oatArg", "TestInterface", "float parameter 2 is non-finite."), info.GetIsolate() ); 849 block.ReThrow();
845 return; 850 return;
851 }
852 TONATIVE_VOID_INTERNAL(floatArg, static_cast<float>(info[1]->NumberValue ()));
853 if (!std::isfinite(floatArg)) {
854 throwTypeError(ExceptionMessages::failedToExecute("voidMethodDoubleA rgFloatArg", "TestInterface", "float parameter 2 is non-finite."), info.GetIsola te());
855 block.ReThrow();
856 return;
857 }
846 } 858 }
847 impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg); 859 impl->voidMethodDoubleArgFloatArg(doubleArg, floatArg);
848 } 860 }
849 861
850 static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info) 862 static void voidMethodDoubleArgFloatArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info)
851 { 863 {
852 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 864 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
853 TestInterfaceImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(inf o); 865 TestInterfaceImplementationV8Internal::voidMethodDoubleArgFloatArgMethod(inf o);
854 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 866 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
855 } 867 }
856 868
857 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8:: FunctionCallbackInfo<v8::Value>& info) 869 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethod(const v8:: FunctionCallbackInfo<v8::Value>& info)
858 { 870 {
859 if (UNLIKELY(info.Length() < 2)) { 871 if (UNLIKELY(info.Length() < 2)) {
860 throwArityTypeErrorForMethod("voidMethodUnrestrictedDoubleArgUnrestricte dFloatArg", "TestInterface", 2, info.Length(), info.GetIsolate()); 872 throwArityTypeErrorForMethod("voidMethodUnrestrictedDoubleArgUnrestricte dFloatArg", "TestInterface", 2, info.Length(), info.GetIsolate());
861 return; 873 return;
862 } 874 }
863 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 875 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
864 TONATIVE_VOID(double, unrestrictedDoubleArg, static_cast<double>(info[0]->Nu mberValue())); 876 double unrestrictedDoubleArg;
865 TONATIVE_VOID(float, unrestrictedFloatArg, static_cast<float>(info[1]->Numbe rValue())); 877 float unrestrictedFloatArg;
878 {
879 v8::TryCatch block;
880 TONATIVE_VOID_INTERNAL(unrestrictedDoubleArg, static_cast<double>(info[0 ]->NumberValue()));
881 TONATIVE_VOID_INTERNAL(unrestrictedFloatArg, static_cast<float>(info[1]- >NumberValue()));
882 }
866 impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDouble Arg, unrestrictedFloatArg); 883 impl->voidMethodUnrestrictedDoubleArgUnrestrictedFloatArg(unrestrictedDouble Arg, unrestrictedFloatArg);
867 } 884 }
868 885
869 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(co nst v8::FunctionCallbackInfo<v8::Value>& info) 886 static void voidMethodUnrestrictedDoubleArgUnrestrictedFloatArgMethodCallback(co nst v8::FunctionCallbackInfo<v8::Value>& info)
870 { 887 {
871 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 888 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
872 TestInterfaceImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrest rictedFloatArgMethod(info); 889 TestInterfaceImplementationV8Internal::voidMethodUnrestrictedDoubleArgUnrest rictedFloatArgMethod(info);
873 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 890 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
874 } 891 }
875 892
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 } 930 }
914 931
915 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info) 932 static void implementsComplexMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info)
916 { 933 {
917 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC omplexMethod", "TestInterface", info.Holder(), info.GetIsolate()); 934 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsC omplexMethod", "TestInterface", info.Holder(), info.GetIsolate());
918 if (UNLIKELY(info.Length() < 2)) { 935 if (UNLIKELY(info.Length() < 2)) {
919 throwArityTypeError(exceptionState, 2, info.Length()); 936 throwArityTypeError(exceptionState, 2, info.Length());
920 return; 937 return;
921 } 938 }
922 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 939 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
923 TOSTRING_VOID(V8StringResource<>, strArg, info[0]); 940 V8StringResource<> strArg;
924 if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], info.Ge tIsolate())) { 941 TestInterfaceEmpty* testInterfaceEmptyArg;
925 exceptionState.throwTypeError("parameter 2 is not of type 'TestInterface Empty'."); 942 {
926 exceptionState.throwIfNeeded(); 943 v8::TryCatch block;
927 return; 944 TOSTRING_VOID_INTERNAL(strArg, info[0]);
945 if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], inf o.GetIsolate())) {
946 exceptionState.throwTypeError("parameter 2 is not of type 'TestInter faceEmpty'.");
947 exceptionState.throwIfNeeded();
948 block.ReThrow();
949 return;
950 }
951 TONATIVE_VOID_INTERNAL(testInterfaceEmptyArg, V8TestInterfaceEmpty::toNa tiveWithTypeCheck(info.GetIsolate(), info[1]));
928 } 952 }
929 TONATIVE_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmp ty::toNativeWithTypeCheck(info.GetIsolate(), info[1]));
930 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()) ; 953 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()) ;
931 RefPtr<TestInterfaceEmpty> result = impl->implementsComplexMethod(scriptCont ext, strArg, testInterfaceEmptyArg, exceptionState); 954 RefPtr<TestInterfaceEmpty> result = impl->implementsComplexMethod(scriptCont ext, strArg, testInterfaceEmptyArg, exceptionState);
932 if (exceptionState.throwIfNeeded()) 955 if (exceptionState.throwIfNeeded())
933 return; 956 return;
934 v8SetReturnValue(info, result.release()); 957 v8SetReturnValue(info, result.release());
935 } 958 }
936 959
937 static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo <v8::Value>& info) 960 static void implementsComplexMethodMethodCallback(const v8::FunctionCallbackInfo <v8::Value>& info)
938 { 961 {
939 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 962 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 1059
1037 #if ENABLE(PARTIAL_CONDITION) 1060 #if ENABLE(PARTIAL_CONDITION)
1038 static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info) 1061 static void partialVoidMethodLongArgMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info)
1039 { 1062 {
1040 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoid MethodLongArg", "TestInterface", info.Holder(), info.GetIsolate()); 1063 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partialVoid MethodLongArg", "TestInterface", info.Holder(), info.GetIsolate());
1041 if (UNLIKELY(info.Length() < 1)) { 1064 if (UNLIKELY(info.Length() < 1)) {
1042 throwArityTypeError(exceptionState, 1, info.Length()); 1065 throwArityTypeError(exceptionState, 1, info.Length());
1043 return; 1066 return;
1044 } 1067 }
1045 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 1068 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
1046 TONATIVE_VOID_EXCEPTIONSTATE(int, longArg, toInt32(info[0], exceptionState), exceptionState); 1069 int longArg;
1070 {
1071 v8::TryCatch block;
1072 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(longArg, toInt32(info[0], exceptio nState), exceptionState);
1073 }
1047 ASSERT(impl); 1074 ASSERT(impl);
1048 TestPartialInterface::partialVoidMethodLongArg(*impl, longArg); 1075 TestPartialInterface::partialVoidMethodLongArg(*impl, longArg);
1049 } 1076 }
1050 #endif // ENABLE(PARTIAL_CONDITION) 1077 #endif // ENABLE(PARTIAL_CONDITION)
1051 1078
1052 #if ENABLE(PARTIAL_CONDITION) 1079 #if ENABLE(PARTIAL_CONDITION)
1053 static void partialVoidMethodLongArgMethodCallback(const v8::FunctionCallbackInf o<v8::Value>& info) 1080 static void partialVoidMethodLongArgMethodCallback(const v8::FunctionCallbackInf o<v8::Value>& info)
1054 { 1081 {
1055 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 1082 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
1056 TestInterfaceImplementationV8Internal::partialVoidMethodLongArgMethod(info); 1083 TestInterfaceImplementationV8Internal::partialVoidMethodLongArgMethod(info);
(...skipping 24 matching lines...) Expand all
1081 #endif // ENABLE(PARTIAL_CONDITION) 1108 #endif // ENABLE(PARTIAL_CONDITION)
1082 1109
1083 #if ENABLE(PARTIAL_CONDITION) 1110 #if ENABLE(PARTIAL_CONDITION)
1084 static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCall backInfo<v8::Value>& info) 1111 static void partialVoidMethodPartialCallbackTypeArgMethod(const v8::FunctionCall backInfo<v8::Value>& info)
1085 { 1112 {
1086 if (UNLIKELY(info.Length() < 1)) { 1113 if (UNLIKELY(info.Length() < 1)) {
1087 throwArityTypeErrorForMethod("partialVoidMethodPartialCallbackTypeArg", "TestInterface", 1, info.Length(), info.GetIsolate()); 1114 throwArityTypeErrorForMethod("partialVoidMethodPartialCallbackTypeArg", "TestInterface", 1, info.Length(), info.GetIsolate());
1088 return; 1115 return;
1089 } 1116 }
1090 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ; 1117 TestInterfaceImplementation* impl = V8TestInterface::toNative(info.Holder()) ;
1091 TONATIVE_VOID(ScriptValue, partialCallbackTypeArg, ScriptValue(ScriptState:: current(info.GetIsolate()), info[0])); 1118 ScriptValue partialCallbackTypeArg;
1119 {
1120 v8::TryCatch block;
1121 TONATIVE_VOID_INTERNAL(partialCallbackTypeArg, ScriptValue(ScriptState:: current(info.GetIsolate()), info[0]));
1122 }
1092 ASSERT(impl); 1123 ASSERT(impl);
1093 TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partial CallbackTypeArg); 1124 TestPartialInterface::partialVoidMethodPartialCallbackTypeArg(*impl, partial CallbackTypeArg);
1094 } 1125 }
1095 #endif // ENABLE(PARTIAL_CONDITION) 1126 #endif // ENABLE(PARTIAL_CONDITION)
1096 1127
1097 #if ENABLE(PARTIAL_CONDITION) 1128 #if ENABLE(PARTIAL_CONDITION)
1098 static void partialVoidMethodPartialCallbackTypeArgMethodCallback(const v8::Func tionCallbackInfo<v8::Value>& info) 1129 static void partialVoidMethodPartialCallbackTypeArgMethodCallback(const v8::Func tionCallbackInfo<v8::Value>& info)
1099 { 1130 {
1100 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 1131 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
1101 TestInterfaceImplementationV8Internal::partialVoidMethodPartialCallbackTypeA rgMethod(info); 1132 TestInterfaceImplementationV8Internal::partialVoidMethodPartialCallbackTypeA rgMethod(info);
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 } 1524 }
1494 1525
1495 template<> 1526 template<>
1496 v8::Handle<v8::Value> toV8NoInline(TestInterfaceImplementation* impl, v8::Handle <v8::Object> creationContext, v8::Isolate* isolate) 1527 v8::Handle<v8::Value> toV8NoInline(TestInterfaceImplementation* impl, v8::Handle <v8::Object> creationContext, v8::Isolate* isolate)
1497 { 1528 {
1498 return toV8(impl, creationContext, isolate); 1529 return toV8(impl, creationContext, isolate);
1499 } 1530 }
1500 1531
1501 } // namespace WebCore 1532 } // namespace WebCore
1502 #endif // ENABLE(CONDITION) 1533 #endif // ENABLE(CONDITION)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698