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

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

Issue 221073003: Add helper functions for throwing arity-related TypeErrors (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix style nits. Created 6 years, 8 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 | Annotate | Revision Log
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 #include "V8TestTypedefs.h" 8 #include "V8TestTypedefs.h"
9 9
10 #include "RuntimeEnabledFeatures.h" 10 #include "RuntimeEnabledFeatures.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 static void voidMethodArrayOfLongsArgMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info) 112 static void voidMethodArrayOfLongsArgMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info)
113 { 113 {
114 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 114 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
115 TestTypedefsV8Internal::voidMethodArrayOfLongsArgMethod(info); 115 TestTypedefsV8Internal::voidMethodArrayOfLongsArgMethod(info);
116 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 116 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
117 } 117 }
118 118
119 static void voidMethodFloatArgStringArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info) 119 static void voidMethodFloatArgStringArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info)
120 { 120 {
121 if (UNLIKELY(info.Length() < 2)) { 121 if (UNLIKELY(info.Length() < 2)) {
122 throwTypeError(ExceptionMessages::failedToExecute("voidMethodFloatArgStr ingArg", "TestTypedefs", ExceptionMessages::notEnoughArguments(2, info.Length()) ), info.GetIsolate()); 122 throwArityTypeErrorForMethod("voidMethodFloatArgStringArg", "TestTypedef s", 2, info.Length(), info.GetIsolate());
123 return; 123 return;
124 } 124 }
125 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 125 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
126 V8TRYCATCH_VOID(float, floatArg, static_cast<float>(info[0]->NumberValue())) ; 126 V8TRYCATCH_VOID(float, floatArg, static_cast<float>(info[0]->NumberValue())) ;
127 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[1]) ; 127 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[1]) ;
128 impl->voidMethodFloatArgStringArg(floatArg, stringArg); 128 impl->voidMethodFloatArgStringArg(floatArg, stringArg);
129 } 129 }
130 130
131 static void voidMethodFloatArgStringArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info) 131 static void voidMethodFloatArgStringArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info)
132 { 132 {
133 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 133 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
134 TestTypedefsV8Internal::voidMethodFloatArgStringArgMethod(info); 134 TestTypedefsV8Internal::voidMethodFloatArgStringArgMethod(info);
135 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 135 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
136 } 136 }
137 137
138 static void voidMethodTestCallbackInterfaceTypeArgMethod(const v8::FunctionCallb ackInfo<v8::Value>& info) 138 static void voidMethodTestCallbackInterfaceTypeArgMethod(const v8::FunctionCallb ackInfo<v8::Value>& info)
139 { 139 {
140 if (UNLIKELY(info.Length() < 1)) { 140 if (UNLIKELY(info.Length() < 1)) {
141 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac kInterfaceTypeArg", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, inf o.Length())), info.GetIsolate()); 141 throwArityTypeErrorForMethod("voidMethodTestCallbackInterfaceTypeArg", " TestTypedefs", 1, info.Length(), info.GetIsolate());
142 return; 142 return;
143 } 143 }
144 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 144 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
145 if (info.Length() <= 0 || !info[0]->IsFunction()) { 145 if (info.Length() <= 0 || !info[0]->IsFunction()) {
146 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac kInterfaceTypeArg", "TestTypedefs", "The callback provided as parameter 1 is not a function."), info.GetIsolate()); 146 throwTypeError(ExceptionMessages::failedToExecute("voidMethodTestCallbac kInterfaceTypeArg", "TestTypedefs", "The callback provided as parameter 1 is not a function."), info.GetIsolate());
147 return; 147 return;
148 } 148 }
149 OwnPtr<TestCallbackInterface> testCallbackInterfaceTypeArg = V8TestCallbackI nterface::create(v8::Handle<v8::Function>::Cast(info[0]), currentExecutionContex t(info.GetIsolate())); 149 OwnPtr<TestCallbackInterface> testCallbackInterfaceTypeArg = V8TestCallbackI nterface::create(v8::Handle<v8::Function>::Cast(info[0]), currentExecutionContex t(info.GetIsolate()));
150 impl->voidMethodTestCallbackInterfaceTypeArg(testCallbackInterfaceTypeArg.re lease()); 150 impl->voidMethodTestCallbackInterfaceTypeArg(testCallbackInterfaceTypeArg.re lease());
151 } 151 }
152 152
153 static void voidMethodTestCallbackInterfaceTypeArgMethodCallback(const v8::Funct ionCallbackInfo<v8::Value>& info) 153 static void voidMethodTestCallbackInterfaceTypeArgMethodCallback(const v8::Funct ionCallbackInfo<v8::Value>& info)
154 { 154 {
155 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 155 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
156 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceTypeArgMethod(info); 156 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceTypeArgMethod(info);
157 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 157 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
158 } 158 }
159 159
160 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethod(const v8::Fun ctionCallbackInfo<v8::Value>& info) 160 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethod(const v8::Fun ctionCallbackInfo<v8::Value>& info)
161 { 161 {
162 if (UNLIKELY(info.Length() < 1)) { 162 if (UNLIKELY(info.Length() < 1)) {
163 throwTypeError(ExceptionMessages::failedToExecute("uLongLongMethodTestIn terfaceEmptyTypeSequenceArg", "TestTypedefs", ExceptionMessages::notEnoughArgume nts(1, info.Length())), info.GetIsolate()); 163 throwArityTypeErrorForMethod("uLongLongMethodTestInterfaceEmptyTypeSeque nceArg", "TestTypedefs", 1, info.Length(), info.GetIsolate());
164 return; 164 return;
165 } 165 }
166 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 166 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
167 V8TRYCATCH_VOID(Vector<RefPtr<TestInterfaceEmpty> >, testInterfaceEmptyTypeS equenceArg, (toRefPtrNativeArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[ 0], 1, info.GetIsolate()))); 167 V8TRYCATCH_VOID(Vector<RefPtr<TestInterfaceEmpty> >, testInterfaceEmptyTypeS equenceArg, (toRefPtrNativeArray<TestInterfaceEmpty, V8TestInterfaceEmpty>(info[ 0], 1, info.GetIsolate())));
168 v8SetReturnValue(info, static_cast<double>(impl->uLongLongMethodTestInterfac eEmptyTypeSequenceArg(testInterfaceEmptyTypeSequenceArg))); 168 v8SetReturnValue(info, static_cast<double>(impl->uLongLongMethodTestInterfac eEmptyTypeSequenceArg(testInterfaceEmptyTypeSequenceArg)));
169 } 169 }
170 170
171 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 171 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
172 { 172 {
173 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 173 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
(...skipping 23 matching lines...) Expand all
197 static void fooOrBarMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info) 197 static void fooOrBarMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info)
198 { 198 {
199 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 199 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
200 TestTypedefsV8Internal::fooOrBarMethodMethod(info); 200 TestTypedefsV8Internal::fooOrBarMethodMethod(info);
201 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 201 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
202 } 202 }
203 203
204 static void arrayOfStringsMethodArrayOfStringsArgMethod(const v8::FunctionCallba ckInfo<v8::Value>& info) 204 static void arrayOfStringsMethodArrayOfStringsArgMethod(const v8::FunctionCallba ckInfo<v8::Value>& info)
205 { 205 {
206 if (UNLIKELY(info.Length() < 1)) { 206 if (UNLIKELY(info.Length() < 1)) {
207 throwTypeError(ExceptionMessages::failedToExecute("arrayOfStringsMethodA rrayOfStringsArg", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info .Length())), info.GetIsolate()); 207 throwArityTypeErrorForMethod("arrayOfStringsMethodArrayOfStringsArg", "T estTypedefs", 1, info.Length(), info.GetIsolate());
208 return; 208 return;
209 } 209 }
210 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 210 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
211 V8TRYCATCH_VOID(Vector<String>, arrayOfStringsArg, toNativeArray<String>(inf o[0], 1, info.GetIsolate())); 211 V8TRYCATCH_VOID(Vector<String>, arrayOfStringsArg, toNativeArray<String>(inf o[0], 1, info.GetIsolate()));
212 v8SetReturnValue(info, v8Array(impl->arrayOfStringsMethodArrayOfStringsArg(a rrayOfStringsArg), info.GetIsolate())); 212 v8SetReturnValue(info, v8Array(impl->arrayOfStringsMethodArrayOfStringsArg(a rrayOfStringsArg), info.GetIsolate()));
213 } 213 }
214 214
215 static void arrayOfStringsMethodArrayOfStringsArgMethodCallback(const v8::Functi onCallbackInfo<v8::Value>& info) 215 static void arrayOfStringsMethodArrayOfStringsArgMethodCallback(const v8::Functi onCallbackInfo<v8::Value>& info)
216 { 216 {
217 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 217 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
218 TestTypedefsV8Internal::arrayOfStringsMethodArrayOfStringsArgMethod(info); 218 TestTypedefsV8Internal::arrayOfStringsMethodArrayOfStringsArgMethod(info);
219 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 219 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
220 } 220 }
221 221
222 static void stringArrayMethodStringArrayArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info) 222 static void stringArrayMethodStringArrayArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info)
223 { 223 {
224 if (UNLIKELY(info.Length() < 1)) { 224 if (UNLIKELY(info.Length() < 1)) {
225 throwTypeError(ExceptionMessages::failedToExecute("stringArrayMethodStri ngArrayArg", "TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Lengt h())), info.GetIsolate()); 225 throwArityTypeErrorForMethod("stringArrayMethodStringArrayArg", "TestTyp edefs", 1, info.Length(), info.GetIsolate());
226 return; 226 return;
227 } 227 }
228 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder()); 228 TestTypedefs* impl = V8TestTypedefs::toNative(info.Holder());
229 V8TRYCATCH_VOID(Vector<String>, stringArrayArg, toNativeArray<String>(info[0 ], 1, info.GetIsolate())); 229 V8TRYCATCH_VOID(Vector<String>, stringArrayArg, toNativeArray<String>(info[0 ], 1, info.GetIsolate()));
230 v8SetReturnValue(info, v8Array(impl->stringArrayMethodStringArrayArg(stringA rrayArg), info.GetIsolate())); 230 v8SetReturnValue(info, v8Array(impl->stringArrayMethodStringArrayArg(stringA rrayArg), info.GetIsolate()));
231 } 231 }
232 232
233 static void stringArrayMethodStringArrayArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info) 233 static void stringArrayMethodStringArrayArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info)
234 { 234 {
235 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 235 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
236 TestTypedefsV8Internal::stringArrayMethodStringArrayArgMethod(info); 236 TestTypedefsV8Internal::stringArrayMethodStringArrayArgMethod(info);
237 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); 237 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
238 } 238 }
239 239
240 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) 240 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
241 { 241 {
242 v8::Isolate* isolate = info.GetIsolate(); 242 v8::Isolate* isolate = info.GetIsolate();
243 if (UNLIKELY(info.Length() < 1)) { 243 if (UNLIKELY(info.Length() < 1)) {
244 throwTypeError(ExceptionMessages::failedToConstruct("TestTypedefs", Exce ptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); 244 throwArityTypeErrorForConstructor("TestTypedefs", 1, info.Length(), info .GetIsolate());
245 return; 245 return;
246 } 246 }
247 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]) ; 247 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]) ;
248 RefPtr<TestTypedefs> impl = TestTypedefs::create(stringArg); 248 RefPtr<TestTypedefs> impl = TestTypedefs::create(stringArg);
249 249
250 v8::Handle<v8::Object> wrapper = info.Holder(); 250 v8::Handle<v8::Object> wrapper = info.Holder();
251 V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl.release(), &V8 TestTypedefs::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independe nt); 251 V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl.release(), &V8 TestTypedefs::wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independe nt);
252 v8SetReturnValue(info, wrapper); 252 v8SetReturnValue(info, wrapper);
253 } 253 }
254 254
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 fromInternalPointer(object)->deref(); 358 fromInternalPointer(object)->deref();
359 } 359 }
360 360
361 template<> 361 template<>
362 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate) 362 v8::Handle<v8::Value> toV8NoInline(TestTypedefs* impl, v8::Handle<v8::Object> cr eationContext, v8::Isolate* isolate)
363 { 363 {
364 return toV8(impl, creationContext, isolate); 364 return toV8(impl, creationContext, isolate);
365 } 365 }
366 366
367 } // namespace WebCore 367 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestSpecialOperations.cpp ('k') | Source/bindings/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698