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)) ) { | |
140 exceptionState.throwTypeError("member enumMember ('" + toCoreString( isolate, enumMemberValue) + "') is not a valid enum value."); | |
136 return; | 141 return; |
137 } | 142 } |
138 impl.setEnumMember(enumMember); | 143 impl.setEnumMember(enumMember); |
139 } | 144 } |
140 | 145 |
146 v8::Local<v8::Value> enumSequenceMemberValue = v8Object->Get(v8String(isolat e, "enumSequenceMember")); | |
147 if (block.HasCaught()) { | |
148 exceptionState.rethrowV8Exception(block.Exception()); | |
149 return; | |
150 } | |
151 if (enumSequenceMemberValue.IsEmpty() || enumSequenceMemberValue->IsUndefine d()) { | |
152 // Do nothing. | |
153 } else { | |
154 Vector<String> enumSequenceMember = toImplArray<String>(enumSequenceMemb erValue, 0, isolate, exceptionState); | |
155 if (exceptionState.hadException()) | |
156 return; | |
157 static const char* validValues[] = { | |
158 "", | |
159 "EnumValue1", | |
160 "EnumValue2", | |
161 "EnumValue3", | |
162 }; | |
163 if (!isValidEnum(enumSequenceMember, validValues, WTF_ARRAY_LENGTH(valid Values))) { | |
164 exceptionState.throwTypeError("member enumSequenceMember ('" + toCor eString(isolate, enumSequenceMemberValue) + "') is not a valid enum value."); | |
haraken
2015/04/01 01:27:25
Shall we move the for loop from isValidEnum to the
| |
165 return; | |
166 } | |
167 impl.setEnumSequenceMember(enumSequenceMember); | |
168 } | |
169 | |
141 v8::Local<v8::Value> eventTargetMemberValue = v8Object->Get(v8String(isolate , "eventTargetMember")); | 170 v8::Local<v8::Value> eventTargetMemberValue = v8Object->Get(v8String(isolate , "eventTargetMember")); |
142 if (block.HasCaught()) { | 171 if (block.HasCaught()) { |
143 exceptionState.rethrowV8Exception(block.Exception()); | 172 exceptionState.rethrowV8Exception(block.Exception()); |
144 return; | 173 return; |
145 } | 174 } |
146 if (eventTargetMemberValue.IsEmpty() || eventTargetMemberValue->IsUndefined( )) { | 175 if (eventTargetMemberValue.IsEmpty() || eventTargetMemberValue->IsUndefined( )) { |
147 // Do nothing. | 176 // Do nothing. |
148 } else { | 177 } else { |
149 EventTarget* eventTargetMember = toEventTarget(isolate, eventTargetMembe rValue); | 178 EventTarget* eventTargetMember = toEventTarget(isolate, eventTargetMembe rValue); |
150 if (!eventTargetMember && !eventTargetMemberValue->IsNull()) { | 179 if (!eventTargetMember && !eventTargetMemberValue->IsNull()) { |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 if (impl.hasElementOrNullMember()) { | 517 if (impl.hasElementOrNullMember()) { |
489 dictionary->Set(v8String(isolate, "elementOrNullMember"), toV8(impl.elem entOrNullMember(), creationContext, isolate)); | 518 dictionary->Set(v8String(isolate, "elementOrNullMember"), toV8(impl.elem entOrNullMember(), creationContext, isolate)); |
490 } | 519 } |
491 | 520 |
492 if (impl.hasEnumMember()) { | 521 if (impl.hasEnumMember()) { |
493 dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, impl. enumMember())); | 522 dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, impl. enumMember())); |
494 } else { | 523 } else { |
495 dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, Strin g("foo"))); | 524 dictionary->Set(v8String(isolate, "enumMember"), v8String(isolate, Strin g("foo"))); |
496 } | 525 } |
497 | 526 |
527 if (impl.hasEnumSequenceMember()) { | |
528 dictionary->Set(v8String(isolate, "enumSequenceMember"), toV8(impl.enumS equenceMember(), creationContext, isolate)); | |
529 } | |
530 | |
498 if (impl.hasEventTargetMember()) { | 531 if (impl.hasEventTargetMember()) { |
499 dictionary->Set(v8String(isolate, "eventTargetMember"), toV8(impl.eventT argetMember(), creationContext, isolate)); | 532 dictionary->Set(v8String(isolate, "eventTargetMember"), toV8(impl.eventT argetMember(), creationContext, isolate)); |
500 } | 533 } |
501 | 534 |
502 if (impl.hasInternalDictionarySequenceMember()) { | 535 if (impl.hasInternalDictionarySequenceMember()) { |
503 dictionary->Set(v8String(isolate, "internalDictionarySequenceMember"), t oV8(impl.internalDictionarySequenceMember(), creationContext, isolate)); | 536 dictionary->Set(v8String(isolate, "internalDictionarySequenceMember"), t oV8(impl.internalDictionarySequenceMember(), creationContext, isolate)); |
504 } | 537 } |
505 | 538 |
506 if (impl.hasLongMember()) { | 539 if (impl.hasLongMember()) { |
507 dictionary->Set(v8String(isolate, "longMember"), v8::Integer::New(isolat e, impl.longMember())); | 540 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 } | 623 } |
591 | 624 |
592 TestDictionary NativeValueTraits<TestDictionary>::nativeValue(v8::Isolate* isola te, v8::Local<v8::Value> value, ExceptionState& exceptionState) | 625 TestDictionary NativeValueTraits<TestDictionary>::nativeValue(v8::Isolate* isola te, v8::Local<v8::Value> value, ExceptionState& exceptionState) |
593 { | 626 { |
594 TestDictionary impl; | 627 TestDictionary impl; |
595 V8TestDictionary::toImpl(isolate, value, impl, exceptionState); | 628 V8TestDictionary::toImpl(isolate, value, impl, exceptionState); |
596 return impl; | 629 return impl; |
597 } | 630 } |
598 | 631 |
599 } // namespace blink | 632 } // namespace blink |
OLD | NEW |