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_original_class}}.h" | 8 #include "{{v8_original_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 %} |
11 #include "{{filename}}" | 11 #include "{{filename}}" |
12 {% endfor %} | 12 {% endfor %} |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 {% macro convert_and_set_member(member) %} | 16 {% macro convert_and_set_member(member) %} |
17 {% endmacro %} | 17 {% endmacro %} |
18 void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, {
{cpp_class}}& impl, ExceptionState& exceptionState) | 18 void {{v8_class}}::toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{
cpp_class}}& impl, ExceptionState& exceptionState) |
19 { | 19 { |
20 if (isUndefinedOrNull(v8Value)) | 20 if (isUndefinedOrNull(v8Value)) |
21 return; | 21 return; |
22 if (!v8Value->IsObject()) { | 22 if (!v8Value->IsObject()) { |
23 {% if use_permissive_dictionary_conversion %} | 23 {% if use_permissive_dictionary_conversion %} |
24 // Do nothing. | 24 // Do nothing. |
25 {% else %} | 25 {% else %} |
26 exceptionState.throwTypeError("cannot convert to dictionary."); | 26 exceptionState.throwTypeError("cannot convert to dictionary."); |
27 {% endif %} | 27 {% endif %} |
28 return; | 28 return; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 exceptionState.throwTypeError("member {{member.name}} is not an obje
ct."); | 73 exceptionState.throwTypeError("member {{member.name}} is not an obje
ct."); |
74 return; | 74 return; |
75 } | 75 } |
76 {% endif %} | 76 {% endif %} |
77 impl.{{member.setter_name}}({{member.name}}); | 77 impl.{{member.setter_name}}({{member.name}}); |
78 } | 78 } |
79 | 79 |
80 {% endfor %} | 80 {% endfor %} |
81 } | 81 } |
82 | 82 |
83 v8::Handle<v8::Value> toV8(const {{cpp_class}}& impl, v8::Handle<v8::Object> cre
ationContext, v8::Isolate* isolate) | 83 v8::Local<v8::Value> toV8(const {{cpp_class}}& impl, v8::Local<v8::Object> creat
ionContext, v8::Isolate* isolate) |
84 { | 84 { |
85 v8::Handle<v8::Object> v8Object = v8::Object::New(isolate); | 85 v8::Local<v8::Object> v8Object = v8::Object::New(isolate); |
86 {% if parent_v8_class %} | 86 {% if parent_v8_class %} |
87 toV8{{parent_cpp_class}}(impl, v8Object, creationContext, isolate); | 87 toV8{{parent_cpp_class}}(impl, v8Object, creationContext, isolate); |
88 {% endif %} | 88 {% endif %} |
89 toV8{{cpp_class}}(impl, v8Object, creationContext, isolate); | 89 toV8{{cpp_class}}(impl, v8Object, creationContext, isolate); |
90 return v8Object; | 90 return v8Object; |
91 } | 91 } |
92 | 92 |
93 void toV8{{cpp_class}}(const {{cpp_class}}& impl, v8::Handle<v8::Object> diction
ary, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 93 void toV8{{cpp_class}}(const {{cpp_class}}& impl, v8::Local<v8::Object> dictiona
ry, v8::Local<v8::Object> creationContext, v8::Isolate* isolate) |
94 { | 94 { |
95 {% for member in members %} | 95 {% for member in members %} |
96 if (impl.{{member.has_method_name}}()) { | 96 if (impl.{{member.has_method_name}}()) { |
97 {% if member.is_object %} | 97 {% if member.is_object %} |
98 ASSERT(impl.{{member.cpp_name}}().isObject()); | 98 ASSERT(impl.{{member.cpp_name}}().isObject()); |
99 {% endif %} | 99 {% endif %} |
100 dictionary->Set(v8String(isolate, "{{member.name}}"), {{member.cpp_value
_to_v8_value}}); | 100 dictionary->Set(v8String(isolate, "{{member.name}}"), {{member.cpp_value
_to_v8_value}}); |
101 {% if member.v8_default_value %} | 101 {% if member.v8_default_value %} |
102 } else { | 102 } else { |
103 dictionary->Set(v8String(isolate, "{{member.name}}"), {{member.v8_defaul
t_value}}); | 103 dictionary->Set(v8String(isolate, "{{member.name}}"), {{member.v8_defaul
t_value}}); |
104 {% endif %} | 104 {% endif %} |
105 } | 105 } |
106 | 106 |
107 {% endfor %} | 107 {% endfor %} |
108 } | 108 } |
109 | 109 |
110 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(const v8::Handle<v8:
:Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) | 110 {{cpp_class}} NativeValueTraits<{{cpp_class}}>::nativeValue(const v8::Local<v8::
Value>& value, v8::Isolate* isolate, ExceptionState& exceptionState) |
111 { | 111 { |
112 {{cpp_class}} impl; | 112 {{cpp_class}} impl; |
113 {{v8_class}}::toImpl(isolate, value, impl, exceptionState); | 113 {{v8_class}}::toImpl(isolate, value, impl, exceptionState); |
114 return impl; | 114 return impl; |
115 } | 115 } |
116 | 116 |
117 } // namespace blink | 117 } // namespace blink |
OLD | NEW |