| 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. 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 "V8TestDictionary.h" | 8 #include "V8TestDictionary.h" |
| 9 | 9 |
| 10 #include "bindings/core/v8/ExceptionState.h" | 10 #include "bindings/core/v8/ExceptionState.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 if (block.HasCaught()) { | 123 if (block.HasCaught()) { |
| 124 exceptionState.rethrowV8Exception(block.Exception()); | 124 exceptionState.rethrowV8Exception(block.Exception()); |
| 125 return; | 125 return; |
| 126 } | 126 } |
| 127 if (enumMemberValue.IsEmpty() || enumMemberValue->IsUndefined()) { | 127 if (enumMemberValue.IsEmpty() || enumMemberValue->IsUndefined()) { |
| 128 // Do nothing. | 128 // Do nothing. |
| 129 } else { | 129 } else { |
| 130 V8StringResource<> enumMember = enumMemberValue; | 130 V8StringResource<> enumMember = enumMemberValue; |
| 131 if (!enumMember.prepare(exceptionState)) | 131 if (!enumMember.prepare(exceptionState)) |
| 132 return; | 132 return; |
| 133 String string = enumMember; | 133 static const char* validValues[] = { |
| 134 if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" |
| string == "EnumValue3")) { | 134 "", |
| 135 exceptionState.throwTypeError("member enumMember ('" + string + "')
is not a valid enum value."); | 135 "EnumValue1", |
| 136 "EnumValue2", |
| 137 "EnumValue3", |
| 138 }; |
| 139 if (!isValidEnum(enumMember, validValues, WTF_ARRAY_LENGTH(validValues),
exceptionState)) |
| 136 return; | 140 return; |
| 137 } | |
| 138 impl.setEnumMember(enumMember); | 141 impl.setEnumMember(enumMember); |
| 139 } | 142 } |
| 140 | 143 |
| 144 v8::Local<v8::Value> enumSequenceMemberValue = v8Object->Get(v8String(isolat
e, "enumSequenceMember")); |
| 145 if (block.HasCaught()) { |
| 146 exceptionState.rethrowV8Exception(block.Exception()); |
| 147 return; |
| 148 } |
| 149 if (enumSequenceMemberValue.IsEmpty() || enumSequenceMemberValue->IsUndefine
d()) { |
| 150 // Do nothing. |
| 151 } else { |
| 152 Vector<String> enumSequenceMember = toImplArray<String>(enumSequenceMemb
erValue, 0, isolate, exceptionState); |
| 153 if (exceptionState.hadException()) |
| 154 return; |
| 155 static const char* validValues[] = { |
| 156 "", |
| 157 "EnumValue1", |
| 158 "EnumValue2", |
| 159 "EnumValue3", |
| 160 }; |
| 161 if (!isValidEnum(enumSequenceMember, validValues, WTF_ARRAY_LENGTH(valid
Values), exceptionState)) |
| 162 return; |
| 163 impl.setEnumSequenceMember(enumSequenceMember); |
| 164 } |
| 165 |
| 141 v8::Local<v8::Value> eventTargetMemberValue = v8Object->Get(v8String(isolate
, "eventTargetMember")); | 166 v8::Local<v8::Value> eventTargetMemberValue = v8Object->Get(v8String(isolate
, "eventTargetMember")); |
| 142 if (block.HasCaught()) { | 167 if (block.HasCaught()) { |
| 143 exceptionState.rethrowV8Exception(block.Exception()); | 168 exceptionState.rethrowV8Exception(block.Exception()); |
| 144 return; | 169 return; |
| 145 } | 170 } |
| 146 if (eventTargetMemberValue.IsEmpty() || eventTargetMemberValue->IsUndefined(
)) { | 171 if (eventTargetMemberValue.IsEmpty() || eventTargetMemberValue->IsUndefined(
)) { |
| 147 // Do nothing. | 172 // Do nothing. |
| 148 } else { | 173 } else { |
| 149 EventTarget* eventTargetMember = toEventTarget(isolate, eventTargetMembe
rValue); | 174 EventTarget* eventTargetMember = toEventTarget(isolate, eventTargetMembe
rValue); |
| 150 if (!eventTargetMember && !eventTargetMemberValue->IsNull()) { | 175 if (!eventTargetMember && !eventTargetMemberValue->IsNull()) { |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 if (impl.hasElementOrNullMember()) { | 513 if (impl.hasElementOrNullMember()) { |
| 489 dictionary->Set(v8String(isolate, "elementOrNullMember"), toV8(impl.elem
entOrNullMember(), creationContext, isolate)); | 514 dictionary->Set(v8String(isolate, "elementOrNullMember"), toV8(impl.elem
entOrNullMember(), creationContext, isolate)); |
| 490 } | 515 } |
| 491 | 516 |
| 492 if (impl.hasEnumMember()) { | 517 if (impl.hasEnumMember()) { |
| 493 dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, impl.
enumMember())); | 518 dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, impl.
enumMember())); |
| 494 } else { | 519 } else { |
| 495 dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, Strin
g("foo"))); | 520 dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, Strin
g("foo"))); |
| 496 } | 521 } |
| 497 | 522 |
| 523 if (impl.hasEnumSequenceMember()) { |
| 524 dictionary->Set(v8String(isolate, "enumSequenceMember"), toV8(impl.enumS
equenceMember(), creationContext, isolate)); |
| 525 } |
| 526 |
| 498 if (impl.hasEventTargetMember()) { | 527 if (impl.hasEventTargetMember()) { |
| 499 dictionary->Set(v8String(isolate, "eventTargetMember"), toV8(impl.eventT
argetMember(), creationContext, isolate)); | 528 dictionary->Set(v8String(isolate, "eventTargetMember"), toV8(impl.eventT
argetMember(), creationContext, isolate)); |
| 500 } | 529 } |
| 501 | 530 |
| 502 if (impl.hasInternalDictionarySequenceMember()) { | 531 if (impl.hasInternalDictionarySequenceMember()) { |
| 503 dictionary->Set(v8String(isolate, "internalDictionarySequenceMember"), t
oV8(impl.internalDictionarySequenceMember(), creationContext, isolate)); | 532 dictionary->Set(v8String(isolate, "internalDictionarySequenceMember"), t
oV8(impl.internalDictionarySequenceMember(), creationContext, isolate)); |
| 504 } | 533 } |
| 505 | 534 |
| 506 if (impl.hasLongMember()) { | 535 if (impl.hasLongMember()) { |
| 507 dictionary->Set(v8String(isolate, "longMember"), v8::Integer::New(isolat
e, impl.longMember())); | 536 dictionary->Set(v8String(isolate, "longMember"), v8::Integer::New(isolat
e, impl.longMember())); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 } | 619 } |
| 591 | 620 |
| 592 TestDictionary NativeValueTraits<TestDictionary>::nativeValue(v8::Isolate* isola
te, v8::Local<v8::Value> value, ExceptionState& exceptionState) | 621 TestDictionary NativeValueTraits<TestDictionary>::nativeValue(v8::Isolate* isola
te, v8::Local<v8::Value> value, ExceptionState& exceptionState) |
| 593 { | 622 { |
| 594 TestDictionary impl; | 623 TestDictionary impl; |
| 595 V8TestDictionary::toImpl(isolate, value, impl, exceptionState); | 624 V8TestDictionary::toImpl(isolate, value, impl, exceptionState); |
| 596 return impl; | 625 return impl; |
| 597 } | 626 } |
| 598 | 627 |
| 599 } // namespace blink | 628 } // namespace blink |
| OLD | NEW |