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 |
32 // https://crbug.com/321462 | 32 v8::Local<v8::Object> v8Object = v8Value->ToObject(isolate); |
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; | 33 v8::TryCatch block; |
37 {% for member in members %} | 34 {% for member in members %} |
38 {{member.cpp_type}} {{member.name}}; | 35 v8::Local<v8::Value> {{member.name}}Value = v8Object->Get(v8String(isolate, "{{member.name}}")); |
39 if (DictionaryHelper::getWithUndefinedOrNullCheck(dictionary, "{{member.name }}", {{member.name}})) { | 36 if (!{{member.name}}Value.IsEmpty() && !isUndefinedOrNull({{member.name}}Val ue)) { |
37 {{member.v8_value_to_local_cpp_value}}; | |
40 {% if member.enum_validation_expression %} | 38 {% if member.enum_validation_expression %} |
41 String string = {{member.name}}; | 39 String string = {{member.name}}; |
42 if (!({{member.enum_validation_expression}})) { | 40 if (!({{member.enum_validation_expression}})) { |
43 exceptionState.throwTypeError("member {{member.name}} ('" + string + "') is not a valid enum value."); | 41 exceptionState.throwTypeError("member {{member.name}} ('" + string + "') is not a valid enum value."); |
44 return; | 42 return; |
45 } | 43 } |
46 {% elif member.is_object %} | 44 {% elif member.is_object %} |
47 if (!{{member.name}}.isObject()) { | 45 if (!{{member.name}}.isObject()) { |
48 exceptionState.throwTypeError("member {{member.name}} is not an obje ct."); | 46 exceptionState.throwTypeError("member {{member.name}} is not an obje ct."); |
49 return; | 47 return; |
50 } | 48 } |
51 {% endif %} | 49 {% endif %} |
52 impl.{{member.setter_name}}({{member.name}}); | 50 impl.{{member.setter_name}}({{member.name}}); |
53 } else if (block.HasCaught()) { | 51 } else if (block.HasCaught()) { |
54 exceptionState.rethrowV8Exception(block.Exception()); | 52 exceptionState.rethrowV8Exception(block.Exception()); |
55 return; | |
zino
2014/11/19 18:12:19
This is my mistake.. :-(
bashi
2014/11/20 02:18:02
I'm not sure why you removed this return. Early ex
zino
2014/11/20 02:40:43
Yep, you're right! It's just my mistake :-P
| |
56 } | 53 } |
57 | 54 |
58 {% endfor %} | 55 {% endfor %} |
59 } | 56 } |
60 | 57 |
61 v8::Handle<v8::Value> toV8({{cpp_class}}& impl, v8::Handle<v8::Object> creationC ontext, v8::Isolate* isolate) | 58 v8::Handle<v8::Value> toV8({{cpp_class}}& impl, v8::Handle<v8::Object> creationC ontext, v8::Isolate* isolate) |
62 { | 59 { |
63 v8::Handle<v8::Object> v8Object = v8::Object::New(isolate); | 60 v8::Handle<v8::Object> v8Object = v8::Object::New(isolate); |
64 {% if parent_v8_class %} | 61 {% if parent_v8_class %} |
65 toV8{{parent_cpp_class}}(impl, v8Object, creationContext, isolate); | 62 toV8{{parent_cpp_class}}(impl, v8Object, creationContext, isolate); |
(...skipping 13 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 |