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}}. DO NOT MODIFY! | 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! |
6 | 6 |
7 #include "config.h" | 7 #include "config.h" |
8 #include "{{v8_class}}.h" | 8 #include "{{v8_class}}.h" |
9 | 9 |
10 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} | 10 {% for filename in cpp_includes if filename != '%s.h' % v8_class %} |
(...skipping 10 matching lines...) Expand all Loading... |
21 exceptionState.throwTypeError("cannot convert to dictionary."); | 21 exceptionState.throwTypeError("cannot convert to dictionary."); |
22 return; | 22 return; |
23 } | 23 } |
24 | 24 |
25 {% if parent_v8_class %} | 25 {% if parent_v8_class %} |
26 {{parent_v8_class}}::toImpl(isolate, v8Value, impl, exceptionState); | 26 {{parent_v8_class}}::toImpl(isolate, v8Value, impl, exceptionState); |
27 if (exceptionState.hadException()) | 27 if (exceptionState.hadException()) |
28 return; | 28 return; |
29 | 29 |
30 {% endif %} | 30 {% endif %} |
31 // FIXME: Do not use Dictionary and DictionaryHelper | 31 v8::Local<v8::Object> v8Object = v8Value->ToObject(isolate); |
32 // https://crbug.com/321462 | |
33 Dictionary dictionary(v8Value, isolate); | |
34 // FIXME: Remove this v8::TryCatch once the code is switched from | |
35 // Dictionary/DictionaryHelper to something that uses ExceptionState. | |
36 v8::TryCatch block; | 32 v8::TryCatch block; |
37 {% for member in members %} | 33 {% for member in members %} |
38 {{member.cpp_type}} {{member.name}}; | 34 v8::Local<v8::Value> {{member.name}}Value = v8Object->Get(v8String(isolate,
"{{member.name}}")); |
39 if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "{{member.name
}}", {{member.name}})) { | 35 if (!{{member.name}}Value.IsEmpty() && !isUndefinedOrNull({{member.name}}Val
ue)) { |
| 36 {{member.v8_value_to_local_cpp_value}}; |
40 {% if member.enum_validation_expression %} | 37 {% if member.enum_validation_expression %} |
41 String string = {{member.name}}; | 38 String string = {{member.name}}; |
42 if (!({{member.enum_validation_expression}})) { | 39 if (!({{member.enum_validation_expression}})) { |
43 exceptionState.throwTypeError("member {{member.name}} ('" + string +
"') is not a valid enum value."); | 40 exceptionState.throwTypeError("member {{member.name}} ('" + string +
"') is not a valid enum value."); |
44 return; | 41 return; |
45 } | 42 } |
46 {% elif member.is_object %} | 43 {% elif member.is_object %} |
47 if (!{{member.name}}.isObject()) { | 44 if (!{{member.name}}.isObject()) { |
48 exceptionState.throwTypeError("member {{member.name}} is not an obje
ct."); | 45 exceptionState.throwTypeError("member {{member.name}} is not an obje
ct."); |
49 return; | 46 return; |
(...skipping 29 matching lines...) Expand all Loading... |
79 {% if member.v8_default_value %} | 76 {% if member.v8_default_value %} |
80 } else { | 77 } else { |
81 dictionary->Set(v8String(isolate, "{{member.name}}"), {{member.v8_defaul
t_value}}); | 78 dictionary->Set(v8String(isolate, "{{member.name}}"), {{member.v8_defaul
t_value}}); |
82 {% endif %} | 79 {% endif %} |
83 } | 80 } |
84 | 81 |
85 {% endfor %} | 82 {% endfor %} |
86 } | 83 } |
87 | 84 |
88 } // namespace blink | 85 } // namespace blink |
OLD | NEW |