Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: Rebasing the fixes... Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 {% extends 'interface_base.cpp.tmpl' %} 1 {% extends 'interface_base.cpp.tmpl' %}
2 2
3 {% set has_prepare_prototype_and_interface_object = 3 {% set has_prepare_prototype_and_interface_object =
4 unscopables or has_conditional_attributes_on_prototype or 4 unscopables or has_conditional_attributes_on_prototype or
5 methods | conditionally_exposed(is_partial) %} 5 methods | conditionally_exposed(is_partial) %}
6 {% set prepare_prototype_and_interface_object_func = 6 {% set prepare_prototype_and_interface_object_func =
7 '%s::preparePrototypeAndInterfaceObject' % v8_class 7 '%s::prepare_prototype_and_interface_object' % v8_class
8 if has_prepare_prototype_and_interface_object 8 if has_prepare_prototype_and_interface_object
9 else 'nullptr' %} 9 else 'nullptr' %}
10 10
11 11
12 {##############################################################################} 12 {##############################################################################}
13 {% block indexed_property_getter %} 13 {% block indexed_property_getter %}
14 {% if indexed_property_getter and not indexed_property_getter.is_custom %} 14 {% if indexed_property_getter and not indexed_property_getter.is_custom %}
15 {% set getter = indexed_property_getter %} 15 {% set getter = indexed_property_getter %}
16 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) { 16 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) {
17 {% if getter.is_raises_exception %} 17 {% if getter.is_raises_exception %}
18 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedGetter Context, "{{interface_name}}"); 18 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kIndexedGette rContext, "{{interface_name}}");
19 {% endif %} 19 {% endif %}
20 20
21 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 21 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
22 22
23 // We assume that all the implementations support length() method, although 23 // We assume that all the implementations support length() method, although
24 // the spec doesn't require that length() must exist. It's okay that 24 // the spec doesn't require that length() must exist. It's okay that
25 // the interface does not have length attribute as long as the 25 // the interface does not have length attribute as long as the
26 // implementation supports length() member function. 26 // implementation supports length() member function.
27 if (index >= impl->length()) 27 if (index >= impl->length())
28 return; // Returns undefined due to out-of-range. 28 return; // Returns undefined due to out-of-range.
29 29
30 {% set getter_name = getter.name or 'anonymousIndexedGetter' %} 30 {% set getter_name = getter.name or 'AnonymousIndexedGetter' %}
31 {% set getter_arguments = ['index'] %} 31 {% set getter_arguments = ['index'] %}
32 {% if getter.is_call_with_script_state %} 32 {% if getter.is_call_with_script_state %}
33 ScriptState* scriptState = ScriptState::forReceiverObject(info); 33 ScriptState* scriptState = ScriptState::ForReceiverObject(info);
34 {% set getter_arguments = ['scriptState'] + getter_arguments %} 34 {% set getter_arguments = ['scriptState'] + getter_arguments %}
35 {% endif %} 35 {% endif %}
36 {% if getter.is_raises_exception %} 36 {% if getter.is_raises_exception %}
37 {% set getter_arguments = getter_arguments + ['exceptionState'] %} 37 {% set getter_arguments = getter_arguments + ['exceptionState'] %}
38 {% endif %} 38 {% endif %}
39 {{getter.cpp_type}} result = impl->{{getter_name}}({{getter_arguments | join(' , ')}}); 39 {{getter.cpp_type}} result = impl->{{getter_name}}({{getter_arguments | join(' , ')}});
40 {{getter.v8_set_return_value}}; 40 {{getter.v8_set_return_value}};
41 } 41 }
42 42
43 {% endif %} 43 {% endif %}
44 {% endblock %} 44 {% endblock %}
45 45
46 46
47 {##############################################################################} 47 {##############################################################################}
48 {% block indexed_property_getter_callback %} 48 {% block indexed_property_getter_callback %}
49 {% if indexed_property_getter or named_property_getter %} 49 {% if indexed_property_getter or named_property_getter %}
50 {% set getter = indexed_property_getter or named_property_getter %} 50 {% set getter = indexed_property_getter or named_property_getter %}
51 void {{v8_class_or_partial}}::indexedPropertyGetterCallback(uint32_t index, cons t v8::PropertyCallbackInfo<v8::Value>& info) { 51 void {{v8_class_or_partial}}::indexedPropertyGetterCallback(uint32_t index, cons t v8::PropertyCallbackInfo<v8::Value>& info) {
52 {% if indexed_property_getter %} 52 {% if indexed_property_getter %}
53 53
54 {% if getter.is_custom %} 54 {% if getter.is_custom %}
55 {{v8_class}}::indexedPropertyGetterCustom(index, info); 55 {{v8_class}}::indexedPropertyGetterCustom(index, info);
56 {% else %} 56 {% else %}
57 {{cpp_class}}V8Internal::indexedPropertyGetter(index, info); 57 {{cpp_class}}V8Internal::indexedPropertyGetter(index, info);
58 {% endif %} 58 {% endif %}
59 59
60 {% else %}{# otherwise, named property #} 60 {% else %}{# otherwise, named property #}
61 61
62 const AtomicString& propertyName = AtomicString::number(index); 62 const AtomicString& propertyName = AtomicString::Number(index);
63 63
64 {% if getter.is_custom %} 64 {% if getter.is_custom %}
65 {{v8_class}}::namedPropertyGetterCustom(propertyName, info); 65 {{v8_class}}::namedPropertyGetterCustom(propertyName, info);
66 {% else %} 66 {% else %}
67 {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info); 67 {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info);
68 {% endif %} 68 {% endif %}
69 69
70 {% endif %}{# indexed_property_getter #} 70 {% endif %}{# indexed_property_getter #}
71 } 71 }
72 72
73 {% endif %} 73 {% endif %}
74 {% endblock %} 74 {% endblock %}
75 75
76 76
77 {##############################################################################} 77 {##############################################################################}
78 {% block indexed_property_setter %} 78 {% block indexed_property_setter %}
79 {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %} 79 {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %}
80 {% if indexed_property_setter and not indexed_property_setter.is_custom %} 80 {% if indexed_property_setter and not indexed_property_setter.is_custom %}
81 {% set setter = indexed_property_setter %} 81 {% set setter = indexed_property_setter %}
82 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) { 82 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
83 {% if setter.has_exception_state %} 83 {% if setter.has_exception_state %}
84 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedSetter Context, "{{interface_name}}"); 84 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kIndexedSette rContext, "{{interface_name}}");
85 {% endif %} 85 {% endif %}
86 86
87 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 87 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
88 {{v8_value_to_local_cpp_value(setter) | indent(2)}} 88 {{v8_value_to_local_cpp_value(setter) | indent(2)}}
89 {% if setter.has_type_checking_interface %} 89 {% if setter.has_type_checking_interface %}
90 {# Type checking for interface types (if interface not implemented, throw 90 {# Type checking for interface types (if interface not implemented, throw
91 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} 91 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
92 if (!propertyValue{% if setter.is_nullable %} && !isUndefinedOrNull(v8Value){% endif %}) { 92 if (!propertyValue{% if setter.is_nullable %} && !IsUndefinedOrNull(v8Value){% endif %}) {
93 exceptionState.throwTypeError("The provided value is not of type '{{setter.i dl_type}}'."); 93 exceptionState.ThrowTypeError("The provided value is not of type '{{setter.i dl_type}}'.");
94 return; 94 return;
95 } 95 }
96 {% endif %} 96 {% endif %}
97 97
98 {% set setter_name = setter.name or 'anonymousIndexedSetter' %} 98 {% set setter_name = setter.name or 'AnonymousIndexedSetter' %}
99 {% set setter_arguments = ['index', 'propertyValue'] %} 99 {% set setter_arguments = ['index', 'propertyValue'] %}
100 {% if setter.is_call_with_script_state %} 100 {% if setter.is_call_with_script_state %}
101 ScriptState* scriptState = ScriptState::forReceiverObject(info); 101 ScriptState* scriptState = ScriptState::ForReceiverObject(info);
102 {% set setter_arguments = ['scriptState'] + setter_arguments %} 102 {% set setter_arguments = ['scriptState'] + setter_arguments %}
103 {% endif %} 103 {% endif %}
104 {% if setter.is_raises_exception %} 104 {% if setter.is_raises_exception %}
105 {% set setter_arguments = setter_arguments + ['exceptionState'] %} 105 {% set setter_arguments = setter_arguments + ['exceptionState'] %}
106 {% endif %} 106 {% endif %}
107 bool result = impl->{{setter_name}}({{setter_arguments | join(', ')}}); 107 bool result = impl->{{setter_name}}({{setter_arguments | join(', ')}});
108 {% if setter.is_raises_exception %} 108 {% if setter.is_raises_exception %}
109 if (exceptionState.hadException()) 109 if (exceptionState.HadException())
110 return; 110 return;
111 {% endif %} 111 {% endif %}
112 if (!result) 112 if (!result)
113 return; 113 return;
114 v8SetReturnValue(info, v8Value); 114 V8SetReturnValue(info, v8Value);
115 } 115 }
116 116
117 {% endif %} 117 {% endif %}
118 {% endblock %} 118 {% endblock %}
119 119
120 120
121 {##############################################################################} 121 {##############################################################################}
122 {% block indexed_property_setter_callback %} 122 {% block indexed_property_setter_callback %}
123 {% if indexed_property_setter or named_property_setter %} 123 {% if indexed_property_setter or named_property_setter %}
124 {% set setter = indexed_property_setter or named_property_setter %} 124 {% set setter = indexed_property_setter or named_property_setter %}
125 void {{v8_class_or_partial}}::indexedPropertySetterCallback(uint32_t index, v8:: Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) { 125 void {{v8_class_or_partial}}::indexedPropertySetterCallback(uint32_t index, v8:: Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
126 {% if setter.is_ce_reactions %} 126 {% if setter.is_ce_reactions %}
127 CEReactionsScope ceReactionsScope; 127 CEReactionsScope ceReactionsScope;
128 {% endif %} 128 {% endif %}
129 129
130 {% if indexed_property_setter %} 130 {% if indexed_property_setter %}
131 131
132 {% if setter.is_custom %} 132 {% if setter.is_custom %}
133 {{v8_class}}::indexedPropertySetterCustom(index, v8Value, info); 133 {{v8_class}}::indexedPropertySetterCustom(index, v8Value, info);
134 {% else %} 134 {% else %}
135 {{cpp_class}}V8Internal::indexedPropertySetter(index, v8Value, info); 135 {{cpp_class}}V8Internal::indexedPropertySetter(index, v8Value, info);
136 {% endif %} 136 {% endif %}
137 137
138 {% else %}{# otherwise, named property #} 138 {% else %}{# otherwise, named property #}
139 139
140 const AtomicString& propertyName = AtomicString::number(index); 140 const AtomicString& propertyName = AtomicString::Number(index);
141 141
142 {% if setter.is_custom %} 142 {% if setter.is_custom %}
143 {{v8_class}}::namedPropertySetterCustom(propertyName, v8Value, info); 143 {{v8_class}}::namedPropertySetterCustom(propertyName, v8Value, info);
144 {% else %} 144 {% else %}
145 {{cpp_class}}V8Internal::namedPropertySetter(propertyName, v8Value, info); 145 {{cpp_class}}V8Internal::namedPropertySetter(propertyName, v8Value, info);
146 {% endif %} 146 {% endif %}
147 147
148 {% endif %}{# indexed_property_setter #} 148 {% endif %}{# indexed_property_setter #}
149 } 149 }
150 150
151 {% endif %} 151 {% endif %}
152 {% endblock %} 152 {% endblock %}
153 153
154 154
155 {##############################################################################} 155 {##############################################################################}
156 {% block indexed_property_deleter %} 156 {% block indexed_property_deleter %}
157 {% if indexed_property_deleter and not indexed_property_deleter.is_custom %} 157 {% if indexed_property_deleter and not indexed_property_deleter.is_custom %}
158 {% set deleter = indexed_property_deleter %} 158 {% set deleter = indexed_property_deleter %}
159 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf o<v8::Boolean>& info) { 159 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf o<v8::Boolean>& info) {
160 {% if deleter.is_raises_exception %} 160 {% if deleter.is_raises_exception %}
161 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedDeleti onContext, "{{interface_name}}"); 161 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kIndexedDelet ionContext, "{{interface_name}}");
162 {% endif %} 162 {% endif %}
163 163
164 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 164 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
165 165
166 {% set deleter_name = deleter.name or 'anonymousIndexedDeleter' %} 166 {% set deleter_name = deleter.name or 'AnonymousIndexedDeleter' %}
167 {% set deleter_arguments = ['index'] %} 167 {% set deleter_arguments = ['index'] %}
168 {% if deleter.is_call_with_script_state %} 168 {% if deleter.is_call_with_script_state %}
169 ScriptState* scriptState = ScriptState::forReceiverObject(info); 169 ScriptState* scriptState = ScriptState::ForReceiverObject(info);
170 {% set deleter_arguments = ['scriptState'] + deleter_arguments %} 170 {% set deleter_arguments = ['scriptState'] + deleter_arguments %}
171 {% endif %} 171 {% endif %}
172 {% if deleter.is_raises_exception %} 172 {% if deleter.is_raises_exception %}
173 {% set deleter_arguments = deleter_arguments + ['exceptionState'] %} 173 {% set deleter_arguments = deleter_arguments + ['exceptionState'] %}
174 {% endif %} 174 {% endif %}
175 DeleteResult result = impl->{{deleter_name}}({{deleter_arguments | join(', ')} }); 175 DeleteResult result = impl->{{deleter_name}}({{deleter_arguments | join(', ')} });
176 {% if deleter.is_raises_exception %} 176 {% if deleter.is_raises_exception %}
177 if (exceptionState.hadException()) 177 if (exceptionState.HadException())
178 return; 178 return;
179 {% endif %} 179 {% endif %}
180 if (result == DeleteUnknownProperty) 180 if (result == kDeleteUnknownProperty)
181 return; 181 return;
182 v8SetReturnValue(info, result == DeleteSuccess); 182 V8SetReturnValue(info, result == kDeleteSuccess);
183 } 183 }
184 184
185 {% endif %} 185 {% endif %}
186 {% endblock %} 186 {% endblock %}
187 187
188 188
189 {##############################################################################} 189 {##############################################################################}
190 {% block indexed_property_deleter_callback %} 190 {% block indexed_property_deleter_callback %}
191 {% if indexed_property_deleter or named_property_deleter %} 191 {% if indexed_property_deleter or named_property_deleter %}
192 {% set deleter = indexed_property_deleter or named_property_deleter %} 192 {% set deleter = indexed_property_deleter or named_property_deleter %}
193 void {{v8_class_or_partial}}::indexedPropertyDeleterCallback(uint32_t index, con st v8::PropertyCallbackInfo<v8::Boolean>& info) { 193 void {{v8_class_or_partial}}::indexedPropertyDeleterCallback(uint32_t index, con st v8::PropertyCallbackInfo<v8::Boolean>& info) {
194 {% if deleter.is_ce_reactions %} 194 {% if deleter.is_ce_reactions %}
195 CEReactionsScope ceReactionsScope; 195 CEReactionsScope ceReactionsScope;
196 {% endif %} 196 {% endif %}
197 197
198 {% if indexed_property_deleter %} 198 {% if indexed_property_deleter %}
199 199
200 {% if deleter.is_custom %} 200 {% if deleter.is_custom %}
201 {{v8_class}}::indexedPropertyDeleterCustom(index, info); 201 {{v8_class}}::indexedPropertyDeleterCustom(index, info);
202 {% else %} 202 {% else %}
203 {{cpp_class}}V8Internal::indexedPropertyDeleter(index, info); 203 {{cpp_class}}V8Internal::indexedPropertyDeleter(index, info);
204 {% endif %} 204 {% endif %}
205 205
206 {% else %}{# otherwise, named property #} 206 {% else %}{# otherwise, named property #}
207 207
208 const AtomicString& propertyName = AtomicString::number(index); 208 const AtomicString& propertyName = AtomicString::Number(index);
209 209
210 {% if deleter.is_custom %} 210 {% if deleter.is_custom %}
211 {{v8_class}}::namedPropertyDeleterCustom(propertyName, info); 211 {{v8_class}}::namedPropertyDeleterCustom(propertyName, info);
212 {% else %} 212 {% else %}
213 {{cpp_class}}V8Internal::namedPropertyDeleter(propertyName, info); 213 {{cpp_class}}V8Internal::namedPropertyDeleter(propertyName, info);
214 {% endif %} 214 {% endif %}
215 215
216 {% endif %}{# indexed_property_deleter #} 216 {% endif %}{# indexed_property_deleter #}
217 } 217 }
218 218
219 {% endif %} 219 {% endif %}
220 {% endblock %} 220 {% endblock %}
221 221
222 222
223 {##############################################################################} 223 {##############################################################################}
224 {% block named_property_getter %} 224 {% block named_property_getter %}
225 {% if named_property_getter and not named_property_getter.is_custom %} 225 {% if named_property_getter and not named_property_getter.is_custom %}
226 {% set getter = named_property_getter %} 226 {% set getter = named_property_getter %}
227 static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCall backInfo<v8::Value>& info) { 227 static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCall backInfo<v8::Value>& info) {
228 {% if getter.is_raises_exception %} 228 {% if getter.is_raises_exception %}
229 const CString& nameInUtf8 = name.utf8(); 229 const CString& nameInUtf8 = name.Utf8();
230 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext , "{{interface_name}}", nameInUtf8.data()); 230 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kGetterContex t, "{{interface_name}}", nameInUtf8.Data());
231 {% endif %} 231 {% endif %}
232 {% if getter.is_call_with_script_state %} 232 {% if getter.is_call_with_script_state %}
233 ScriptState* scriptState = ScriptState::forReceiverObject(info); 233 ScriptState* scriptState = ScriptState::ForReceiverObject(info);
234 {% endif %} 234 {% endif %}
235 235
236 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 236 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
237 {% if getter.use_output_parameter_for_result %} 237 {% if getter.use_output_parameter_for_result %}
238 {{getter.cpp_type}} result; 238 {{getter.cpp_type}} result;
239 {{getter.cpp_value}}; 239 {{getter.cpp_value}};
240 {% else %} 240 {% else %}
241 {{getter.cpp_type}} result = {{getter.cpp_value}}; 241 {{getter.cpp_type}} result = {{getter.cpp_value}};
242 {% endif %} 242 {% endif %}
243 if ({{getter.is_null_expression}}) 243 if ({{getter.is_null_expression}})
244 return; 244 return;
245 {{getter.v8_set_return_value}}; 245 {{getter.v8_set_return_value}};
246 } 246 }
247 247
248 {% endif %} 248 {% endif %}
249 {% endblock %} 249 {% endblock %}
250 250
251 251
252 {##############################################################################} 252 {##############################################################################}
253 {% block named_property_getter_callback %} 253 {% block named_property_getter_callback %}
254 {% if named_property_getter %} 254 {% if named_property_getter %}
255 {% set getter = named_property_getter %} 255 {% set getter = named_property_getter %}
256 void {{v8_class_or_partial}}::namedPropertyGetterCallback(v8::Local<v8::Name> na me, const v8::PropertyCallbackInfo<v8::Value>& info) { 256 void {{v8_class_or_partial}}::namedPropertyGetterCallback(v8::Local<v8::Name> na me, const v8::PropertyCallbackInfo<v8::Value>& info) {
257 if (!name->IsString()) 257 if (!name->IsString())
258 return; 258 return;
259 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); 259 const AtomicString& propertyName = ToCoreAtomicString(name.As<v8::String>());
260 260
261 {% if getter.is_custom %} 261 {% if getter.is_custom %}
262 {{v8_class}}::namedPropertyGetterCustom(propertyName, info); 262 {{v8_class}}::namedPropertyGetterCustom(propertyName, info);
263 {% else %} 263 {% else %}
264 {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info); 264 {{cpp_class}}V8Internal::namedPropertyGetter(propertyName, info);
265 {% endif %} 265 {% endif %}
266 } 266 }
267 267
268 {% endif %} 268 {% endif %}
269 {% endblock %} 269 {% endblock %}
270 270
271 271
272 {##############################################################################} 272 {##############################################################################}
273 {% block named_property_setter %} 273 {% block named_property_setter %}
274 {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %} 274 {% from 'utilities.cpp.tmpl' import v8_value_to_local_cpp_value %}
275 {% if named_property_setter and not named_property_setter.is_custom %} 275 {% if named_property_setter and not named_property_setter.is_custom %}
276 {% set setter = named_property_setter %} 276 {% set setter = named_property_setter %}
277 static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info) { 277 static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
278 {% if setter.has_exception_state %} 278 {% if setter.has_exception_state %}
279 const CString& nameInUtf8 = name.utf8(); 279 const CString& nameInUtf8 = name.Utf8();
280 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext , "{{interface_name}}", nameInUtf8.data()); 280 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kSetterContex t, "{{interface_name}}", nameInUtf8.Data());
281 {% endif %} 281 {% endif %}
282 {% if setter.is_call_with_script_state %} 282 {% if setter.is_call_with_script_state %}
283 ScriptState* scriptState = ScriptState::forReceiverObject(info); 283 ScriptState* scriptState = ScriptState::ForReceiverObject(info);
284 {% endif %} 284 {% endif %}
285 285
286 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 286 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
287 {{v8_value_to_local_cpp_value(setter) | indent(2)}} 287 {{v8_value_to_local_cpp_value(setter) | indent(2)}}
288 {% if setter.has_type_checking_interface %} 288 {% if setter.has_type_checking_interface %}
289 {# Type checking for interface types (if interface not implemented, throw 289 {# Type checking for interface types (if interface not implemented, throw
290 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} 290 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
291 if (!propertyValue{% if setter.is_nullable %} && !isUndefinedOrNull(v8Value){% endif %}) { 291 if (!propertyValue{% if setter.is_nullable %} && !IsUndefinedOrNull(v8Value){% endif %}) {
292 exceptionState.throwTypeError("The provided value is not of type '{{setter.i dl_type}}'."); 292 exceptionState.ThrowTypeError("The provided value is not of type '{{setter.i dl_type}}'.");
293 return; 293 return;
294 } 294 }
295 {% endif %} 295 {% endif %}
296 296
297 {% set setter_name = setter.name or 'anonymousNamedSetter' %} 297 {% set setter_name = setter.name or 'AnonymousNamedSetter' %}
298 {% set setter_arguments = ['name', 'propertyValue'] %} 298 {% set setter_arguments = ['name', 'propertyValue'] %}
299 {% if setter.is_call_with_script_state %} 299 {% if setter.is_call_with_script_state %}
300 {% set setter_arguments = ['scriptState'] + setter_arguments %} 300 {% set setter_arguments = ['scriptState'] + setter_arguments %}
301 {% endif %} 301 {% endif %}
302 {% if setter.is_raises_exception %} 302 {% if setter.is_raises_exception %}
303 {% set setter_arguments = setter_arguments + ['exceptionState'] %} 303 {% set setter_arguments = setter_arguments + ['exceptionState'] %}
304 {% endif %} 304 {% endif %}
305 bool result = impl->{{setter_name}}({{setter_arguments | join(', ')}}); 305 bool result = impl->{{setter_name}}({{setter_arguments | join(', ')}});
306 {% if setter.is_raises_exception %} 306 {% if setter.is_raises_exception %}
307 if (exceptionState.hadException()) 307 if (exceptionState.HadException())
308 return; 308 return;
309 {% endif %} 309 {% endif %}
310 if (!result) 310 if (!result)
311 return; 311 return;
312 v8SetReturnValue(info, v8Value); 312 V8SetReturnValue(info, v8Value);
313 } 313 }
314 314
315 {% endif %} 315 {% endif %}
316 {% endblock %} 316 {% endblock %}
317 317
318 318
319 {##############################################################################} 319 {##############################################################################}
320 {% block named_property_setter_callback %} 320 {% block named_property_setter_callback %}
321 {% if named_property_setter %} 321 {% if named_property_setter %}
322 {% set setter = named_property_setter %} 322 {% set setter = named_property_setter %}
323 void {{v8_class_or_partial}}::namedPropertySetterCallback(v8::Local<v8::Name> na me, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& inf o) { 323 void {{v8_class_or_partial}}::namedPropertySetterCallback(v8::Local<v8::Name> na me, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& inf o) {
324 if (!name->IsString()) 324 if (!name->IsString())
325 return; 325 return;
326 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); 326 const AtomicString& propertyName = ToCoreAtomicString(name.As<v8::String>());
327 327
328 {% if setter.is_ce_reactions %} 328 {% if setter.is_ce_reactions %}
329 CEReactionsScope ceReactionsScope; 329 CEReactionsScope ceReactionsScope;
330 {% endif %} 330 {% endif %}
331 331
332 {% if setter.is_custom %} 332 {% if setter.is_custom %}
333 {{v8_class}}::namedPropertySetterCustom(propertyName, v8Value, info); 333 {{v8_class}}::namedPropertySetterCustom(propertyName, v8Value, info);
334 {% else %} 334 {% else %}
335 {{cpp_class}}V8Internal::namedPropertySetter(propertyName, v8Value, info); 335 {{cpp_class}}V8Internal::namedPropertySetter(propertyName, v8Value, info);
336 {% endif %} 336 {% endif %}
337 } 337 }
338 338
339 {% endif %} 339 {% endif %}
340 {% endblock %} 340 {% endblock %}
341 341
342 342
343 {##############################################################################} 343 {##############################################################################}
344 {% block named_property_deleter %} 344 {% block named_property_deleter %}
345 {% if named_property_deleter and not named_property_deleter.is_custom %} 345 {% if named_property_deleter and not named_property_deleter.is_custom %}
346 {% set deleter = named_property_deleter %} 346 {% set deleter = named_property_deleter %}
347 static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCal lbackInfo<v8::Boolean>& info) { 347 static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCal lbackInfo<v8::Boolean>& info) {
348 {% if deleter.is_raises_exception %} 348 {% if deleter.is_raises_exception %}
349 const CString& nameInUtf8 = name.utf8(); 349 const CString& nameInUtf8 = name.Utf8();
350 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::DeletionConte xt, "{{interface_name}}", nameInUtf8.data()); 350 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kDeletionCont ext, "{{interface_name}}", nameInUtf8.Data());
351 {% endif %} 351 {% endif %}
352 {% if deleter.is_call_with_script_state %} 352 {% if deleter.is_call_with_script_state %}
353 ScriptState* scriptState = ScriptState::forReceiverObject(info); 353 ScriptState* scriptState = ScriptState::ForReceiverObject(info);
354 {% endif %} 354 {% endif %}
355 355
356 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 356 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
357 357
358 {% set deleter_name = deleter.name or 'anonymousNamedDeleter' %} 358 {% set deleter_name = deleter.name or 'AnonymousNamedDeleter' %}
359 {% set deleter_arguments = ['name'] %} 359 {% set deleter_arguments = ['name'] %}
360 {% if deleter.is_call_with_script_state %} 360 {% if deleter.is_call_with_script_state %}
361 {% set deleter_arguments = ['scriptState'] + deleter_arguments %} 361 {% set deleter_arguments = ['scriptState'] + deleter_arguments %}
362 {% endif %} 362 {% endif %}
363 {% if deleter.is_raises_exception %} 363 {% if deleter.is_raises_exception %}
364 {% set deleter_arguments = deleter_arguments + ['exceptionState'] %} 364 {% set deleter_arguments = deleter_arguments + ['exceptionState'] %}
365 {% endif %} 365 {% endif %}
366 DeleteResult result = impl->{{deleter_name}}({{deleter_arguments | join(', ')} }); 366 DeleteResult result = impl->{{deleter_name}}({{deleter_arguments | join(', ')} });
367 {% if deleter.is_raises_exception %} 367 {% if deleter.is_raises_exception %}
368 if (exceptionState.hadException()) 368 if (exceptionState.HadException())
369 return; 369 return;
370 {% endif %} 370 {% endif %}
371 if (result == DeleteUnknownProperty) 371 if (result == kDeleteUnknownProperty)
372 return; 372 return;
373 v8SetReturnValue(info, result == DeleteSuccess); 373 V8SetReturnValue(info, result == kDeleteSuccess);
374 } 374 }
375 375
376 {% endif %} 376 {% endif %}
377 {% endblock %} 377 {% endblock %}
378 378
379 379
380 {##############################################################################} 380 {##############################################################################}
381 {% block named_property_deleter_callback %} 381 {% block named_property_deleter_callback %}
382 {% if named_property_deleter %} 382 {% if named_property_deleter %}
383 {% set deleter = named_property_deleter %} 383 {% set deleter = named_property_deleter %}
384 void {{v8_class_or_partial}}::namedPropertyDeleterCallback(v8::Local<v8::Name> n ame, const v8::PropertyCallbackInfo<v8::Boolean>& info) { 384 void {{v8_class_or_partial}}::namedPropertyDeleterCallback(v8::Local<v8::Name> n ame, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
385 if (!name->IsString()) 385 if (!name->IsString())
386 return; 386 return;
387 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); 387 const AtomicString& propertyName = ToCoreAtomicString(name.As<v8::String>());
388 388
389 {% if deleter.is_ce_reactions %} 389 {% if deleter.is_ce_reactions %}
390 CEReactionsScope ceReactionsScope; 390 CEReactionsScope ceReactionsScope;
391 {% endif %} 391 {% endif %}
392 392
393 {% if deleter.is_custom %} 393 {% if deleter.is_custom %}
394 {{v8_class}}::namedPropertyDeleterCustom(propertyName, info); 394 {{v8_class}}::namedPropertyDeleterCustom(propertyName, info);
395 {% else %} 395 {% else %}
396 {{cpp_class}}V8Internal::namedPropertyDeleter(propertyName, info); 396 {{cpp_class}}V8Internal::namedPropertyDeleter(propertyName, info);
397 {% endif %} 397 {% endif %}
398 } 398 }
399 399
400 {% endif %} 400 {% endif %}
401 {% endblock %} 401 {% endblock %}
402 402
403 403
404 {##############################################################################} 404 {##############################################################################}
405 {% block named_property_query %} 405 {% block named_property_query %}
406 {% if named_property_getter and named_property_getter.is_enumerable and 406 {% if named_property_getter and named_property_getter.is_enumerable and
407 not named_property_getter.is_custom_property_query %} 407 not named_property_getter.is_custom_property_query %}
408 {% set getter = named_property_getter %} 408 {% set getter = named_property_getter %}
409 {# If there is an enumerator, there MUST be a query method to properly 409 {# If there is an enumerator, there MUST be a query method to properly
410 communicate property attributes. #} 410 communicate property attributes. #}
411 static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallb ackInfo<v8::Integer>& info) { 411 static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallb ackInfo<v8::Integer>& info) {
412 const CString& nameInUtf8 = name.utf8(); 412 const CString& nameInUtf8 = name.Utf8();
413 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext , "{{interface_name}}", nameInUtf8.data()); 413 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kGetterContex t, "{{interface_name}}", nameInUtf8.Data());
414 {% if getter.is_call_with_script_state %} 414 {% if getter.is_call_with_script_state %}
415 ScriptState* scriptState = ScriptState::forReceiverObject(info); 415 ScriptState* scriptState = ScriptState::ForReceiverObject(info);
416 {% endif %} 416 {% endif %}
417 417
418 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 418 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
419 419
420 {% set getter_arguments = ['name', 'exceptionState'] %} 420 {% set getter_arguments = ['name', 'exceptionState'] %}
421 {% if getter.is_call_with_script_state %} 421 {% if getter.is_call_with_script_state %}
422 {% set getter_arguments = ['scriptState'] + getter_arguments %} 422 {% set getter_arguments = ['scriptState'] + getter_arguments %}
423 {% endif %} 423 {% endif %}
424 bool result = impl->namedPropertyQuery({{getter_arguments | join(', ')}}); 424 bool result = impl->NamedPropertyQuery({{getter_arguments | join(', ')}});
425 if (!result) 425 if (!result)
426 return; 426 return;
427 v8SetReturnValueInt(info, v8::None); 427 V8SetReturnValueInt(info, v8::None);
428 } 428 }
429 429
430 {% endif %} 430 {% endif %}
431 {% endblock %} 431 {% endblock %}
432 432
433 433
434 {##############################################################################} 434 {##############################################################################}
435 {% block named_property_query_callback %} 435 {% block named_property_query_callback %}
436 {% if named_property_getter and named_property_getter.is_enumerable %} 436 {% if named_property_getter and named_property_getter.is_enumerable %}
437 {% set getter = named_property_getter %} 437 {% set getter = named_property_getter %}
438 void {{v8_class_or_partial}}::namedPropertyQueryCallback(v8::Local<v8::Name> nam e, const v8::PropertyCallbackInfo<v8::Integer>& info) { 438 void {{v8_class_or_partial}}::namedPropertyQueryCallback(v8::Local<v8::Name> nam e, const v8::PropertyCallbackInfo<v8::Integer>& info) {
439 if (!name->IsString()) 439 if (!name->IsString())
440 return; 440 return;
441 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); 441 const AtomicString& propertyName = ToCoreAtomicString(name.As<v8::String>());
442 442
443 {% if getter.is_custom_property_query %} 443 {% if getter.is_custom_property_query %}
444 {{v8_class}}::namedPropertyQueryCustom(propertyName, info); 444 {{v8_class}}::namedPropertyQueryCustom(propertyName, info);
445 {% else %} 445 {% else %}
446 {{cpp_class}}V8Internal::namedPropertyQuery(propertyName, info); 446 {{cpp_class}}V8Internal::namedPropertyQuery(propertyName, info);
447 {% endif %} 447 {% endif %}
448 } 448 }
449 449
450 {% endif %} 450 {% endif %}
451 {% endblock %} 451 {% endblock %}
452 452
453 453
454 {##############################################################################} 454 {##############################################################################}
455 {% block named_property_enumerator %} 455 {% block named_property_enumerator %}
456 {% if named_property_getter and named_property_getter.is_enumerable and 456 {% if named_property_getter and named_property_getter.is_enumerable and
457 not named_property_getter.is_custom_property_enumerator %} 457 not named_property_getter.is_custom_property_enumerator %}
458 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) { 458 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo) {
459 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::EnumerationCo ntext, "{{interface_name}}"); 459 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kEnumerationC ontext, "{{interface_name}}");
460 460
461 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 461 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
462 462
463 Vector<String> names; 463 Vector<String> names;
464 impl->namedPropertyEnumerator(names, exceptionState); 464 impl->NamedPropertyEnumerator(names, exceptionState);
465 if (exceptionState.hadException()) 465 if (exceptionState.HadException())
466 return; 466 return;
467 v8SetReturnValue(info, ToV8(names, info.Holder(), info.GetIsolate()).As<v8::Ar ray>()); 467 V8SetReturnValue(info, ToV8(names, info.Holder(), info.GetIsolate()).As<v8::Ar ray>());
468 } 468 }
469 469
470 {% endif %} 470 {% endif %}
471 {% endblock %} 471 {% endblock %}
472 472
473 473
474 {##############################################################################} 474 {##############################################################################}
475 {% block named_property_enumerator_callback %} 475 {% block named_property_enumerator_callback %}
476 {% if named_property_getter and named_property_getter.is_enumerable %} 476 {% if named_property_getter and named_property_getter.is_enumerable %}
477 {% set getter = named_property_getter %} 477 {% set getter = named_property_getter %}
(...skipping 16 matching lines...) Expand all
494 {% block origin_safe_method_setter %} 494 {% block origin_safe_method_setter %}
495 {% if has_origin_safe_method_setter %} 495 {% if has_origin_safe_method_setter %}
496 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::Name> name, v8::Lo cal<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) { 496 static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::Name> name, v8::Lo cal<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) {
497 if (!name->IsString()) 497 if (!name->IsString())
498 return; 498 return;
499 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(info .Holder(), info.GetIsolate()); 499 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(info .Holder(), info.GetIsolate());
500 if (holder.IsEmpty()) 500 if (holder.IsEmpty())
501 return; 501 return;
502 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder); 502 {{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
503 v8::String::Utf8Value attributeName(name); 503 v8::String::Utf8Value attributeName(name);
504 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext , "{{interface_name}}", *attributeName); 504 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kSetterContex t, "{{interface_name}}", *attributeName);
505 if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), impl, exceptionState)) { 505 if (!BindingSecurity::ShouldAllowAccessTo(CurrentDOMWindow(info.GetIsolate()), impl, exceptionState)) {
506 return; 506 return;
507 } 507 }
508 508
509 {# The findInstanceInPrototypeChain() call above only returns a non-empty hand le if info.Holder() is an Object. #} 509 {# The findInstanceInPrototypeChain() call above only returns a non-empty hand le if info.Holder() is an Object. #}
510 V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), v8::Loc al<v8::Object>::Cast(info.Holder()), name.As<v8::String>(), v8Value); 510 V8HiddenValue::SetHiddenValue(ScriptState::Current(info.GetIsolate()), v8::Loc al<v8::Object>::Cast(info.Holder()), name.As<v8::String>(), v8Value);
511 } 511 }
512 {% endif %} 512 {% endif %}
513 {% endblock %} 513 {% endblock %}
514 514
515 {% block origin_safe_method_setter_callback %} 515 {% block origin_safe_method_setter_callback %}
516 {% if has_origin_safe_method_setter %} 516 {% if has_origin_safe_method_setter %}
517 void {{v8_class_or_partial}}::{{cpp_class}}OriginSafeMethodSetterCallback(v8::Lo cal<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo <void>& info) { 517 void {{v8_class_or_partial}}::{{cpp_class}}OriginSafeMethodSetterCallback(v8::Lo cal<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo <void>& info) {
518 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, v8Value, in fo); 518 {{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, v8Value, in fo);
519 } 519 }
520 {% endif %} 520 {% endif %}
521 {% endblock %} 521 {% endblock %}
522 522
523 523
524 {##############################################################################} 524 {##############################################################################}
525 {% block named_constructor %} 525 {% block named_constructor %}
526 {% from 'methods.cpp.tmpl' import generate_constructor with context %} 526 {% from 'methods.cpp.tmpl' import generate_constructor with context %}
527 {% if named_constructor %} 527 {% if named_constructor %}
528 {% set active_scriptwrappable_inheritance = 528 {% set active_scriptwrappable_inheritance =
529 'InheritFromActiveScriptWrappable' 529 'kInheritFromActiveScriptWrappable'
530 if active_scriptwrappable else 530 if active_scriptwrappable else
531 'NotInheritFromActiveScriptWrappable' %} 531 'kNotInheritFromActiveScriptWrappable' %}
532 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial 532 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial
533 // and does not depend on another global objects. 533 // and does not depend on another global objects.
534 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 534 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
535 #pragma clang diagnostic push 535 #pragma clang diagnostic push
536 #pragma clang diagnostic ignored "-Wglobal-constructors" 536 #pragma clang diagnostic ignored "-Wglobal-constructors"
537 #endif 537 #endif
538 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::trace, {{v8_class}}: :traceWrappers, {{prepare_prototype_and_interface_object_func}}, "{{interface_na me}}", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::{{wrappe r_class_id}}, WrapperTypeInfo::{{active_scriptwrappable_inheritance}}, WrapperTy peInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}} }; 538 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::Trace, {{v8_class}}: :TraceWrappers, {{prepare_prototype_and_interface_object_func}}, "{{interface_na me}}", 0, WrapperTypeInfo::kWrapperTypeObjectPrototype, WrapperTypeInfo::{{wrapp er_class_id}}, WrapperTypeInfo::{{active_scriptwrappable_inheritance}}, WrapperT ypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}} };
539 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 539 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
540 #pragma clang diagnostic pop 540 #pragma clang diagnostic pop
541 #endif 541 #endif
542 542
543 {{generate_constructor(named_constructor)}} 543 {{generate_constructor(named_constructor)}}
544 v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate * isolate, const DOMWrapperWorld& world) { 544 v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate * isolate, const DOMWrapperWorld& world) {
545 static int domTemplateKey; // This address is used for a key to look up the do m template. 545 static int domTemplateKey; // This address is used for a key to look up the do m template.
546 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 546 V8PerIsolateData* data = V8PerIsolateData::From(isolate);
547 v8::Local<v8::FunctionTemplate> result = data->findInterfaceTemplate(world, &d omTemplateKey); 547 v8::Local<v8::FunctionTemplate> result = data->FindInterfaceTemplate(world, &d omTemplateKey);
548 if (!result.IsEmpty()) 548 if (!result.IsEmpty())
549 return result; 549 return result;
550 550
551 result = v8::FunctionTemplate::New(isolate, {{v8_class}}ConstructorCallback); 551 result = v8::FunctionTemplate::New(isolate, {{v8_class}}ConstructorCallback);
552 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate(); 552 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
553 instanceTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount); 553 instanceTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount);
554 result->SetClassName(v8AtomicString(isolate, "{{cpp_class}}")); 554 result->SetClassName(V8AtomicString(isolate, "{{cpp_class}}"));
555 result->Inherit({{v8_class}}::domTemplate(isolate, world)); 555 result->Inherit({{v8_class}}::domTemplate(isolate, world));
556 data->setInterfaceTemplate(world, &domTemplateKey, result); 556 data->SetInterfaceTemplate(world, &domTemplateKey, result);
557 return result; 557 return result;
558 } 558 }
559 559
560 {% endif %} 560 {% endif %}
561 {% endblock %} 561 {% endblock %}
562 562
563 {##############################################################################} 563 {##############################################################################}
564 {% block overloaded_constructor %} 564 {% block overloaded_constructor %}
565 {% if constructor_overloads %} 565 {% if constructor_overloads %}
566 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) { 566 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) {
567 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ConstructionC ontext, "{{interface_name}}"); 567 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kConstruction Context, "{{interface_name}}");
568 {# 2. Initialize argcount to be min(maxarg, n). #} 568 {# 2. Initialize argcount to be min(maxarg, n). #}
569 switch (std::min({{constructor_overloads.maxarg}}, info.Length())) { 569 switch (std::min({{constructor_overloads.maxarg}}, info.Length())) {
570 {# 3. Remove from S all entries whose type list is not of length argcount. # } 570 {# 3. Remove from S all entries whose type list is not of length argcount. # }
571 {% for length, tests_constructors in constructor_overloads.length_tests_meth ods %} 571 {% for length, tests_constructors in constructor_overloads.length_tests_meth ods %}
572 case {{length}}: 572 case {{length}}:
573 {# Then resolve by testing argument #} 573 {# Then resolve by testing argument #}
574 {% for test, constructor in tests_constructors %} 574 {% for test, constructor in tests_constructors %}
575 {# 10. If i = d, then: #} 575 {# 10. If i = d, then: #}
576 if ({{test}}) { 576 if ({{test}}) {
577 {{cpp_class}}V8Internal::constructor{{constructor.overload_index}}(info) ; 577 {{cpp_class}}V8Internal::constructor{{constructor.overload_index}}(info) ;
578 return; 578 return;
579 } 579 }
580 {% endfor %} 580 {% endfor %}
581 break; 581 break;
582 {% endfor %} 582 {% endfor %}
583 default: 583 default:
584 {# Invalid arity, throw error #} 584 {# Invalid arity, throw error #}
585 {# Report full list of valid arities if gaps and above minimum #} 585 {# Report full list of valid arities if gaps and above minimum #}
586 {% if constructor_overloads.valid_arities %} 586 {% if constructor_overloads.valid_arities %}
587 if (info.Length() >= {{constructor_overloads.length}}) { 587 if (info.Length() >= {{constructor_overloads.length}}) {
588 exceptionState.throwTypeError(ExceptionMessages::invalidArity("{{constru ctor_overloads.valid_arities}}", info.Length())); 588 exceptionState.ThrowTypeError(ExceptionMessages::InvalidArity("{{constru ctor_overloads.valid_arities}}", info.Length()));
589 return; 589 return;
590 } 590 }
591 {% endif %} 591 {% endif %}
592 {# Otherwise just report "not enough arguments" #} 592 {# Otherwise just report "not enough arguments" #}
593 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments({{cons tructor_overloads.length}}, info.Length())); 593 exceptionState.ThrowTypeError(ExceptionMessages::NotEnoughArguments({{cons tructor_overloads.length}}, info.Length()));
594 return; 594 return;
595 } 595 }
596 {# No match, throw error #} 596 {# No match, throw error #}
597 exceptionState.throwTypeError("No matching constructor signature."); 597 exceptionState.ThrowTypeError("No matching constructor signature.");
598 } 598 }
599 599
600 {% endif %} 600 {% endif %}
601 {% endblock %} 601 {% endblock %}
602 602
603 603
604 {##############################################################################} 604 {##############################################################################}
605 {% block constructor_callback %} 605 {% block constructor_callback %}
606 {% if constructors or has_custom_constructor or has_event_constructor or has_htm l_constructor %} 606 {% if constructors or has_custom_constructor or has_event_constructor or has_htm l_constructor %}
607 void {{v8_class}}::constructorCallback(const v8::FunctionCallbackInfo<v8::Value> & info) { 607 void {{v8_class}}::constructorCallback(const v8::FunctionCallbackInfo<v8::Value> & info) {
608 {% if measure_as %} 608 {% if measure_as %}
609 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{me asure_as('Constructor')}}); 609 UseCounter::Count(CurrentExecutionContext(info.GetIsolate()), UseCounter::k{{m easure_as('Constructor')}});
610 {% endif %} 610 {% endif %}
611 if (!info.IsConstructCall()) { 611 if (!info.IsConstructCall()) {
612 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::const ructorNotCallableAsFunction("{{interface_name}}")); 612 V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::Const ructorNotCallableAsFunction("{{interface_name}}"));
613 return; 613 return;
614 } 614 }
615 615
616 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExisti ngObject) { 616 if (ConstructorMode::Current(info.GetIsolate()) == ConstructorMode::kWrapExist ingObject) {
617 v8SetReturnValue(info, info.Holder()); 617 V8SetReturnValue(info, info.Holder());
618 return; 618 return;
619 } 619 }
620 620
621 {% if has_custom_constructor %} 621 {% if has_custom_constructor %}
622 {{v8_class}}::constructorCustom(info); 622 {{v8_class}}::constructorCustom(info);
623 {% elif has_html_constructor %} 623 {% elif has_html_constructor %}
624 V8HTMLConstructor::htmlConstructor(info, {{v8_class}}::wrapperTypeInfo, HTMLEl ementType::k{{interface_name}}); 624 V8HTMLConstructor::HtmlConstructor(info, {{v8_class}}::wrapperTypeInfo, HTMLEl ementType::k{{interface_name}});
625 {% else %} 625 {% else %}
626 {{cpp_class}}V8Internal::constructor(info); 626 {{cpp_class}}V8Internal::constructor(info);
627 {% endif %} 627 {% endif %}
628 } 628 }
629 629
630 {% endif %} 630 {% endif %}
631 {% endblock %} 631 {% endblock %}
632 632
633 633
634 {##############################################################################} 634 {##############################################################################}
(...skipping 12 matching lines...) Expand all
647 {% set getter_callback_for_main_world = '%sForMainWorld' % getter_callback %} 647 {% set getter_callback_for_main_world = '%sForMainWorld' % getter_callback %}
648 {% set setter_callback_for_main_world = '%sForMainWorld' % setter_callback 648 {% set setter_callback_for_main_world = '%sForMainWorld' % setter_callback
649 if not method.is_unforgeable else 'nullptr' %} 649 if not method.is_unforgeable else 'nullptr' %}
650 {% else %} 650 {% else %}
651 {% set getter_callback_for_main_world = 'nullptr' %} 651 {% set getter_callback_for_main_world = 'nullptr' %}
652 {% set setter_callback_for_main_world = 'nullptr' %} 652 {% set setter_callback_for_main_world = 'nullptr' %}
653 {% endif %} 653 {% endif %}
654 {% set property_attribute = 654 {% set property_attribute =
655 'static_cast<v8::PropertyAttribute>(%s)' % 655 'static_cast<v8::PropertyAttribute>(%s)' %
656 ' | '.join(method.property_attributes or ['v8::None']) %} 656 ' | '.join(method.property_attributes or ['v8::None']) %}
657 {% set holder_check = 'V8DOMConfiguration::CheckHolder' %} 657 {% set holder_check = 'V8DOMConfiguration::kCheckHolder' %}
658 const V8DOMConfiguration::AttributeConfiguration {{method.name}}OriginSafeAttrib uteConfiguration = { 658 const V8DOMConfiguration::AttributeConfiguration {{method.name}}OriginSafeAttrib uteConfiguration = {
659 "{{method.name}}", {{getter_callback}}, {{setter_callback}}, {{getter_callba ck_for_main_world}}, {{setter_callback_for_main_world}}, nullptr, &{{v8_class}}: :wrapperTypeInfo, {{property_attribute}}, {{property_location(method)}}, {{holde r_check}} 659 "{{method.name}}", {{getter_callback}}, {{setter_callback}}, {{getter_callba ck_for_main_world}}, {{setter_callback_for_main_world}}, nullptr, &{{v8_class}}: :wrapperTypeInfo, {{property_attribute}}, {{property_location(method)}}, {{holde r_check}}
660 }; 660 };
661 V8DOMConfiguration::installAttribute(isolate, world, {{instance_template}}, {{pr ototype_template}}, {{method.name}}OriginSafeAttributeConfiguration); 661 V8DOMConfiguration::InstallAttribute(isolate, world, {{instance_template}}, {{pr ototype_template}}, {{method.name}}OriginSafeAttributeConfiguration);
662 {%- endmacro %} 662 {%- endmacro %}
663 663
664 664
665 {##############################################################################} 665 {##############################################################################}
666 {% macro install_indexed_property_handler(target) %} 666 {% macro install_indexed_property_handler(target) %}
667 {% set indexed_property_getter_callback = 667 {% set indexed_property_getter_callback =
668 '%s::indexedPropertyGetterCallback' % v8_class_or_partial %} 668 '%s::indexedPropertyGetterCallback' % v8_class_or_partial %}
669 {% set indexed_property_setter_callback = 669 {% set indexed_property_setter_callback =
670 '%s::indexedPropertySetterCallback' % v8_class_or_partial 670 '%s::indexedPropertySetterCallback' % v8_class_or_partial
671 if indexed_property_setter or named_property_setter else 'nullptr' %} 671 if indexed_property_setter or named_property_setter else 'nullptr' %}
672 {% set indexed_property_query_callback = 'nullptr' %}{# Unused #} 672 {% set indexed_property_query_callback = 'nullptr' %}{# Unused #}
673 {% set indexed_property_deleter_callback = 673 {% set indexed_property_deleter_callback =
674 '%s::indexedPropertyDeleterCallback' % v8_class_or_partial 674 '%s::indexedPropertyDeleterCallback' % v8_class_or_partial
675 if indexed_property_deleter or named_property_deleter else 'nullptr' %} 675 if indexed_property_deleter or named_property_deleter else 'nullptr' %}
676 {% set indexed_property_enumerator_callback = 676 {% set indexed_property_enumerator_callback =
677 'indexedPropertyEnumerator<%s>' % cpp_class 677 'IndexedPropertyEnumerator<%s>' % cpp_class
678 if indexed_property_getter.is_enumerable else 'nullptr' %} 678 if indexed_property_getter.is_enumerable else 'nullptr' %}
679 {% set property_handler_flags = 679 {% set property_handler_flags =
680 'v8::PropertyHandlerFlags::kNone' %} 680 'v8::PropertyHandlerFlags::kNone' %}
681 v8::IndexedPropertyHandlerConfiguration indexedPropertyHandlerConfig({{indexed_p roperty_getter_callback}}, {{indexed_property_setter_callback}}, {{indexed_prope rty_query_callback}}, {{indexed_property_deleter_callback}}, {{indexed_property_ enumerator_callback}}, v8::Local<v8::Value>(), {{property_handler_flags}}); 681 v8::IndexedPropertyHandlerConfiguration indexedPropertyHandlerConfig({{indexed_p roperty_getter_callback}}, {{indexed_property_setter_callback}}, {{indexed_prope rty_query_callback}}, {{indexed_property_deleter_callback}}, {{indexed_property_ enumerator_callback}}, v8::Local<v8::Value>(), {{property_handler_flags}});
682 {{target}}->SetHandler(indexedPropertyHandlerConfig); 682 {{target}}->SetHandler(indexedPropertyHandlerConfig);
683 {%- endmacro %} 683 {%- endmacro %}
684 684
685 685
686 {##############################################################################} 686 {##############################################################################}
687 {% macro install_named_property_handler(target) %} 687 {% macro install_named_property_handler(target) %}
(...skipping 23 matching lines...) Expand all
711 v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig({{named_propert y_getter_callback}}, {{named_property_setter_callback}}, {{named_property_query_ callback}}, {{named_property_deleter_callback}}, {{named_property_enumerator_cal lback}}, v8::Local<v8::Value>(), {{property_handler_flags}}); 711 v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig({{named_propert y_getter_callback}}, {{named_property_setter_callback}}, {{named_property_query_ callback}}, {{named_property_deleter_callback}}, {{named_property_enumerator_cal lback}}, v8::Local<v8::Value>(), {{property_handler_flags}});
712 {{target}}->SetHandler(namedPropertyHandlerConfig); 712 {{target}}->SetHandler(namedPropertyHandlerConfig);
713 {%- endmacro %} 713 {%- endmacro %}
714 714
715 715
716 {##############################################################################} 716 {##############################################################################}
717 {% block get_dom_template %} 717 {% block get_dom_template %}
718 {% if not is_array_buffer_or_view %} 718 {% if not is_array_buffer_or_view %}
719 v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) { 719 v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) {
720 {% set installTemplateFunction = '%s::install%sTemplateFunction' % (v8_class, v8_class) if has_partial_interface else 'install%sTemplate' % v8_class %} 720 {% set installTemplateFunction = '%s::install%sTemplateFunction' % (v8_class, v8_class) if has_partial_interface else 'install%sTemplate' % v8_class %}
721 return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<Wrapper TypeInfo*>(&wrapperTypeInfo), {{installTemplateFunction}}); 721 return V8DOMConfiguration::DomClassTemplate(isolate, world, const_cast<Wrapper TypeInfo*>(&wrapperTypeInfo), {{installTemplateFunction}});
722 } 722 }
723 723
724 {% endif %} 724 {% endif %}
725 {% endblock %} 725 {% endblock %}
726 726
727 727
728 {##############################################################################} 728 {##############################################################################}
729 {% block get_dom_template_for_named_properties_object %} 729 {% block get_dom_template_for_named_properties_object %}
730 {% if has_named_properties_object %} 730 {% if has_named_properties_object %}
731 v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplateForNamedPropertiesObjec t(v8::Isolate* isolate, const DOMWrapperWorld& world) { 731 v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplateForNamedPropertiesObjec t(v8::Isolate* isolate, const DOMWrapperWorld& world) {
732 v8::Local<v8::FunctionTemplate> parentTemplate = V8{{parent_interface}}::domTe mplate(isolate, world); 732 v8::Local<v8::FunctionTemplate> parentTemplate = V8{{parent_interface}}::domTe mplate(isolate, world);
733 733
734 v8::Local<v8::FunctionTemplate> namedPropertiesObjectFunctionTemplate = v8::Fu nctionTemplate::New(isolate, V8ObjectConstructor::isValidConstructorMode); 734 v8::Local<v8::FunctionTemplate> namedPropertiesObjectFunctionTemplate = v8::Fu nctionTemplate::New(isolate, V8ObjectConstructor::IsValidConstructorMode);
735 namedPropertiesObjectFunctionTemplate->SetClassName(v8AtomicString(isolate, "{ {interface_name}}Properties")); 735 namedPropertiesObjectFunctionTemplate->SetClassName(V8AtomicString(isolate, "{ {interface_name}}Properties"));
736 namedPropertiesObjectFunctionTemplate->Inherit(parentTemplate); 736 namedPropertiesObjectFunctionTemplate->Inherit(parentTemplate);
737 737
738 v8::Local<v8::ObjectTemplate> namedPropertiesObjectTemplate = namedPropertiesO bjectFunctionTemplate->PrototypeTemplate(); 738 v8::Local<v8::ObjectTemplate> namedPropertiesObjectTemplate = namedPropertiesO bjectFunctionTemplate->PrototypeTemplate();
739 namedPropertiesObjectTemplate->SetInternalFieldCount({{v8_class}}::internalFie ldCount); 739 namedPropertiesObjectTemplate->SetInternalFieldCount({{v8_class}}::internalFie ldCount);
740 // Named Properties object has SetPrototype method of Immutable Prototype Exot ic Objects 740 // Named Properties object has SetPrototype method of Immutable Prototype Exot ic Objects
741 namedPropertiesObjectTemplate->SetImmutableProto(); 741 namedPropertiesObjectTemplate->SetImmutableProto();
742 V8DOMConfiguration::setClassString(isolate, namedPropertiesObjectTemplate, "{{ interface_name}}Properties"); 742 V8DOMConfiguration::SetClassString(isolate, namedPropertiesObjectTemplate, "{{ interface_name}}Properties");
743 {{install_named_property_handler('namedPropertiesObjectTemplate') | indent(2)} } 743 {{install_named_property_handler('namedPropertiesObjectTemplate') | indent(2)} }
744 744
745 return namedPropertiesObjectFunctionTemplate; 745 return namedPropertiesObjectFunctionTemplate;
746 } 746 }
747 747
748 {% endif %} 748 {% endif %}
749 {% endblock %} 749 {% endblock %}
750 750
751 751
752 {##############################################################################} 752 {##############################################################################}
753 {% block has_instance %} 753 {% block has_instance %}
754 {% if not is_array_buffer_or_view %} 754 {% if not is_array_buffer_or_view %}
755 755
756 bool {{v8_class}}::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolat e) { 756 bool {{v8_class}}::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolat e) {
757 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value) ; 757 return V8PerIsolateData::From(isolate)->HasInstance(&wrapperTypeInfo, v8Value) ;
758 } 758 }
759 759
760 v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::V alue> v8Value, v8::Isolate* isolate) { 760 v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::V alue> v8Value, v8::Isolate* isolate) {
761 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperT ypeInfo, v8Value); 761 return V8PerIsolateData::From(isolate)->FindInstanceInPrototypeChain(&wrapperT ypeInfo, v8Value);
762 } 762 }
763 763
764 {% endif %} 764 {% endif %}
765 {% endblock %} 765 {% endblock %}
766 766
767 767
768 {##############################################################################} 768 {##############################################################################}
769 {% block to_impl %} 769 {% block to_impl %}
770 {% if interface_name == 'ArrayBuffer' or interface_name == 'SharedArrayBuffer' % } 770 {% if interface_name == 'ArrayBuffer' or interface_name == 'SharedArrayBuffer' % }
771 {{cpp_class}}* V8{{interface_name}}::toImpl(v8::Local<v8::Object> object) { 771 {{cpp_class}}* V8{{interface_name}}::toImpl(v8::Local<v8::Object> object) {
772 DCHECK(object->Is{{interface_name}}()); 772 DCHECK(object->Is{{interface_name}}());
773 v8::Local<v8::{{interface_name}}> v8buffer = object.As<v8::{{interface_name}}> (); 773 v8::Local<v8::{{interface_name}}> v8buffer = object.As<v8::{{interface_name}}> ();
774 if (v8buffer->IsExternal()) { 774 if (v8buffer->IsExternal()) {
775 const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object); 775 const WrapperTypeInfo* wrapperTypeInfo = ToWrapperTypeInfo(object);
776 CHECK(wrapperTypeInfo); 776 CHECK(wrapperTypeInfo);
777 CHECK_EQ(wrapperTypeInfo->ginEmbedder, gin::kEmbedderBlink); 777 CHECK_EQ(wrapperTypeInfo->gin_embedder, gin::kEmbedderBlink);
778 return toScriptWrappable(object)->toImpl<{{cpp_class}}>(); 778 return ToScriptWrappable(object)->ToImpl<{{cpp_class}}>();
779 } 779 }
780 780
781 // Transfer the ownership of the allocated memory to an {{interface_name}} wit hout 781 // Transfer the ownership of the allocated memory to an {{interface_name}} wit hout
782 // copying. 782 // copying.
783 v8::{{interface_name}}::Contents v8Contents = v8buffer->Externalize(); 783 v8::{{interface_name}}::Contents v8Contents = v8buffer->Externalize();
784 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength(), WTF::ArrayBufferContents::{% if interface_name == 'ArrayBuffer' %}Not{% endif %} Shared); 784 WTF::ArrayBufferContents contents(v8Contents.Data(), v8Contents.ByteLength(), WTF::ArrayBufferContents::k{% if interface_name == 'ArrayBuffer' %}Not{% endif % }Shared);
785 {{cpp_class}}* buffer = {{cpp_class}}::create(contents); 785 {{cpp_class}}* buffer = {{cpp_class}}::Create(contents);
786 v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::Iso late::GetCurrent(), buffer->wrapperTypeInfo(), object); 786 v8::Local<v8::Object> associatedWrapper = buffer->AssociateWithWrapper(v8::Iso late::GetCurrent(), buffer->GetWrapperTypeInfo(), object);
787 DCHECK(associatedWrapper == object); 787 DCHECK(associatedWrapper == object);
788 788
789 return buffer; 789 return buffer;
790 } 790 }
791 791
792 {% elif interface_name == 'ArrayBufferView' %} 792 {% elif interface_name == 'ArrayBufferView' %}
793 {{cpp_class}}* V8ArrayBufferView::toImpl(v8::Local<v8::Object> object) { 793 {{cpp_class}}* V8ArrayBufferView::toImpl(v8::Local<v8::Object> object) {
794 DCHECK(object->IsArrayBufferView()); 794 DCHECK(object->IsArrayBufferView());
795 ScriptWrappable* scriptWrappable = toScriptWrappable(object); 795 ScriptWrappable* scriptWrappable = ToScriptWrappable(object);
796 if (scriptWrappable) 796 if (scriptWrappable)
797 return scriptWrappable->toImpl<{{cpp_class}}>(); 797 return scriptWrappable->ToImpl<{{cpp_class}}>();
798 798
799 if (object->IsInt8Array()) 799 if (object->IsInt8Array())
800 return V8Int8Array::toImpl(object); 800 return V8Int8Array::toImpl(object);
801 if (object->IsInt16Array()) 801 if (object->IsInt16Array())
802 return V8Int16Array::toImpl(object); 802 return V8Int16Array::toImpl(object);
803 if (object->IsInt32Array()) 803 if (object->IsInt32Array())
804 return V8Int32Array::toImpl(object); 804 return V8Int32Array::toImpl(object);
805 if (object->IsUint8Array()) 805 if (object->IsUint8Array())
806 return V8Uint8Array::toImpl(object); 806 return V8Uint8Array::toImpl(object);
807 if (object->IsUint8ClampedArray()) 807 if (object->IsUint8ClampedArray())
808 return V8Uint8ClampedArray::toImpl(object); 808 return V8Uint8ClampedArray::toImpl(object);
809 if (object->IsUint16Array()) 809 if (object->IsUint16Array())
810 return V8Uint16Array::toImpl(object); 810 return V8Uint16Array::toImpl(object);
811 if (object->IsUint32Array()) 811 if (object->IsUint32Array())
812 return V8Uint32Array::toImpl(object); 812 return V8Uint32Array::toImpl(object);
813 if (object->IsFloat32Array()) 813 if (object->IsFloat32Array())
814 return V8Float32Array::toImpl(object); 814 return V8Float32Array::toImpl(object);
815 if (object->IsFloat64Array()) 815 if (object->IsFloat64Array())
816 return V8Float64Array::toImpl(object); 816 return V8Float64Array::toImpl(object);
817 if (object->IsDataView()) 817 if (object->IsDataView())
818 return V8DataView::toImpl(object); 818 return V8DataView::toImpl(object);
819 819
820 NOTREACHED(); 820 NOTREACHED();
821 return 0; 821 return 0;
822 } 822 }
823 823
824 {% elif is_array_buffer_or_view %} 824 {% elif is_array_buffer_or_view %}
825 {{cpp_class}}* {{v8_class}}::toImpl(v8::Local<v8::Object> object) { 825 {{cpp_class}}* {{v8_class}}::toImpl(v8::Local<v8::Object> object) {
826 DCHECK(object->Is{{interface_name}}()); 826 DCHECK(object->Is{{interface_name}}());
827 ScriptWrappable* scriptWrappable = toScriptWrappable(object); 827 ScriptWrappable* scriptWrappable = ToScriptWrappable(object);
828 if (scriptWrappable) 828 if (scriptWrappable)
829 return scriptWrappable->toImpl<{{cpp_class}}>(); 829 return scriptWrappable->ToImpl<{{cpp_class}}>();
830 830
831 v8::Local<v8::{{interface_name}}> v8View = object.As<v8::{{interface_name}}>() ; 831 v8::Local<v8::{{interface_name}}> v8View = object.As<v8::{{interface_name}}>() ;
832 v8::Local<v8::Object> arrayBuffer = v8View->Buffer(); 832 v8::Local<v8::Object> arrayBuffer = v8View->Buffer();
833 {{cpp_class}}* typedArray = nullptr; 833 {{cpp_class}}* typedArray = nullptr;
834 if (arrayBuffer->IsArrayBuffer()) { 834 if (arrayBuffer->IsArrayBuffer()) {
835 typedArray = {{cpp_class}}::create(V8ArrayBuffer::toImpl(arrayBuffer), v8Vie w->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %}Len gth()); 835 typedArray = {{cpp_class}}::Create(V8ArrayBuffer::toImpl(arrayBuffer), v8Vie w->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %}Len gth());
836 } else if (arrayBuffer->IsSharedArrayBuffer()) { 836 } else if (arrayBuffer->IsSharedArrayBuffer()) {
837 typedArray = {{cpp_class}}::create(V8SharedArrayBuffer::toImpl(arrayBuffer), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %}Length()); 837 typedArray = {{cpp_class}}::Create(V8SharedArrayBuffer::toImpl(arrayBuffer), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %}Length());
838 } else { 838 } else {
839 NOTREACHED(); 839 NOTREACHED();
840 } 840 }
841 v8::Local<v8::Object> associatedWrapper = typedArray->associateWithWrapper(v8: :Isolate::GetCurrent(), typedArray->wrapperTypeInfo(), object); 841 v8::Local<v8::Object> associatedWrapper = typedArray->AssociateWithWrapper(v8: :Isolate::GetCurrent(), typedArray->GetWrapperTypeInfo(), object);
842 DCHECK(associatedWrapper == object); 842 DCHECK(associatedWrapper == object);
843 843
844 return typedArray->toImpl<{{cpp_class}}>(); 844 return typedArray->ToImpl<{{cpp_class}}>();
845 } 845 }
846 846
847 {% endif %} 847 {% endif %}
848 {% endblock %} 848 {% endblock %}
849 849
850 850
851 {##############################################################################} 851 {##############################################################################}
852 {% block to_impl_with_type_check %} 852 {% block to_impl_with_type_check %}
853 {{cpp_class}}* {{v8_class}}::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local <v8::Value> value) { 853 {{cpp_class}}* {{v8_class}}::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local <v8::Value> value) {
854 {% if is_array_buffer_or_view %} 854 {% if is_array_buffer_or_view %}
(...skipping 24 matching lines...) Expand all
879 } 879 }
880 880
881 {% endif %} 881 {% endif %}
882 {% endblock %} 882 {% endblock %}
883 883
884 884
885 {##############################################################################} 885 {##############################################################################}
886 {% macro install_unscopables() %} 886 {% macro install_unscopables() %}
887 v8::Local<v8::Name> unscopablesSymbol(v8::Symbol::GetUnscopables(isolate)); 887 v8::Local<v8::Name> unscopablesSymbol(v8::Symbol::GetUnscopables(isolate));
888 v8::Local<v8::Object> unscopables; 888 v8::Local<v8::Object> unscopables;
889 if (v8CallBoolean(prototypeObject->HasOwnProperty(context, unscopablesSymbol))) 889 if (V8CallBoolean(prototypeObject->HasOwnProperty(context, unscopablesSymbol)))
890 unscopables = prototypeObject->Get(context, unscopablesSymbol).ToLocalChecked( ).As<v8::Object>(); 890 unscopables = prototypeObject->Get(context, unscopablesSymbol).ToLocalChecked( ).As<v8::Object>();
891 else 891 else
892 unscopables = v8::Object::New(isolate); 892 unscopables = v8::Object::New(isolate);
893 {% for name, runtime_enabled_feature_name in unscopables %} 893 {% for name, runtime_enabled_feature_name in unscopables %}
894 {% filter runtime_enabled(runtime_enabled_feature_name) %} 894 {% filter runtime_enabled(runtime_enabled_feature_name) %}
895 unscopables->CreateDataProperty(context, v8AtomicString(isolate, "{{name}}"), v8 ::True(isolate)).FromJust(); 895 unscopables->CreateDataProperty(context, V8AtomicString(isolate, "{{name}}"), v8 ::True(isolate)).FromJust();
896 {% endfilter %} 896 {% endfilter %}
897 {% endfor %} 897 {% endfor %}
898 prototypeObject->CreateDataProperty(context, unscopablesSymbol, unscopables).Fro mJust(); 898 prototypeObject->CreateDataProperty(context, unscopablesSymbol, unscopables).Fro mJust();
899 {% endmacro %} 899 {% endmacro %}
900 900
901 901
902 {##############################################################################} 902 {##############################################################################}
903 {% macro install_conditionally_enabled_attributes_on_prototype() %} 903 {% macro install_conditionally_enabled_attributes_on_prototype() %}
904 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %} 904 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %}
905 ExecutionContext* executionContext = toExecutionContext(context); 905 ExecutionContext* executionContext = ToExecutionContext(context);
906 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTempla te); 906 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTempla te);
907 {% for attribute in attributes if (attribute.exposed_test or attribute.secure_co ntext_test) and attribute.on_prototype %} 907 {% for attribute in attributes if (attribute.exposed_test or attribute.secure_co ntext_test) and attribute.on_prototype %}
908 {% filter exposed(attribute.exposed_test) %} 908 {% filter exposed(attribute.exposed_test) %}
909 {% filter secure_context(attribute.secure_context_test) %} 909 {% filter secure_context(attribute.secure_context_test) %}
910 {% filter runtime_enabled(attribute.runtime_enabled_feature_name) %} 910 {% filter runtime_enabled(attribute.runtime_enabled_feature_name) %}
911 const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {{attrib ute_configuration(attribute)}}; 911 const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {{attrib ute_configuration(attribute)}};
912 V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), pro totypeObject, interfaceObject, signature, accessorConfiguration); 912 V8DOMConfiguration::InstallAccessor(isolate, world, v8::Local<v8::Object>(), pro totypeObject, interfaceObject, signature, accessorConfiguration);
913 {% endfilter %}{# runtime_enabled #} 913 {% endfilter %}{# runtime_enabled #}
914 {% endfilter %}{# secure_context #} 914 {% endfilter %}{# secure_context #}
915 {% endfilter %}{# exposed #} 915 {% endfilter %}{# exposed #}
916 {% endfor %} 916 {% endfor %}
917 {% endmacro %} 917 {% endmacro %}
918 918
919 919
920 {##############################################################################} 920 {##############################################################################}
921 {% block partial_interface %} 921 {% block partial_interface %}
922 {% if has_partial_interface %} 922 {% if has_partial_interface %}
923 InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = (Ins tallTemplateFunction)&{{v8_class}}::install{{v8_class}}Template; 923 InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = (Ins tallTemplateFunction)&{{v8_class}}::install{{v8_class}}Template;
924 924
925 void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplate Function, PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInterfac eObjectFunction) { 925 void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplate Function, PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInterfac eObjectFunction) {
926 {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction; 926 {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction;
927 if (preparePrototypeAndInterfaceObjectFunction) 927 if (preparePrototypeAndInterfaceObjectFunction)
928 {{v8_class}}::wrapperTypeInfo.preparePrototypeAndInterfaceObjectFunction = p reparePrototypeAndInterfaceObjectFunction; 928 {{v8_class}}::wrapperTypeInfo.prepare_prototype_and_interface_object_functio n = preparePrototypeAndInterfaceObjectFunction;
929 } 929 }
930 930
931 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 931 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
932 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) { 932 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) {
933 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 933 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
934 } 934 }
935 935
936 {% endfor %} 936 {% endfor %}
937 {% endif %} 937 {% endif %}
938 {% endblock %} 938 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698