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

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

Powered by Google App Engine
This is Rietveld 408576698