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

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

Issue 2732093003: bindings: Add support for the record<K,V> WebIDL type. (Closed)
Patch Set: s/isolate->GetCurrentContext()/context/ Created 3 years, 9 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. 5 // This file has been auto-generated by code_generator_v8.py.
6 // DO NOT MODIFY! 6 // DO NOT MODIFY!
7 7
8 // This file has been generated from the Jinja2 template in 8 // This file has been generated from the Jinja2 template in
9 // third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl 9 // third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
10 10
11 // clang-format off 11 // clang-format off
12 #include "V8TestTypedefs.h" 12 #include "V8TestTypedefs.h"
13 13
14 #include "bindings/core/v8/ByteStringSequenceSequenceOrByteStringByteStringRecor d.h"
14 #include "bindings/core/v8/ExceptionState.h" 15 #include "bindings/core/v8/ExceptionState.h"
15 #include "bindings/core/v8/IDLTypes.h" 16 #include "bindings/core/v8/IDLTypes.h"
16 #include "bindings/core/v8/NativeValueTraitsImpl.h" 17 #include "bindings/core/v8/NativeValueTraitsImpl.h"
17 #include "bindings/core/v8/StringOrDouble.h" 18 #include "bindings/core/v8/StringOrDouble.h"
18 #include "bindings/core/v8/TestInterfaceOrTestInterfaceEmpty.h" 19 #include "bindings/core/v8/TestInterfaceOrTestInterfaceEmpty.h"
19 #include "bindings/core/v8/V8DOMConfiguration.h" 20 #include "bindings/core/v8/V8DOMConfiguration.h"
20 #include "bindings/core/v8/V8ObjectConstructor.h" 21 #include "bindings/core/v8/V8ObjectConstructor.h"
21 #include "bindings/core/v8/V8TestCallbackInterface.h" 22 #include "bindings/core/v8/V8TestCallbackInterface.h"
22 #include "bindings/core/v8/V8TestInterface.h" 23 #include "bindings/core/v8/V8TestInterface.h"
23 #include "bindings/core/v8/V8TestInterfaceEmpty.h" 24 #include "bindings/core/v8/V8TestInterfaceEmpty.h"
25 #include "bindings/core/v8/V8TestObject.h"
24 #include "core/dom/Document.h" 26 #include "core/dom/Document.h"
25 #include "core/frame/LocalDOMWindow.h" 27 #include "core/frame/LocalDOMWindow.h"
26 #include "wtf/GetPtr.h" 28 #include "wtf/GetPtr.h"
27 #include "wtf/RefPtr.h" 29 #include "wtf/RefPtr.h"
28 30
29 namespace blink { 31 namespace blink {
30 32
31 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial 33 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial
32 // and does not depend on another global objects. 34 // and does not depend on another global objects.
33 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 35 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 237 }
236 238
237 Vector<String> stringArrayArg; 239 Vector<String> stringArrayArg;
238 stringArrayArg = toImplArray<Vector<String>>(info[0], 1, info.GetIsolate(), ex ceptionState); 240 stringArrayArg = toImplArray<Vector<String>>(info[0], 1, info.GetIsolate(), ex ceptionState);
239 if (exceptionState.hadException()) 241 if (exceptionState.hadException())
240 return; 242 return;
241 243
242 v8SetReturnValue(info, ToV8(impl->stringArrayMethodStringArrayArg(stringArrayA rg), info.Holder(), info.GetIsolate())); 244 v8SetReturnValue(info, ToV8(impl->stringArrayMethodStringArrayArg(stringArrayA rg), info.Holder(), info.GetIsolate()));
243 } 245 }
244 246
247 static void methodTakingRecordMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
248 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont ext, "TestTypedefs", "methodTakingRecord");
249
250 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder());
251
252 if (UNLIKELY(info.Length() < 1)) {
253 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info. Length()));
254 return;
255 }
256
257 Vector<std::pair<String, int32_t>> arg;
258 arg = NativeValueTraits<IDLRecord<IDLByteString, IDLLong>>::nativeValue(info.G etIsolate(), info[0], exceptionState);
259 if (exceptionState.hadException())
260 return;
261
262 impl->methodTakingRecord(arg);
263 }
264
265 static void methodTakingOilpanValueRecordMethod(const v8::FunctionCallbackInfo<v 8::Value>& info) {
266 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont ext, "TestTypedefs", "methodTakingOilpanValueRecord");
267
268 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder());
269
270 if (UNLIKELY(info.Length() < 1)) {
271 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info. Length()));
272 return;
273 }
274
275 HeapVector<std::pair<String, Member<TestObject>>> arg;
276 arg = NativeValueTraits<IDLRecord<IDLUSVString, TestObject>>::nativeValue(info .GetIsolate(), info[0], exceptionState);
277 if (exceptionState.hadException())
278 return;
279
280 impl->methodTakingOilpanValueRecord(arg);
281 }
282
283 static void unionWithRecordMethodMethod(const v8::FunctionCallbackInfo<v8::Value >& info) {
284 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ExecutionCont ext, "TestTypedefs", "unionWithRecordMethod");
285
286 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder());
287
288 if (UNLIKELY(info.Length() < 1)) {
289 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info. Length()));
290 return;
291 }
292
293 ByteStringSequenceSequenceOrByteStringByteStringRecord arg;
294 V8ByteStringSequenceSequenceOrByteStringByteStringRecord::toImpl(info.GetIsola te(), info[0], arg, UnionTypeConversionMode::NotNullable, exceptionState);
295 if (exceptionState.hadException())
296 return;
297
298 v8SetReturnValue(info, impl->unionWithRecordMethod(arg));
299 }
300
301 static void methodThatReturnsRecordMethod(const v8::FunctionCallbackInfo<v8::Val ue>& info) {
302 TestTypedefs* impl = V8TestTypedefs::toImpl(info.Holder());
303
304 v8SetReturnValue(info, ToV8(impl->methodThatReturnsRecord(), info.Holder(), in fo.GetIsolate()));
305 }
306
245 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) { 307 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) {
246 if (UNLIKELY(info.Length() < 1)) { 308 if (UNLIKELY(info.Length() < 1)) {
247 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::faile dToConstruct("TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Lengt h()))); 309 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::faile dToConstruct("TestTypedefs", ExceptionMessages::notEnoughArguments(1, info.Lengt h())));
248 return; 310 return;
249 } 311 }
250 312
251 V8StringResource<> stringArg; 313 V8StringResource<> stringArg;
252 stringArg = info[0]; 314 stringArg = info[0];
253 if (!stringArg.prepare()) 315 if (!stringArg.prepare())
254 return; 316 return;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 368 }
307 369
308 void V8TestTypedefs::arrayOfStringsMethodArrayOfStringsArgMethodCallback(const v 8::FunctionCallbackInfo<v8::Value>& info) { 370 void V8TestTypedefs::arrayOfStringsMethodArrayOfStringsArgMethodCallback(const v 8::FunctionCallbackInfo<v8::Value>& info) {
309 TestTypedefsV8Internal::arrayOfStringsMethodArrayOfStringsArgMethod(info); 371 TestTypedefsV8Internal::arrayOfStringsMethodArrayOfStringsArgMethod(info);
310 } 372 }
311 373
312 void V8TestTypedefs::stringArrayMethodStringArrayArgMethodCallback(const v8::Fun ctionCallbackInfo<v8::Value>& info) { 374 void V8TestTypedefs::stringArrayMethodStringArrayArgMethodCallback(const v8::Fun ctionCallbackInfo<v8::Value>& info) {
313 TestTypedefsV8Internal::stringArrayMethodStringArrayArgMethod(info); 375 TestTypedefsV8Internal::stringArrayMethodStringArrayArgMethod(info);
314 } 376 }
315 377
378 void V8TestTypedefs::methodTakingRecordMethodCallback(const v8::FunctionCallback Info<v8::Value>& info) {
379 TestTypedefsV8Internal::methodTakingRecordMethod(info);
380 }
381
382 void V8TestTypedefs::methodTakingOilpanValueRecordMethodCallback(const v8::Funct ionCallbackInfo<v8::Value>& info) {
383 TestTypedefsV8Internal::methodTakingOilpanValueRecordMethod(info);
384 }
385
386 void V8TestTypedefs::unionWithRecordMethodMethodCallback(const v8::FunctionCallb ackInfo<v8::Value>& info) {
387 TestTypedefsV8Internal::unionWithRecordMethodMethod(info);
388 }
389
390 void V8TestTypedefs::methodThatReturnsRecordMethodCallback(const v8::FunctionCal lbackInfo<v8::Value>& info) {
391 TestTypedefsV8Internal::methodThatReturnsRecordMethod(info);
392 }
393
316 // Suppress warning: global constructors, because AttributeConfiguration is triv ial 394 // Suppress warning: global constructors, because AttributeConfiguration is triv ial
317 // and does not depend on another global objects. 395 // and does not depend on another global objects.
318 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 396 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
319 #pragma clang diagnostic push 397 #pragma clang diagnostic push
320 #pragma clang diagnostic ignored "-Wglobal-constructors" 398 #pragma clang diagnostic ignored "-Wglobal-constructors"
321 #endif 399 #endif
322 const V8DOMConfiguration::AttributeConfiguration V8TestTypedefsLazyDataAttribute s[] = { 400 const V8DOMConfiguration::AttributeConfiguration V8TestTypedefsLazyDataAttribute s[] = {
323 {"tAttribute", v8ConstructorAttributeGetter, nullptr, nullptr, nullptr, null ptr, const_cast<WrapperTypeInfo*>(&V8TestInterface::wrapperTypeInfo), static_cas t<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::OnInstance, V8DOMCon figuration::CheckHolder}, 401 {"tAttribute", v8ConstructorAttributeGetter, nullptr, nullptr, nullptr, null ptr, const_cast<WrapperTypeInfo*>(&V8TestInterface::wrapperTypeInfo), static_cas t<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::OnInstance, V8DOMCon figuration::CheckHolder},
324 }; 402 };
325 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 403 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
326 #pragma clang diagnostic pop 404 #pragma clang diagnostic pop
327 #endif 405 #endif
328 406
329 const V8DOMConfiguration::AccessorConfiguration V8TestTypedefsAccessors[] = { 407 const V8DOMConfiguration::AccessorConfiguration V8TestTypedefsAccessors[] = {
330 {"uLongLongAttribute", V8TestTypedefs::uLongLongAttributeAttributeGetterCall back, V8TestTypedefs::uLongLongAttributeAttributeSetterCallback, nullptr, nullpt r, nullptr, nullptr, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigur ation::OnPrototype, V8DOMConfiguration::CheckHolder}, 408 {"uLongLongAttribute", V8TestTypedefs::uLongLongAttributeAttributeGetterCall back, V8TestTypedefs::uLongLongAttributeAttributeSetterCallback, nullptr, nullpt r, nullptr, nullptr, static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigur ation::OnPrototype, V8DOMConfiguration::CheckHolder},
331 {"domStringOrDoubleOrNullAttribute", V8TestTypedefs::domStringOrDoubleOrNull AttributeAttributeGetterCallback, V8TestTypedefs::domStringOrDoubleOrNullAttribu teAttributeSetterCallback, nullptr, nullptr, nullptr, nullptr, static_cast<v8::P ropertyAttribute>(v8::None), V8DOMConfiguration::OnPrototype, V8DOMConfiguration ::CheckHolder}, 409 {"domStringOrDoubleOrNullAttribute", V8TestTypedefs::domStringOrDoubleOrNull AttributeAttributeGetterCallback, V8TestTypedefs::domStringOrDoubleOrNullAttribu teAttributeSetterCallback, nullptr, nullptr, nullptr, nullptr, static_cast<v8::P ropertyAttribute>(v8::None), V8DOMConfiguration::OnPrototype, V8DOMConfiguration ::CheckHolder},
332 }; 410 };
333 411
334 const V8DOMConfiguration::MethodConfiguration V8TestTypedefsMethods[] = { 412 const V8DOMConfiguration::MethodConfiguration V8TestTypedefsMethods[] = {
335 {"voidMethodArrayOfLongsArg", V8TestTypedefs::voidMethodArrayOfLongsArgMetho dCallback, nullptr, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfigura tion::CheckHolder, V8DOMConfiguration::DoNotCheckAccess}, 413 {"voidMethodArrayOfLongsArg", V8TestTypedefs::voidMethodArrayOfLongsArgMetho dCallback, nullptr, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfigura tion::CheckHolder, V8DOMConfiguration::DoNotCheckAccess},
336 {"voidMethodFloatArgStringArg", V8TestTypedefs::voidMethodFloatArgStringArgM ethodCallback, nullptr, 2, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfi guration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess}, 414 {"voidMethodFloatArgStringArg", V8TestTypedefs::voidMethodFloatArgStringArgM ethodCallback, nullptr, 2, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfi guration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess},
337 {"voidMethodTestCallbackInterfaceTypeArg", V8TestTypedefs::voidMethodTestCal lbackInterfaceTypeArgMethodCallback, nullptr, 1, v8::None, V8DOMConfiguration::O nPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAcces s}, 415 {"voidMethodTestCallbackInterfaceTypeArg", V8TestTypedefs::voidMethodTestCal lbackInterfaceTypeArgMethodCallback, nullptr, 1, v8::None, V8DOMConfiguration::O nPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAcces s},
338 {"uLongLongMethodTestInterfaceEmptyTypeSequenceArg", V8TestTypedefs::uLongLo ngMethodTestInterfaceEmptyTypeSequenceArgMethodCallback, nullptr, 1, v8::None, V 8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfigurat ion::DoNotCheckAccess}, 416 {"uLongLongMethodTestInterfaceEmptyTypeSequenceArg", V8TestTypedefs::uLongLo ngMethodTestInterfaceEmptyTypeSequenceArgMethodCallback, nullptr, 1, v8::None, V 8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfigurat ion::DoNotCheckAccess},
339 {"testInterfaceOrTestInterfaceEmptyMethod", V8TestTypedefs::testInterfaceOrT estInterfaceEmptyMethodMethodCallback, nullptr, 0, v8::None, V8DOMConfiguration: :OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAcc ess}, 417 {"testInterfaceOrTestInterfaceEmptyMethod", V8TestTypedefs::testInterfaceOrT estInterfaceEmptyMethodMethodCallback, nullptr, 0, v8::None, V8DOMConfiguration: :OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAcc ess},
340 {"domStringOrDoubleMethod", V8TestTypedefs::domStringOrDoubleMethodMethodCal lback, nullptr, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration ::CheckHolder, V8DOMConfiguration::DoNotCheckAccess}, 418 {"domStringOrDoubleMethod", V8TestTypedefs::domStringOrDoubleMethodMethodCal lback, nullptr, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration ::CheckHolder, V8DOMConfiguration::DoNotCheckAccess},
341 {"arrayOfStringsMethodArrayOfStringsArg", V8TestTypedefs::arrayOfStringsMeth odArrayOfStringsArgMethodCallback, nullptr, 1, v8::None, V8DOMConfiguration::OnP rototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess} , 419 {"arrayOfStringsMethodArrayOfStringsArg", V8TestTypedefs::arrayOfStringsMeth odArrayOfStringsArgMethodCallback, nullptr, 1, v8::None, V8DOMConfiguration::OnP rototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess} ,
342 {"stringArrayMethodStringArrayArg", V8TestTypedefs::stringArrayMethodStringA rrayArgMethodCallback, nullptr, 1, v8::None, V8DOMConfiguration::OnPrototype, V8 DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess}, 420 {"stringArrayMethodStringArrayArg", V8TestTypedefs::stringArrayMethodStringA rrayArgMethodCallback, nullptr, 1, v8::None, V8DOMConfiguration::OnPrototype, V8 DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess},
421 {"methodTakingRecord", V8TestTypedefs::methodTakingRecordMethodCallback, nul lptr, 1, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHol der, V8DOMConfiguration::DoNotCheckAccess},
422 {"methodTakingOilpanValueRecord", V8TestTypedefs::methodTakingOilpanValueRec ordMethodCallback, nullptr, 1, v8::None, V8DOMConfiguration::OnPrototype, V8DOMC onfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess},
423 {"unionWithRecordMethod", V8TestTypedefs::unionWithRecordMethodMethodCallbac k, nullptr, 1, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::Ch eckHolder, V8DOMConfiguration::DoNotCheckAccess},
424 {"methodThatReturnsRecord", V8TestTypedefs::methodThatReturnsRecordMethodCal lback, nullptr, 0, v8::None, V8DOMConfiguration::OnPrototype, V8DOMConfiguration ::CheckHolder, V8DOMConfiguration::DoNotCheckAccess},
343 }; 425 };
344 426
345 void V8TestTypedefs::constructorCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info) { 427 void V8TestTypedefs::constructorCallback(const v8::FunctionCallbackInfo<v8::Valu e>& info) {
346 if (!info.IsConstructCall()) { 428 if (!info.IsConstructCall()) {
347 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::const ructorNotCallableAsFunction("TestTypedefs")); 429 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::const ructorNotCallableAsFunction("TestTypedefs"));
348 return; 430 return;
349 } 431 }
350 432
351 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExisti ngObject) { 433 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExisti ngObject) {
352 v8SetReturnValue(info, info.Holder()); 434 v8SetReturnValue(info, info.Holder());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 471
390 TestTypedefs* V8TestTypedefs::toImplWithTypeCheck(v8::Isolate* isolate, v8::Loca l<v8::Value> value) { 472 TestTypedefs* V8TestTypedefs::toImplWithTypeCheck(v8::Isolate* isolate, v8::Loca l<v8::Value> value) {
391 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value) ) : nullptr; 473 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value) ) : nullptr;
392 } 474 }
393 475
394 TestTypedefs* NativeValueTraits<TestTypedefs>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) { 476 TestTypedefs* NativeValueTraits<TestTypedefs>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
395 return V8TestTypedefs::toImplWithTypeCheck(isolate, value); 477 return V8TestTypedefs::toImplWithTypeCheck(isolate, value);
396 } 478 }
397 479
398 } // namespace blink 480 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.h ('k') | third_party/WebKit/Source/core/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698