| 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 "bindings/core/v8/UnionTypesCore.h" | 8 #include "bindings/core/v8/UnionTypesCore.h" |
| 9 | 9 |
| 10 #include "bindings/core/v8/Dictionary.h" | 10 #include "bindings/core/v8/Dictionary.h" |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 | 751 |
| 752 String TestEnumOrDouble::getAsTestEnum() const | 752 String TestEnumOrDouble::getAsTestEnum() const |
| 753 { | 753 { |
| 754 ASSERT(isTestEnum()); | 754 ASSERT(isTestEnum()); |
| 755 return m_testEnum; | 755 return m_testEnum; |
| 756 } | 756 } |
| 757 | 757 |
| 758 void TestEnumOrDouble::setTestEnum(String value) | 758 void TestEnumOrDouble::setTestEnum(String value) |
| 759 { | 759 { |
| 760 ASSERT(isNull()); | 760 ASSERT(isNull()); |
| 761 String string = value; | 761 NonThrowableExceptionState exceptionState; |
| 762 if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" || st
ring == "EnumValue3")) { | 762 static const char* validValues[] = { |
| 763 "", |
| 764 "EnumValue1", |
| 765 "EnumValue2", |
| 766 "EnumValue3", |
| 767 }; |
| 768 if (!isValidEnum(value, validValues, WTF_ARRAY_LENGTH(validValues), exceptio
nState)) { |
| 763 ASSERT_NOT_REACHED(); | 769 ASSERT_NOT_REACHED(); |
| 764 return; | 770 return; |
| 765 } | 771 } |
| 766 m_testEnum = value; | 772 m_testEnum = value; |
| 767 m_type = SpecificTypeTestEnum; | 773 m_type = SpecificTypeTestEnum; |
| 768 } | 774 } |
| 769 | 775 |
| 770 TestEnumOrDouble TestEnumOrDouble::fromTestEnum(String value) | 776 TestEnumOrDouble TestEnumOrDouble::fromTestEnum(String value) |
| 771 { | 777 { |
| 772 TestEnumOrDouble container; | 778 TestEnumOrDouble container; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 if (exceptionState.hadException()) | 810 if (exceptionState.hadException()) |
| 805 return; | 811 return; |
| 806 impl.setDouble(cppValue); | 812 impl.setDouble(cppValue); |
| 807 return; | 813 return; |
| 808 } | 814 } |
| 809 | 815 |
| 810 { | 816 { |
| 811 V8StringResource<> cppValue = v8Value; | 817 V8StringResource<> cppValue = v8Value; |
| 812 if (!cppValue.prepare(exceptionState)) | 818 if (!cppValue.prepare(exceptionState)) |
| 813 return; | 819 return; |
| 814 String string = cppValue; | 820 static const char* validValues[] = { |
| 815 if (!(string == "" || string == "EnumValue1" || string == "EnumValue2" |
| string == "EnumValue3")) { | 821 "", |
| 816 exceptionState.throwTypeError("'" + string + "' is not a valid enum
value."); | 822 "EnumValue1", |
| 823 "EnumValue2", |
| 824 "EnumValue3", |
| 825 }; |
| 826 if (!isValidEnum(cppValue, validValues, WTF_ARRAY_LENGTH(validValues), e
xceptionState)) |
| 817 return; | 827 return; |
| 818 } | |
| 819 impl.setTestEnum(cppValue); | 828 impl.setTestEnum(cppValue); |
| 820 return; | 829 return; |
| 821 } | 830 } |
| 822 | 831 |
| 823 } | 832 } |
| 824 | 833 |
| 825 v8::Local<v8::Value> toV8(const TestEnumOrDouble& impl, v8::Local<v8::Object> cr
eationContext, v8::Isolate* isolate) | 834 v8::Local<v8::Value> toV8(const TestEnumOrDouble& impl, v8::Local<v8::Object> cr
eationContext, v8::Isolate* isolate) |
| 826 { | 835 { |
| 827 switch (impl.m_type) { | 836 switch (impl.m_type) { |
| 828 case TestEnumOrDouble::SpecificTypeNone: | 837 case TestEnumOrDouble::SpecificTypeNone: |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1387 } | 1396 } |
| 1388 | 1397 |
| 1389 UnrestrictedDoubleOrString NativeValueTraits<UnrestrictedDoubleOrString>::native
Value(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptio
nState) | 1398 UnrestrictedDoubleOrString NativeValueTraits<UnrestrictedDoubleOrString>::native
Value(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptio
nState) |
| 1390 { | 1399 { |
| 1391 UnrestrictedDoubleOrString impl; | 1400 UnrestrictedDoubleOrString impl; |
| 1392 V8UnrestrictedDoubleOrString::toImpl(isolate, value, impl, exceptionState); | 1401 V8UnrestrictedDoubleOrString::toImpl(isolate, value, impl, exceptionState); |
| 1393 return impl; | 1402 return impl; |
| 1394 } | 1403 } |
| 1395 | 1404 |
| 1396 } // namespace blink | 1405 } // namespace blink |
| OLD | NEW |