| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 {% endif %} | 42 {% endif %} |
| 43 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 43 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 44 } | 44 } |
| 45 | 45 |
| 46 {% endif %} | 46 {% endif %} |
| 47 {% endblock %} | 47 {% endblock %} |
| 48 | 48 |
| 49 | 49 |
| 50 {##############################################################################} | 50 {##############################################################################} |
| 51 {% block indexed_property_setter %} | 51 {% block indexed_property_setter %} |
| 52 {% from 'conversions.cpp' import v8_value_to_local_cpp_value %} |
| 52 {% if indexed_property_setter and not indexed_property_setter.is_custom %} | 53 {% if indexed_property_setter and not indexed_property_setter.is_custom %} |
| 53 {% set setter = indexed_property_setter %} | 54 {% set setter = indexed_property_setter %} |
| 54 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value,
const v8::PropertyCallbackInfo<v8::Value>& info) | 55 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value,
const v8::PropertyCallbackInfo<v8::Value>& info) |
| 55 { | 56 { |
| 56 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 57 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| 57 {{setter.v8_value_to_local_cpp_value}}; | 58 {{v8_value_to_local_cpp_value(setter) | indent}} |
| 58 {% if setter.has_exception_state %} | 59 {% if setter.has_exception_state %} |
| 59 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "{{inter
face_name}}", info.Holder(), info.GetIsolate()); | 60 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "{{inter
face_name}}", info.Holder(), info.GetIsolate()); |
| 60 {% endif %} | 61 {% endif %} |
| 61 {% if setter.has_type_checking_interface %} | 62 {% if setter.has_type_checking_interface %} |
| 62 {# Type checking for interface types (if interface not implemented, throw | 63 {# Type checking for interface types (if interface not implemented, throw |
| 63 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} | 64 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} |
| 64 if (!propertyValue{% if setter.is_nullable %} && !isUndefinedOrNull(v8Value)
{% endif %}) { | 65 if (!propertyValue{% if setter.is_nullable %} && !isUndefinedOrNull(v8Value)
{% endif %}) { |
| 65 exceptionState.throwTypeError("The provided value is not of type '{{sett
er.idl_type}}'."); | 66 exceptionState.throwTypeError("The provided value is not of type '{{sett
er.idl_type}}'."); |
| 66 exceptionState.throwIfNeeded(); | 67 exceptionState.throwIfNeeded(); |
| 67 return; | 68 return; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 {% endif %} | 204 {% endif %} |
| 204 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 205 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
| 205 } | 206 } |
| 206 | 207 |
| 207 {% endif %} | 208 {% endif %} |
| 208 {% endblock %} | 209 {% endblock %} |
| 209 | 210 |
| 210 | 211 |
| 211 {##############################################################################} | 212 {##############################################################################} |
| 212 {% block named_property_setter %} | 213 {% block named_property_setter %} |
| 214 {% from 'conversions.cpp' import v8_value_to_local_cpp_value %} |
| 213 {% if named_property_setter and not named_property_setter.is_custom %} | 215 {% if named_property_setter and not named_property_setter.is_custom %} |
| 214 {% set setter = named_property_setter %} | 216 {% set setter = named_property_setter %} |
| 215 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 217 static void namedPropertySetter(v8::Local<v8::Name> name, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) |
| 216 { | 218 { |
| 217 if (!name->IsString()) | 219 if (!name->IsString()) |
| 218 return; | 220 return; |
| 219 auto nameString = name.As<v8::String>(); | 221 auto nameString = name.As<v8::String>(); |
| 220 {% if not is_override_builtins %} | 222 {% if not is_override_builtins %} |
| 221 if (info.Holder()->HasRealNamedProperty(nameString)) | 223 if (info.Holder()->HasRealNamedProperty(nameString)) |
| 222 return; | 224 return; |
| 223 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(nameString).IsEmpty
()) | 225 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(nameString).IsEmpty
()) |
| 224 return; | 226 return; |
| 225 | 227 |
| 226 {% endif %} | 228 {% endif %} |
| 227 {% if setter.has_exception_state %} | 229 {% if setter.has_exception_state %} |
| 228 v8::String::Utf8Value namedProperty(nameString); | 230 v8::String::Utf8Value namedProperty(nameString); |
| 229 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); | 231 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"{{interface_name}}", info.Holder(), info.GetIsolate()); |
| 230 {% endif %} | 232 {% endif %} |
| 231 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 233 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
| 232 {# v8_value_to_local_cpp_value('DOMString', 'nameString', 'propertyName') #} | 234 {# v8_value_to_local_cpp_value('DOMString', 'nameString', 'propertyName') #} |
| 233 TOSTRING_VOID(V8StringResource<>, propertyName, nameString); | 235 V8StringResource<> propertyName(nameString); |
| 234 {{setter.v8_value_to_local_cpp_value}}; | 236 if (!propertyName.prepare()) |
| 237 return; |
| 238 {{v8_value_to_local_cpp_value(setter) | indent}} |
| 235 {% if setter.has_type_checking_interface %} | 239 {% if setter.has_type_checking_interface %} |
| 236 {# Type checking for interface types (if interface not implemented, throw | 240 {# Type checking for interface types (if interface not implemented, throw |
| 237 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} | 241 TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #} |
| 238 if (!propertyValue{% if setter.is_nullable %} && !isUndefinedOrNull(v8Value)
{% endif %}) { | 242 if (!propertyValue{% if setter.is_nullable %} && !isUndefinedOrNull(v8Value)
{% endif %}) { |
| 239 exceptionState.throwTypeError("The provided value is not of type '{{sett
er.idl_type}}'."); | 243 exceptionState.throwTypeError("The provided value is not of type '{{sett
er.idl_type}}'."); |
| 240 exceptionState.throwIfNeeded(); | 244 exceptionState.throwIfNeeded(); |
| 241 return; | 245 return; |
| 242 } | 246 } |
| 243 {% endif %} | 247 {% endif %} |
| 244 {% set setter_name = setter.name or 'anonymousNamedSetter' %} | 248 {% set setter_name = setter.name or 'anonymousNamedSetter' %} |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 {% if has_event_constructor %} | 528 {% if has_event_constructor %} |
| 525 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) | 529 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 526 { | 530 { |
| 527 ExceptionState exceptionState(ExceptionState::ConstructionContext, "{{interf
ace_name}}", info.Holder(), info.GetIsolate()); | 531 ExceptionState exceptionState(ExceptionState::ConstructionContext, "{{interf
ace_name}}", info.Holder(), info.GetIsolate()); |
| 528 if (info.Length() < 1) { | 532 if (info.Length() < 1) { |
| 529 exceptionState.throwTypeError("An event name must be provided."); | 533 exceptionState.throwTypeError("An event name must be provided."); |
| 530 exceptionState.throwIfNeeded(); | 534 exceptionState.throwIfNeeded(); |
| 531 return; | 535 return; |
| 532 } | 536 } |
| 533 | 537 |
| 534 TOSTRING_VOID(V8StringResource<>, type, info[0]); | 538 V8StringResource<> type(info[0]); |
| 539 if (!type.prepare()) |
| 540 return; |
| 535 {% for attribute in any_type_attributes %} | 541 {% for attribute in any_type_attributes %} |
| 536 v8::Local<v8::Value> {{attribute.name}}; | 542 v8::Local<v8::Value> {{attribute.name}}; |
| 537 {% endfor %} | 543 {% endfor %} |
| 538 {{cpp_class}}Init eventInit; | 544 {{cpp_class}}Init eventInit; |
| 539 if (info.Length() >= 2) { | 545 if (info.Length() >= 2) { |
| 540 Dictionary options(info[1], info.GetIsolate(), exceptionState); | 546 Dictionary options(info[1], info.GetIsolate(), exceptionState); |
| 541 if (!initialize{{cpp_class}}(eventInit, options, exceptionState, info))
{ | 547 if (!initialize{{cpp_class}}(eventInit, options, exceptionState, info))
{ |
| 542 exceptionState.throwIfNeeded(); | 548 exceptionState.throwIfNeeded(); |
| 543 return; | 549 return; |
| 544 } | 550 } |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 } | 985 } |
| 980 | 986 |
| 981 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} | 987 {% for method in methods if method.overloads and method.overloads.has_partial_ov
erloads %} |
| 982 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) | 988 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt
erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) |
| 983 { | 989 { |
| 984 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; | 990 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; |
| 985 } | 991 } |
| 986 {% endfor %} | 992 {% endfor %} |
| 987 {% endif %} | 993 {% endif %} |
| 988 {% endblock %} | 994 {% endblock %} |
| OLD | NEW |