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

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

Issue 2301993002: binding: Introduces ExceptionToPromiseScope. (Closed)
Patch Set: Addressed review comments (rename, empty line). 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 // 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 "V8TestTypedefs.h" 7 #include "V8TestTypedefs.h"
8 8
9 #include "bindings/core/v8/ExceptionState.h" 9 #include "bindings/core/v8/ExceptionState.h"
10 #include "bindings/core/v8/GeneratedCodeHelper.h" 10 #include "bindings/core/v8/GeneratedCodeHelper.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 110
111 void domStringOrDoubleOrNullAttributeAttributeSetterCallback(const v8::FunctionC allbackInfo<v8::Value>& info) 111 void domStringOrDoubleOrNullAttributeAttributeSetterCallback(const v8::FunctionC allbackInfo<v8::Value>& info)
112 { 112 {
113 v8::Local<v8::Value> v8Value = info[0]; 113 v8::Local<v8::Value> v8Value = info[0];
114 TestTypedefsV8Internal::domStringOrDoubleOrNullAttributeAttributeSetter(v8Va lue, info); 114 TestTypedefsV8Internal::domStringOrDoubleOrNullAttributeAttributeSetter(v8Va lue, info);
115 } 115 }
116 116
117 static void voidMethodArrayOfLongsArgMethod(const v8::FunctionCallbackInfo<v8::V alue>& info) 117 static void voidMethodArrayOfLongsArgMethod(const v8::FunctionCallbackInfo<v8::V alue>& info)
118 { 118 {
119 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodA rrayOfLongsArg", "TestTypedefs", info.Holder(), info.GetIsolate()); 119 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo ntext, "TestTypedefs", "voidMethodArrayOfLongsArg");
120
120 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); 121 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder());
122
121 Vector<int> arrayOfLongsArg; 123 Vector<int> arrayOfLongsArg;
122 { 124 int numArgsPassed = info.Length();
123 int numArgsPassed = info.Length(); 125 while (numArgsPassed > 0) {
124 while (numArgsPassed > 0) { 126 if (!info[numArgsPassed - 1]->IsUndefined())
125 if (!info[numArgsPassed - 1]->IsUndefined()) 127 break;
126 break; 128 --numArgsPassed;
127 --numArgsPassed;
128 }
129 if (UNLIKELY(numArgsPassed <= 0)) {
130 impl->voidMethodArrayOfLongsArg();
131 return;
132 }
133 arrayOfLongsArg = toImplArray<Vector<int>>(info[0], 1, info.GetIsolate() , exceptionState);
134 if (exceptionState.hadException())
135 return;
136 } 129 }
130 if (UNLIKELY(numArgsPassed <= 0)) {
131 impl->voidMethodArrayOfLongsArg();
132 return;
133 }
134 arrayOfLongsArg = toImplArray<Vector<int>>(info[0], 1, info.GetIsolate(), ex ceptionState);
135 if (exceptionState.hadException())
136 return;
137
137 impl->voidMethodArrayOfLongsArg(arrayOfLongsArg); 138 impl->voidMethodArrayOfLongsArg(arrayOfLongsArg);
138 } 139 }
139 140
140 static void voidMethodArrayOfLongsArgMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info) 141 static void voidMethodArrayOfLongsArgMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info)
141 { 142 {
142 TestTypedefsV8Internal::voidMethodArrayOfLongsArgMethod(info); 143 TestTypedefsV8Internal::voidMethodArrayOfLongsArgMethod(info);
143 } 144 }
144 145
145 static void voidMethodFloatArgStringArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info) 146 static void voidMethodFloatArgStringArgMethod(const v8::FunctionCallbackInfo<v8: :Value>& info)
146 { 147 {
147 ExceptionState exceptionState(ExceptionState::ExecutionContext, "voidMethodF loatArgStringArg", "TestTypedefs", info.Holder(), info.GetIsolate()); 148 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo ntext, "TestTypedefs", "voidMethodFloatArgStringArg");
149
150 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder());
151
148 if (UNLIKELY(info.Length() < 2)) { 152 if (UNLIKELY(info.Length() < 2)) {
149 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 153 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
150 return; 154 return;
151 } 155 }
152 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); 156
153 float floatArg; 157 float floatArg;
154 V8StringResource<> stringArg; 158 V8StringResource<> stringArg;
155 { 159 floatArg = toRestrictedFloat(info.GetIsolate(), info[0], exceptionState);
156 floatArg = toRestrictedFloat(info.GetIsolate(), info[0], exceptionState) ; 160 if (exceptionState.hadException())
157 if (exceptionState.hadException()) 161 return;
158 return; 162
159 stringArg = info[1]; 163 stringArg = info[1];
160 if (!stringArg.prepare()) 164 if (!stringArg.prepare())
161 return; 165 return;
162 } 166
163 impl->voidMethodFloatArgStringArg(floatArg, stringArg); 167 impl->voidMethodFloatArgStringArg(floatArg, stringArg);
164 } 168 }
165 169
166 static void voidMethodFloatArgStringArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info) 170 static void voidMethodFloatArgStringArgMethodCallback(const v8::FunctionCallback Info<v8::Value>& info)
167 { 171 {
168 TestTypedefsV8Internal::voidMethodFloatArgStringArgMethod(info); 172 TestTypedefsV8Internal::voidMethodFloatArgStringArgMethod(info);
169 } 173 }
170 174
171 static void voidMethodTestCallbackInterfaceTypeArgMethod(const v8::FunctionCallb ackInfo<v8::Value>& info) 175 static void voidMethodTestCallbackInterfaceTypeArgMethod(const v8::FunctionCallb ackInfo<v8::Value>& info)
172 { 176 {
177 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder());
178
173 if (UNLIKELY(info.Length() < 1)) { 179 if (UNLIKELY(info.Length() < 1)) {
174 V8ThrowException::throwException(info.GetIsolate(), V8ThrowException::cr eateTypeError(info.GetIsolate(), ExceptionMessages::failedToExecute("voidMethodT estCallbackInterfaceTypeArg", "TestTypedefs", ExceptionMessages::notEnoughArgume nts(1, info.Length())))); 180 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::f ailedToExecute("voidMethodTestCallbackInterfaceTypeArg", "TestTypedefs", Excepti onMessages::notEnoughArguments(1, info.Length())));
175 return; 181 return;
176 } 182 }
177 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); 183
178 TestCallbackInterface* testCallbackInterfaceTypeArg; 184 TestCallbackInterface* testCallbackInterfaceTypeArg;
179 { 185 if (info.Length() <= 0 || !info[0]->IsFunction()) {
180 if (info.Length() <= 0 || !info[0]->IsFunction()) { 186 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::f ailedToExecute("voidMethodTestCallbackInterfaceTypeArg", "TestTypedefs", "The ca llback provided as parameter 1 is not a function."));
181 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessage s::failedToExecute("voidMethodTestCallbackInterfaceTypeArg", "TestTypedefs", "Th e callback provided as parameter 1 is not a function.")); 187
182 return; 188 return;
183 }
184 testCallbackInterfaceTypeArg = V8TestCallbackInterface::create(v8::Local <v8::Function>::Cast(info[0]), ScriptState::current(info.GetIsolate()));
185 } 189 }
190 testCallbackInterfaceTypeArg = V8TestCallbackInterface::create(v8::Local<v8: :Function>::Cast(info[0]), ScriptState::current(info.GetIsolate()));
191
186 impl->voidMethodTestCallbackInterfaceTypeArg(testCallbackInterfaceTypeArg); 192 impl->voidMethodTestCallbackInterfaceTypeArg(testCallbackInterfaceTypeArg);
187 } 193 }
188 194
189 static void voidMethodTestCallbackInterfaceTypeArgMethodCallback(const v8::Funct ionCallbackInfo<v8::Value>& info) 195 static void voidMethodTestCallbackInterfaceTypeArgMethodCallback(const v8::Funct ionCallbackInfo<v8::Value>& info)
190 { 196 {
191 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceTypeArgMethod(info); 197 TestTypedefsV8Internal::voidMethodTestCallbackInterfaceTypeArgMethod(info);
192 } 198 }
193 199
194 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethod(const v8::Fun ctionCallbackInfo<v8::Value>& info) 200 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethod(const v8::Fun ctionCallbackInfo<v8::Value>& info)
195 { 201 {
196 ExceptionState exceptionState(ExceptionState::ExecutionContext, "uLongLongMe thodTestInterfaceEmptyTypeSequenceArg", "TestTypedefs", info.Holder(), info.GetI solate()); 202 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo ntext, "TestTypedefs", "uLongLongMethodTestInterfaceEmptyTypeSequenceArg");
203
204 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder());
205
197 if (UNLIKELY(info.Length() < 1)) { 206 if (UNLIKELY(info.Length() < 1)) {
198 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 207 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
199 return; 208 return;
200 } 209 }
201 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); 210
202 HeapVector<Member<TestInterfaceEmpty>> testInterfaceEmptyTypeSequenceArg; 211 HeapVector<Member<TestInterfaceEmpty>> testInterfaceEmptyTypeSequenceArg;
203 { 212 testInterfaceEmptyTypeSequenceArg = (toMemberNativeArray<TestInterfaceEmpty> (info[0], 1, info.GetIsolate(), exceptionState));
204 testInterfaceEmptyTypeSequenceArg = (toMemberNativeArray<TestInterfaceEm pty>(info[0], 1, info.GetIsolate(), exceptionState)); 213 if (exceptionState.hadException())
205 if (exceptionState.hadException()) 214 return;
206 return; 215
207 }
208 v8SetReturnValue(info, static_cast<double>(impl->uLongLongMethodTestInterfac eEmptyTypeSequenceArg(testInterfaceEmptyTypeSequenceArg))); 216 v8SetReturnValue(info, static_cast<double>(impl->uLongLongMethodTestInterfac eEmptyTypeSequenceArg(testInterfaceEmptyTypeSequenceArg)));
209 } 217 }
210 218
211 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) 219 static void uLongLongMethodTestInterfaceEmptyTypeSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
212 { 220 {
213 TestTypedefsV8Internal::uLongLongMethodTestInterfaceEmptyTypeSequenceArgMeth od(info); 221 TestTypedefsV8Internal::uLongLongMethodTestInterfaceEmptyTypeSequenceArgMeth od(info);
214 } 222 }
215 223
216 static void testInterfaceOrTestInterfaceEmptyMethodMethod(const v8::FunctionCall backInfo<v8::Value>& info) 224 static void testInterfaceOrTestInterfaceEmptyMethodMethod(const v8::FunctionCall backInfo<v8::Value>& info)
217 { 225 {
218 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); 226 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder());
227
219 TestInterfaceOrTestInterfaceEmpty result; 228 TestInterfaceOrTestInterfaceEmpty result;
220 impl->testInterfaceOrTestInterfaceEmptyMethod(result); 229 impl->testInterfaceOrTestInterfaceEmptyMethod(result);
221 v8SetReturnValue(info, result); 230 v8SetReturnValue(info, result);
222 } 231 }
223 232
224 static void testInterfaceOrTestInterfaceEmptyMethodMethodCallback(const v8::Func tionCallbackInfo<v8::Value>& info) 233 static void testInterfaceOrTestInterfaceEmptyMethodMethodCallback(const v8::Func tionCallbackInfo<v8::Value>& info)
225 { 234 {
226 TestTypedefsV8Internal::testInterfaceOrTestInterfaceEmptyMethodMethod(info); 235 TestTypedefsV8Internal::testInterfaceOrTestInterfaceEmptyMethodMethod(info);
227 } 236 }
228 237
229 static void domStringOrDoubleMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info) 238 static void domStringOrDoubleMethodMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info)
230 { 239 {
231 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); 240 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder());
241
232 StringOrDouble result; 242 StringOrDouble result;
233 impl->domStringOrDoubleMethod(result); 243 impl->domStringOrDoubleMethod(result);
234 v8SetReturnValue(info, result); 244 v8SetReturnValue(info, result);
235 } 245 }
236 246
237 static void domStringOrDoubleMethodMethodCallback(const v8::FunctionCallbackInfo <v8::Value>& info) 247 static void domStringOrDoubleMethodMethodCallback(const v8::FunctionCallbackInfo <v8::Value>& info)
238 { 248 {
239 TestTypedefsV8Internal::domStringOrDoubleMethodMethod(info); 249 TestTypedefsV8Internal::domStringOrDoubleMethodMethod(info);
240 } 250 }
241 251
242 static void arrayOfStringsMethodArrayOfStringsArgMethod(const v8::FunctionCallba ckInfo<v8::Value>& info) 252 static void arrayOfStringsMethodArrayOfStringsArgMethod(const v8::FunctionCallba ckInfo<v8::Value>& info)
243 { 253 {
244 ExceptionState exceptionState(ExceptionState::ExecutionContext, "arrayOfStri ngsMethodArrayOfStringsArg", "TestTypedefs", info.Holder(), info.GetIsolate()); 254 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo ntext, "TestTypedefs", "arrayOfStringsMethodArrayOfStringsArg");
255
256 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder());
257
245 if (UNLIKELY(info.Length() < 1)) { 258 if (UNLIKELY(info.Length() < 1)) {
246 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 259 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
247 return; 260 return;
248 } 261 }
249 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); 262
250 Vector<String> arrayOfStringsArg; 263 Vector<String> arrayOfStringsArg;
251 { 264 arrayOfStringsArg = toImplArray<Vector<String>>(info[0], 1, info.GetIsolate( ), exceptionState);
252 arrayOfStringsArg = toImplArray<Vector<String>>(info[0], 1, info.GetIsol ate(), exceptionState); 265 if (exceptionState.hadException())
253 if (exceptionState.hadException()) 266 return;
254 return; 267
255 }
256 v8SetReturnValue(info, toV8(impl->arrayOfStringsMethodArrayOfStringsArg(arra yOfStringsArg), info.Holder(), info.GetIsolate())); 268 v8SetReturnValue(info, toV8(impl->arrayOfStringsMethodArrayOfStringsArg(arra yOfStringsArg), info.Holder(), info.GetIsolate()));
257 } 269 }
258 270
259 static void arrayOfStringsMethodArrayOfStringsArgMethodCallback(const v8::Functi onCallbackInfo<v8::Value>& info) 271 static void arrayOfStringsMethodArrayOfStringsArgMethodCallback(const v8::Functi onCallbackInfo<v8::Value>& info)
260 { 272 {
261 TestTypedefsV8Internal::arrayOfStringsMethodArrayOfStringsArgMethod(info); 273 TestTypedefsV8Internal::arrayOfStringsMethodArrayOfStringsArgMethod(info);
262 } 274 }
263 275
264 static void stringArrayMethodStringArrayArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info) 276 static void stringArrayMethodStringArrayArgMethod(const v8::FunctionCallbackInfo <v8::Value>& info)
265 { 277 {
266 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray MethodStringArrayArg", "TestTypedefs", info.Holder(), info.GetIsolate()); 278 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCo ntext, "TestTypedefs", "stringArrayMethodStringArrayArg");
279
280 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder());
281
267 if (UNLIKELY(info.Length() < 1)) { 282 if (UNLIKELY(info.Length() < 1)) {
268 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 283 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
269 return; 284 return;
270 } 285 }
271 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder()); 286
272 Vector<String> stringArrayArg; 287 Vector<String> stringArrayArg;
273 { 288 stringArrayArg = toImplArray<Vector<String>>(info[0], 1, info.GetIsolate(), exceptionState);
274 stringArrayArg = toImplArray<Vector<String>>(info[0], 1, info.GetIsolate (), exceptionState); 289 if (exceptionState.hadException())
275 if (exceptionState.hadException()) 290 return;
276 return; 291
277 }
278 v8SetReturnValue(info, toV8(impl->stringArrayMethodStringArrayArg(stringArra yArg), info.Holder(), info.GetIsolate())); 292 v8SetReturnValue(info, toV8(impl->stringArrayMethodStringArrayArg(stringArra yArg), info.Holder(), info.GetIsolate()));
279 } 293 }
280 294
281 static void stringArrayMethodStringArrayArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info) 295 static void stringArrayMethodStringArrayArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info)
282 { 296 {
283 TestTypedefsV8Internal::stringArrayMethodStringArrayArgMethod(info); 297 TestTypedefsV8Internal::stringArrayMethodStringArrayArgMethod(info);
284 } 298 }
285 299
286 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) 300 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
287 { 301 {
288 if (UNLIKELY(info.Length() < 1)) { 302 if (UNLIKELY(info.Length() < 1)) {
289 V8ThrowException::throwException(info.GetIsolate(), V8ThrowException::cr eateTypeError(info.GetIsolate(), ExceptionMessages::failedToConstruct("TestTyped efs", ExceptionMessages::notEnoughArguments(1, info.Length())))); 303 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::f ailedToConstruct("TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.L ength())));
290 return; 304 return;
291 } 305 }
306
292 V8StringResource<> stringArg; 307 V8StringResource<> stringArg;
293 { 308 stringArg = info[0];
294 stringArg = info[0]; 309 if (!stringArg.prepare())
295 if (!stringArg.prepare()) 310 return;
296 return; 311
297 }
298 TestTypedefs* impl = TestTypedefs::create(stringArg); 312 TestTypedefs* impl = TestTypedefs::create(stringArg);
299 v8::Local<v8::Object> wrapper = info.Holder(); 313 v8::Local<v8::Object> wrapper = info.Holder();
300 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestTypedefs::wra pperTypeInfo, wrapper); 314 wrapper = impl->associateWithWrapper(info.GetIsolate(), &V8TestTypedefs::wra pperTypeInfo, wrapper);
301 v8SetReturnValue(info, wrapper); 315 v8SetReturnValue(info, wrapper);
302 } 316 }
303 317
304 } // namespace TestTypedefsV8Internal 318 } // namespace TestTypedefsV8Internal
305 319
306 // Suppress warning: global constructors, because AttributeConfiguration is triv ial 320 // Suppress warning: global constructors, because AttributeConfiguration is triv ial
307 // and does not depend on another global objects. 321 // and does not depend on another global objects.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 { 393 {
380 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value); 394 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value);
381 } 395 }
382 396
383 TestTypedefs* V8TestTypedefs::toImplWithTypeCheck(v8::Isolate* isolate, v8::Loca l<v8::Value> value) 397 TestTypedefs* V8TestTypedefs::toImplWithTypeCheck(v8::Isolate* isolate, v8::Loca l<v8::Value> value)
384 { 398 {
385 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu e)) : nullptr; 399 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu e)) : nullptr;
386 } 400 }
387 401
388 } // namespace blink 402 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698