OLD | NEW |
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/dictionary_v8.cpp.tmpl | 9 // third_party/WebKit/Source/bindings/templates/dictionary_v8.cpp.tmpl |
10 | 10 |
11 // clang-format off | 11 // clang-format off |
12 #include "V8TestDictionary.h" | 12 #include "V8TestDictionary.h" |
13 | 13 |
14 #include "bindings/core/v8/Dictionary.h" | 14 #include "bindings/core/v8/Dictionary.h" |
15 #include "bindings/core/v8/DoubleOrString.h" | 15 #include "bindings/core/v8/DoubleOrString.h" |
16 #include "bindings/core/v8/ExceptionState.h" | 16 #include "bindings/core/v8/ExceptionState.h" |
| 17 #include "bindings/core/v8/IDLTypes.h" |
17 #include "bindings/core/v8/ScriptValue.h" | 18 #include "bindings/core/v8/ScriptValue.h" |
18 #include "bindings/core/v8/TestInterface2OrUint8Array.h" | 19 #include "bindings/core/v8/TestInterface2OrUint8Array.h" |
19 #include "bindings/core/v8/V8ArrayBufferView.h" | 20 #include "bindings/core/v8/V8ArrayBufferView.h" |
20 #include "bindings/core/v8/V8Element.h" | 21 #include "bindings/core/v8/V8Element.h" |
21 #include "bindings/core/v8/V8EventTarget.h" | 22 #include "bindings/core/v8/V8EventTarget.h" |
22 #include "bindings/core/v8/V8InternalDictionary.h" | 23 #include "bindings/core/v8/V8InternalDictionary.h" |
23 #include "bindings/core/v8/V8TestInterface.h" | 24 #include "bindings/core/v8/V8TestInterface.h" |
24 #include "bindings/core/v8/V8TestInterface2.h" | 25 #include "bindings/core/v8/V8TestInterface2.h" |
25 #include "bindings/core/v8/V8TestInterfaceGarbageCollected.h" | 26 #include "bindings/core/v8/V8TestInterfaceGarbageCollected.h" |
26 #include "bindings/core/v8/V8TestObject.h" | 27 #include "bindings/core/v8/V8TestObject.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 impl.setObjectOrNullMemberToNull(); | 298 impl.setObjectOrNullMemberToNull(); |
298 } else { | 299 } else { |
299 ScriptValue objectOrNullMember = ScriptValue(ScriptState::current(isolate),
objectOrNullMemberValue); | 300 ScriptValue objectOrNullMember = ScriptValue(ScriptState::current(isolate),
objectOrNullMemberValue); |
300 if (!objectOrNullMember.isObject()) { | 301 if (!objectOrNullMember.isObject()) { |
301 exceptionState.throwTypeError("member objectOrNullMember is not an object.
"); | 302 exceptionState.throwTypeError("member objectOrNullMember is not an object.
"); |
302 return; | 303 return; |
303 } | 304 } |
304 impl.setObjectOrNullMember(objectOrNullMember); | 305 impl.setObjectOrNullMember(objectOrNullMember); |
305 } | 306 } |
306 | 307 |
| 308 v8::Local<v8::Value> oilpanRecordMemberValue; |
| 309 if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "oilp
anRecordMember")).ToLocal(&oilpanRecordMemberValue)) { |
| 310 exceptionState.rethrowV8Exception(block.Exception()); |
| 311 return; |
| 312 } |
| 313 if (oilpanRecordMemberValue.IsEmpty() || oilpanRecordMemberValue->IsUndefined(
)) { |
| 314 // Do nothing. |
| 315 } else { |
| 316 HeapVector<std::pair<String, Member<TestObject>>> oilpanRecordMember = Nativ
eValueTraits<idl::Record<idl::USVString, TestObject>>::nativeValue(isolate, oilp
anRecordMemberValue, exceptionState); |
| 317 if (exceptionState.hadException()) |
| 318 return; |
| 319 impl.setOilpanRecordMember(oilpanRecordMember); |
| 320 } |
| 321 |
307 v8::Local<v8::Value> otherDoubleOrStringMemberValue; | 322 v8::Local<v8::Value> otherDoubleOrStringMemberValue; |
308 if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "othe
rDoubleOrStringMember")).ToLocal(&otherDoubleOrStringMemberValue)) { | 323 if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "othe
rDoubleOrStringMember")).ToLocal(&otherDoubleOrStringMemberValue)) { |
309 exceptionState.rethrowV8Exception(block.Exception()); | 324 exceptionState.rethrowV8Exception(block.Exception()); |
310 return; | 325 return; |
311 } | 326 } |
312 if (otherDoubleOrStringMemberValue.IsEmpty() || otherDoubleOrStringMemberValue
->IsUndefined()) { | 327 if (otherDoubleOrStringMemberValue.IsEmpty() || otherDoubleOrStringMemberValue
->IsUndefined()) { |
313 // Do nothing. | 328 // Do nothing. |
314 } else { | 329 } else { |
315 DoubleOrString otherDoubleOrStringMember; | 330 DoubleOrString otherDoubleOrStringMember; |
316 V8DoubleOrString::toImpl(isolate, otherDoubleOrStringMemberValue, otherDoubl
eOrStringMember, UnionTypeConversionMode::NotNullable, exceptionState); | 331 V8DoubleOrString::toImpl(isolate, otherDoubleOrStringMemberValue, otherDoubl
eOrStringMember, UnionTypeConversionMode::NotNullable, exceptionState); |
(...skipping 11 matching lines...) Expand all Loading... |
328 // Do nothing. | 343 // Do nothing. |
329 } else { | 344 } else { |
330 ScriptValue prefixGetMember = ScriptValue(ScriptState::current(isolate), pre
fixGetMemberValue); | 345 ScriptValue prefixGetMember = ScriptValue(ScriptState::current(isolate), pre
fixGetMemberValue); |
331 if (!prefixGetMember.isObject()) { | 346 if (!prefixGetMember.isObject()) { |
332 exceptionState.throwTypeError("member prefixGetMember is not an object."); | 347 exceptionState.throwTypeError("member prefixGetMember is not an object."); |
333 return; | 348 return; |
334 } | 349 } |
335 impl.setPrefixGetMember(prefixGetMember); | 350 impl.setPrefixGetMember(prefixGetMember); |
336 } | 351 } |
337 | 352 |
| 353 v8::Local<v8::Value> recordMemberValue; |
| 354 if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "reco
rdMember")).ToLocal(&recordMemberValue)) { |
| 355 exceptionState.rethrowV8Exception(block.Exception()); |
| 356 return; |
| 357 } |
| 358 if (recordMemberValue.IsEmpty() || recordMemberValue->IsUndefined()) { |
| 359 // Do nothing. |
| 360 } else { |
| 361 Vector<std::pair<String, int>> recordMember = NativeValueTraits<idl::Record<
idl::ByteString, idl::Byte>>::nativeValue(isolate, recordMemberValue, exceptionS
tate); |
| 362 if (exceptionState.hadException()) |
| 363 return; |
| 364 impl.setRecordMember(recordMember); |
| 365 } |
| 366 |
338 v8::Local<v8::Value> restrictedDoubleMemberValue; | 367 v8::Local<v8::Value> restrictedDoubleMemberValue; |
339 if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "rest
rictedDoubleMember")).ToLocal(&restrictedDoubleMemberValue)) { | 368 if (!v8Object->Get(isolate->GetCurrentContext(), v8AtomicString(isolate, "rest
rictedDoubleMember")).ToLocal(&restrictedDoubleMemberValue)) { |
340 exceptionState.rethrowV8Exception(block.Exception()); | 369 exceptionState.rethrowV8Exception(block.Exception()); |
341 return; | 370 return; |
342 } | 371 } |
343 if (restrictedDoubleMemberValue.IsEmpty() || restrictedDoubleMemberValue->IsUn
defined()) { | 372 if (restrictedDoubleMemberValue.IsEmpty() || restrictedDoubleMemberValue->IsUn
defined()) { |
344 // Do nothing. | 373 // Do nothing. |
345 } else { | 374 } else { |
346 double restrictedDoubleMember = toRestrictedDouble(isolate, restrictedDouble
MemberValue, exceptionState); | 375 double restrictedDoubleMember = toRestrictedDouble(isolate, restrictedDouble
MemberValue, exceptionState); |
347 if (exceptionState.hadException()) | 376 if (exceptionState.hadException()) |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 | 713 |
685 if (impl.hasObjectOrNullMember()) { | 714 if (impl.hasObjectOrNullMember()) { |
686 DCHECK(impl.objectOrNullMember().isObject()); | 715 DCHECK(impl.objectOrNullMember().isObject()); |
687 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "objectOrNullMember"), impl.objectOrNullMember().v8V
alue()))) | 716 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "objectOrNullMember"), impl.objectOrNullMember().v8V
alue()))) |
688 return false; | 717 return false; |
689 } else { | 718 } else { |
690 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "objectOrNullMember"), v8::Null(isolate)))) | 719 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "objectOrNullMember"), v8::Null(isolate)))) |
691 return false; | 720 return false; |
692 } | 721 } |
693 | 722 |
| 723 if (impl.hasOilpanRecordMember()) { |
| 724 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "oilpanRecordMember"), ToV8(impl.oilpanRecordMember(
), creationContext, isolate)))) |
| 725 return false; |
| 726 } |
| 727 |
694 if (impl.hasOtherDoubleOrStringMember()) { | 728 if (impl.hasOtherDoubleOrStringMember()) { |
695 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "otherDoubleOrStringMember"), ToV8(impl.otherDoubleO
rStringMember(), creationContext, isolate)))) | 729 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "otherDoubleOrStringMember"), ToV8(impl.otherDoubleO
rStringMember(), creationContext, isolate)))) |
696 return false; | 730 return false; |
697 } else { | 731 } else { |
698 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "otherDoubleOrStringMember"), ToV8(DoubleOrString::f
romString("default string value"), creationContext, isolate)))) | 732 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "otherDoubleOrStringMember"), ToV8(DoubleOrString::f
romString("default string value"), creationContext, isolate)))) |
699 return false; | 733 return false; |
700 } | 734 } |
701 | 735 |
702 if (impl.hasPrefixGetMember()) { | 736 if (impl.hasPrefixGetMember()) { |
703 DCHECK(impl.getPrefixGetMember().isObject()); | 737 DCHECK(impl.getPrefixGetMember().isObject()); |
704 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "prefixGetMember"), impl.getPrefixGetMember().v8Valu
e()))) | 738 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "prefixGetMember"), impl.getPrefixGetMember().v8Valu
e()))) |
705 return false; | 739 return false; |
706 } | 740 } |
707 | 741 |
| 742 if (impl.hasRecordMember()) { |
| 743 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "recordMember"), ToV8(impl.recordMember(), creationC
ontext, isolate)))) |
| 744 return false; |
| 745 } |
| 746 |
708 if (impl.hasRestrictedDoubleMember()) { | 747 if (impl.hasRestrictedDoubleMember()) { |
709 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "restrictedDoubleMember"), v8::Number::New(isolate,
impl.restrictedDoubleMember())))) | 748 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "restrictedDoubleMember"), v8::Number::New(isolate,
impl.restrictedDoubleMember())))) |
710 return false; | 749 return false; |
711 } else { | 750 } else { |
712 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "restrictedDoubleMember"), v8::Number::New(isolate,
3.14)))) | 751 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "restrictedDoubleMember"), v8::Number::New(isolate,
3.14)))) |
713 return false; | 752 return false; |
714 } | 753 } |
715 | 754 |
716 if (impl.hasRuntimeMember()) { | 755 if (impl.hasRuntimeMember()) { |
717 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "runtimeMember"), v8Boolean(impl.runtimeMember(), is
olate)))) | 756 if (!v8CallBoolean(dictionary->CreateDataProperty(isolate->GetCurrentContext
(), v8AtomicString(isolate, "runtimeMember"), v8Boolean(impl.runtimeMember(), is
olate)))) |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 return true; | 851 return true; |
813 } | 852 } |
814 | 853 |
815 TestDictionary NativeValueTraits<TestDictionary>::nativeValue(v8::Isolate* isola
te, v8::Local<v8::Value> value, ExceptionState& exceptionState) { | 854 TestDictionary NativeValueTraits<TestDictionary>::nativeValue(v8::Isolate* isola
te, v8::Local<v8::Value> value, ExceptionState& exceptionState) { |
816 TestDictionary impl; | 855 TestDictionary impl; |
817 V8TestDictionary::toImpl(isolate, value, impl, exceptionState); | 856 V8TestDictionary::toImpl(isolate, value, impl, exceptionState); |
818 return impl; | 857 return impl; |
819 } | 858 } |
820 | 859 |
821 } // namespace blink | 860 } // namespace blink |
OLD | NEW |