| OLD | NEW |
| 1 {% extends 'interface_base.cpp' %} | 1 {% extends 'interface_base.cpp' %} |
| 2 | 2 |
| 3 | 3 |
| 4 {##############################################################################} | 4 {##############################################################################} |
| 5 {% block indexed_property_getter %} | 5 {% block indexed_property_getter %} |
| 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} | 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} |
| 7 {% set getter = indexed_property_getter %} | 7 {% set getter = indexed_property_getter %} |
| 8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | 8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) |
| 9 { | 9 { |
| 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 {% endif %} | 160 {% endif %} |
| 161 {% endblock %} | 161 {% endblock %} |
| 162 | 162 |
| 163 | 163 |
| 164 {##############################################################################} | 164 {##############################################################################} |
| 165 {% block named_property_getter %} | 165 {% block named_property_getter %} |
| 166 {% if named_property_getter and not named_property_getter.is_custom %} | 166 {% if named_property_getter and not named_property_getter.is_custom %} |
| 167 {% set getter = named_property_getter %} | 167 {% set getter = named_property_getter %} |
| 168 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall
backInfo<v8::Value>& info) | 168 static void namedPropertyGetter(v8::Local<v8::Name> name, const v8::PropertyCall
backInfo<v8::Value>& info) |
| 169 { | 169 { |
| 170 if (!name->IsString()) | |
| 171 return; | |
| 172 auto nameString = name.As<v8::String>(); | 170 auto nameString = name.As<v8::String>(); |
| 173 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 171 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| 174 AtomicString propertyName = toCoreAtomicString(nameString); | 172 AtomicString propertyName = toCoreAtomicString(nameString); |
| 175 {% if getter.is_raises_exception %} | 173 {% if getter.is_raises_exception %} |
| 176 v8::String::Utf8Value namedProperty(nameString); | 174 v8::String::Utf8Value namedProperty(nameString); |
| 177 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); | 175 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 178 {% endif %} | 176 {% endif %} |
| 179 {% if getter.is_call_with_script_state %} | 177 {% if getter.is_call_with_script_state %} |
| 180 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | 178 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| 181 {% endif %} | 179 {% endif %} |
| (...skipping 15 matching lines...) Expand all Loading... |
| 197 {% endif %} | 195 {% endif %} |
| 198 {% endblock %} | 196 {% endblock %} |
| 199 | 197 |
| 200 | 198 |
| 201 {##############################################################################} | 199 {##############################################################################} |
| 202 {% block named_property_getter_callback %} | 200 {% block named_property_getter_callback %} |
| 203 {% if named_property_getter %} | 201 {% if named_property_getter %} |
| 204 {% set getter = named_property_getter %} | 202 {% set getter = named_property_getter %} |
| 205 static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop
ertyCallbackInfo<v8::Value>& info) | 203 static void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::Prop
ertyCallbackInfo<v8::Value>& info) |
| 206 { | 204 { |
| 205 if (!name->IsString()) |
| 206 return; |
| 207 {% if getter.is_custom %} | 207 {% if getter.is_custom %} |
| 208 {{v8_class}}::namedPropertyGetterCustom(name, info); | 208 {{v8_class}}::namedPropertyGetterCustom(name, info); |
| 209 {% else %} | 209 {% else %} |
| 210 {{cpp_class}}V8Internal::namedPropertyGetter(name, info); | 210 {{cpp_class}}V8Internal::namedPropertyGetter(name, info); |
| 211 {% endif %} | 211 {% endif %} |
| 212 } | 212 } |
| 213 | 213 |
| 214 {% endif %} | 214 {% endif %} |
| 215 {% endblock %} | 215 {% endblock %} |
| 216 | 216 |
| 217 | 217 |
| 218 {##############################################################################} | 218 {##############################################################################} |
| 219 {% block named_property_setter %} | 219 {% block named_property_setter %} |
| 220 {% from 'utilities.cpp' import v8_value_to_local_cpp_value %} | 220 {% from 'utilities.cpp' import v8_value_to_local_cpp_value %} |
| 221 {% if named_property_setter and not named_property_setter.is_custom %} | 221 {% if named_property_setter and not named_property_setter.is_custom %} |
| 222 {% set setter = named_property_setter %} | 222 {% set setter = named_property_setter %} |
| 223 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 223 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 224 { | 224 { |
| 225 if (!name->IsString()) | |
| 226 return; | |
| 227 auto nameString = name.As<v8::String>(); | 225 auto nameString = name.As<v8::String>(); |
| 228 {% if setter.has_exception_state %} | 226 {% if setter.has_exception_state %} |
| 229 v8::String::Utf8Value namedProperty(nameString); | 227 v8::String::Utf8Value namedProperty(nameString); |
| 230 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); | 228 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 231 {% endif %} | 229 {% endif %} |
| 232 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 230 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| 233 {# v8_value_to_local_cpp_value('DOMString', 'nameString', 'propertyName') #} | 231 {# v8_value_to_local_cpp_value('DOMString', 'nameString', 'propertyName') #} |
| 234 V8StringResource<> propertyName(nameString); | 232 V8StringResource<> propertyName(nameString); |
| 235 if (!propertyName.prepare()) | 233 if (!propertyName.prepare()) |
| 236 return; | 234 return; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 {% endif %} | 266 {% endif %} |
| 269 {% endblock %} | 267 {% endblock %} |
| 270 | 268 |
| 271 | 269 |
| 272 {##############################################################################} | 270 {##############################################################################} |
| 273 {% block named_property_setter_callback %} | 271 {% block named_property_setter_callback %} |
| 274 {% if named_property_setter %} | 272 {% if named_property_setter %} |
| 275 {% set setter = named_property_setter %} | 273 {% set setter = named_property_setter %} |
| 276 static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::
Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 274 static void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::
Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 277 { | 275 { |
| 276 if (!name->IsString()) |
| 277 return; |
| 278 {% if setter.is_custom %} | 278 {% if setter.is_custom %} |
| 279 {{v8_class}}::namedPropertySetterCustom(name, v8Value, info); | 279 {{v8_class}}::namedPropertySetterCustom(name, v8Value, info); |
| 280 {% else %} | 280 {% else %} |
| 281 {{cpp_class}}V8Internal::namedPropertySetter(name, v8Value, info); | 281 {{cpp_class}}V8Internal::namedPropertySetter(name, v8Value, info); |
| 282 {% endif %} | 282 {% endif %} |
| 283 } | 283 } |
| 284 | 284 |
| 285 {% endif %} | 285 {% endif %} |
| 286 {% endblock %} | 286 {% endblock %} |
| 287 | 287 |
| 288 | 288 |
| 289 {##############################################################################} | 289 {##############################################################################} |
| 290 {% block named_property_query %} | 290 {% block named_property_query %} |
| 291 {% if named_property_getter and named_property_getter.is_enumerable and | 291 {% if named_property_getter and named_property_getter.is_enumerable and |
| 292 not named_property_getter.is_custom_property_query %} | 292 not named_property_getter.is_custom_property_query %} |
| 293 {% set getter = named_property_getter %} | 293 {% set getter = named_property_getter %} |
| 294 {# If there is an enumerator, there MUST be a query method to properly | 294 {# If there is an enumerator, there MUST be a query method to properly |
| 295 communicate property attributes. #} | 295 communicate property attributes. #} |
| 296 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb
ackInfo<v8::Integer>& info) | 296 static void namedPropertyQuery(v8::Local<v8::Name> name, const v8::PropertyCallb
ackInfo<v8::Integer>& info) |
| 297 { | 297 { |
| 298 if (!name->IsString()) | |
| 299 return; | |
| 300 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 298 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| 301 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); | 299 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); |
| 302 v8::String::Utf8Value namedProperty(name); | 300 v8::String::Utf8Value namedProperty(name); |
| 303 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); | 301 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 304 {% set getter_arguments = ['propertyName', 'exceptionState'] %} | 302 {% set getter_arguments = ['propertyName', 'exceptionState'] %} |
| 305 {% if getter.is_call_with_script_state %} | 303 {% if getter.is_call_with_script_state %} |
| 306 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | 304 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| 307 {% set getter_arguments = ['scriptState'] + getter_arguments %} | 305 {% set getter_arguments = ['scriptState'] + getter_arguments %} |
| 308 {% endif %} | 306 {% endif %} |
| 309 bool result = impl->namedPropertyQuery({{getter_arguments | join(', ')}}); | 307 bool result = impl->namedPropertyQuery({{getter_arguments | join(', ')}}); |
| 310 if (exceptionState.throwIfNeeded()) | 308 if (exceptionState.throwIfNeeded()) |
| 311 return; | 309 return; |
| 312 if (!result) | 310 if (!result) |
| 313 return; | 311 return; |
| 314 v8SetReturnValueInt(info, v8::None); | 312 v8SetReturnValueInt(info, v8::None); |
| 315 } | 313 } |
| 316 | 314 |
| 317 {% endif %} | 315 {% endif %} |
| 318 {% endblock %} | 316 {% endblock %} |
| 319 | 317 |
| 320 | 318 |
| 321 {##############################################################################} | 319 {##############################################################################} |
| 322 {% block named_property_query_callback %} | 320 {% block named_property_query_callback %} |
| 323 {% if named_property_getter and named_property_getter.is_enumerable %} | 321 {% if named_property_getter and named_property_getter.is_enumerable %} |
| 324 {% set getter = named_property_getter %} | 322 {% set getter = named_property_getter %} |
| 325 static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::Prope
rtyCallbackInfo<v8::Integer>& info) | 323 static void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::Prope
rtyCallbackInfo<v8::Integer>& info) |
| 326 { | 324 { |
| 325 if (!name->IsString()) |
| 326 return; |
| 327 {% if getter.is_custom_property_query %} | 327 {% if getter.is_custom_property_query %} |
| 328 {{v8_class}}::namedPropertyQueryCustom(name, info); | 328 {{v8_class}}::namedPropertyQueryCustom(name, info); |
| 329 {% else %} | 329 {% else %} |
| 330 {{cpp_class}}V8Internal::namedPropertyQuery(name, info); | 330 {{cpp_class}}V8Internal::namedPropertyQuery(name, info); |
| 331 {% endif %} | 331 {% endif %} |
| 332 } | 332 } |
| 333 | 333 |
| 334 {% endif %} | 334 {% endif %} |
| 335 {% endblock %} | 335 {% endblock %} |
| 336 | 336 |
| 337 | 337 |
| 338 {##############################################################################} | 338 {##############################################################################} |
| 339 {% block named_property_deleter %} | 339 {% block named_property_deleter %} |
| 340 {% if named_property_deleter and not named_property_deleter.is_custom %} | 340 {% if named_property_deleter and not named_property_deleter.is_custom %} |
| 341 {% set deleter = named_property_deleter %} | 341 {% set deleter = named_property_deleter %} |
| 342 static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) | 342 static void namedPropertyDeleter(v8::Local<v8::Name> name, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) |
| 343 { | 343 { |
| 344 if (!name->IsString()) | |
| 345 return; | |
| 346 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 344 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| 347 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); | 345 AtomicString propertyName = toCoreAtomicString(name.As<v8::String>()); |
| 348 {% if deleter.is_raises_exception %} | 346 {% if deleter.is_raises_exception %} |
| 349 v8::String::Utf8Value namedProperty(name); | 347 v8::String::Utf8Value namedProperty(name); |
| 350 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert
y, "{{interface_name}}", info.Holder(), info.GetIsolate()); | 348 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert
y, "{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 351 {% endif %} | 349 {% endif %} |
| 352 {% if deleter.is_call_with_script_state %} | 350 {% if deleter.is_call_with_script_state %} |
| 353 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | 351 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| 354 {% endif %} | 352 {% endif %} |
| 355 {% set deleter_name = deleter.name or 'anonymousNamedDeleter' %} | 353 {% set deleter_name = deleter.name or 'anonymousNamedDeleter' %} |
| (...skipping 16 matching lines...) Expand all Loading... |
| 372 {% endif %} | 370 {% endif %} |
| 373 {% endblock %} | 371 {% endblock %} |
| 374 | 372 |
| 375 | 373 |
| 376 {##############################################################################} | 374 {##############################################################################} |
| 377 {% block named_property_deleter_callback %} | 375 {% block named_property_deleter_callback %} |
| 378 {% if named_property_deleter %} | 376 {% if named_property_deleter %} |
| 379 {% set deleter = named_property_deleter %} | 377 {% set deleter = named_property_deleter %} |
| 380 static void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::Pro
pertyCallbackInfo<v8::Boolean>& info) | 378 static void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::Pro
pertyCallbackInfo<v8::Boolean>& info) |
| 381 { | 379 { |
| 380 if (!name->IsString()) |
| 381 return; |
| 382 {% if deleter.is_custom %} | 382 {% if deleter.is_custom %} |
| 383 {{v8_class}}::namedPropertyDeleterCustom(name, info); | 383 {{v8_class}}::namedPropertyDeleterCustom(name, info); |
| 384 {% else %} | 384 {% else %} |
| 385 {{cpp_class}}V8Internal::namedPropertyDeleter(name, info); | 385 {{cpp_class}}V8Internal::namedPropertyDeleter(name, info); |
| 386 {% endif %} | 386 {% endif %} |
| 387 } | 387 } |
| 388 | 388 |
| 389 {% endif %} | 389 {% endif %} |
| 390 {% endblock %} | 390 {% endblock %} |
| 391 | 391 |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 | 934 |
| 935 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} | 935 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} |
| 936 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) | 936 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
| 937 { | 937 { |
| 938 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; | 938 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; |
| 939 } | 939 } |
| 940 | 940 |
| 941 {% endfor %} | 941 {% endfor %} |
| 942 {% endif %} | 942 {% endif %} |
| 943 {% endblock %} | 943 {% endblock %} |
| OLD | NEW |