| OLD | NEW |
| 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t
o_local_cpp_value %} | 1 {% from 'utilities.cpp.tmpl' import declare_enum_validation_variable, v8_value_t
o_local_cpp_value %} |
| 2 | 2 |
| 3 {##############################################################################} | 3 {##############################################################################} |
| 4 {% macro attribute_getter(attribute, world_suffix) %} | 4 {% macro attribute_getter(attribute, world_suffix) %} |
| 5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( | 5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
| 6 {%- if attribute.is_data_type_property %} | 6 {%- if attribute.is_data_type_property %} |
| 7 const v8::PropertyCallbackInfo<v8::Value>& info | 7 const v8::PropertyCallbackInfo<v8::Value>& info |
| 8 {%- else %} | 8 {%- else %} |
| 9 const v8::FunctionCallbackInfo<v8::Value>& info | 9 const v8::FunctionCallbackInfo<v8::Value>& info |
| 10 {%- endif %}) { | 10 {%- endif %}) { |
| 11 {% filter format_remove_duplicates(['ExceptionState exceptionState']) %} | 11 {% filter format_remove_duplicates(['ExceptionState exceptionState']) %} |
| 12 {% set define_exception_state -%} | 12 {% set define_exception_state -%} |
| 13 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext
, "{{interface_name}}", "{{attribute.name}}"); | 13 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kGetterContex
t, "{{interface_name}}", "{{attribute.name}}"); |
| 14 {%- endset %} | 14 {%- endset %} |
| 15 | 15 |
| 16 {% if attribute.is_lenient_this %} | 16 {% if attribute.is_lenient_this %} |
| 17 // [LenientThis] | 17 // [LenientThis] |
| 18 // Make sure that info.Holder() really points to an instance if [LenientThis]. | 18 // Make sure that info.Holder() really points to an instance if [LenientThis]. |
| 19 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) | 19 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) |
| 20 return; // Return silently because of [LenientThis]. | 20 return; // Return silently because of [LenientThis]. |
| 21 {% endif %} | 21 {% endif %} |
| 22 | 22 |
| 23 {% if not attribute.is_static %} | 23 {% if not attribute.is_static %} |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 {##############################################################################} | 189 {##############################################################################} |
| 190 {% macro attribute_getter_callback(attribute, world_suffix) %} | 190 {% macro attribute_getter_callback(attribute, world_suffix) %} |
| 191 void {{attribute.name}}AttributeGetterCallback{{world_suffix}}( | 191 void {{attribute.name}}AttributeGetterCallback{{world_suffix}}( |
| 192 {%- if attribute.is_data_type_property %} | 192 {%- if attribute.is_data_type_property %} |
| 193 v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info | 193 v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info |
| 194 {%- else %} | 194 {%- else %} |
| 195 const v8::FunctionCallbackInfo<v8::Value>& info | 195 const v8::FunctionCallbackInfo<v8::Value>& info |
| 196 {%- endif %}) { | 196 {%- endif %}) { |
| 197 {% if attribute.deprecate_as %} | 197 {% if attribute.deprecate_as %} |
| 198 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::{{attribute.deprecate_as}}); | 198 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::k{{attribute.deprecate_as}}); |
| 199 {% endif %} | 199 {% endif %} |
| 200 | 200 |
| 201 {% if attribute.measure_as %} | 201 {% if attribute.measure_as %} |
| 202 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{at
tribute.measure_as('AttributeGetter')}}); | 202 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::k{{a
ttribute.measure_as('AttributeGetter')}}); |
| 203 {% endif %} | 203 {% endif %} |
| 204 | 204 |
| 205 {% if world_suffix in attribute.activity_logging_world_list_for_getter %} | 205 {% if world_suffix in attribute.activity_logging_world_list_for_getter %} |
| 206 {% if attribute.is_static %} | 206 {% if attribute.is_static %} |
| 207 ScriptState* scriptState = ScriptState::forFunctionObject(info); | 207 ScriptState* scriptState = ScriptState::forFunctionObject(info); |
| 208 {% else %} | 208 {% else %} |
| 209 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 209 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
| 210 {% endif %} | 210 {% endif %} |
| 211 V8PerContextData* contextData = scriptState->perContextData(); | 211 V8PerContextData* contextData = scriptState->perContextData(); |
| 212 if ( | 212 if ( |
| (...skipping 20 matching lines...) Expand all Loading... |
| 233 { | 233 { |
| 234 return V8PrivateProperty::get{{attribute.cached_accessor_name}}(isolate).get
Private(); | 234 return V8PrivateProperty::get{{attribute.cached_accessor_name}}(isolate).get
Private(); |
| 235 } | 235 } |
| 236 {% endmacro %} | 236 {% endmacro %} |
| 237 | 237 |
| 238 | 238 |
| 239 {##############################################################################} | 239 {##############################################################################} |
| 240 {% macro constructor_getter_callback(attribute, world_suffix) %} | 240 {% macro constructor_getter_callback(attribute, world_suffix) %} |
| 241 void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Local<v8::N
ame> property, const v8::PropertyCallbackInfo<v8::Value>& info) { | 241 void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Local<v8::N
ame> property, const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 242 {% if attribute.deprecate_as %} | 242 {% if attribute.deprecate_as %} |
| 243 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::{{attribute.deprecate_as}}); | 243 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::k{{attribute.deprecate_as}}); |
| 244 {% endif %} | 244 {% endif %} |
| 245 | 245 |
| 246 {% if attribute.measure_as %} | 246 {% if attribute.measure_as %} |
| 247 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{at
tribute.measure_as('ConstructorGetter')}}); | 247 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::k{{a
ttribute.measure_as('ConstructorGetter')}}); |
| 248 {% endif %} | 248 {% endif %} |
| 249 | 249 |
| 250 v8ConstructorAttributeGetter(property, info); | 250 v8ConstructorAttributeGetter(property, info); |
| 251 } | 251 } |
| 252 {% endmacro %} | 252 {% endmacro %} |
| 253 | 253 |
| 254 | 254 |
| 255 {##############################################################################} | 255 {##############################################################################} |
| 256 {% macro attribute_setter(attribute, world_suffix) %} | 256 {% macro attribute_setter(attribute, world_suffix) %} |
| 257 static void {{attribute.name}}AttributeSetter{{world_suffix}}( | 257 static void {{attribute.name}}AttributeSetter{{world_suffix}}( |
| 258 {%- if attribute.has_cross_origin_setter %} | 258 {%- if attribute.has_cross_origin_setter %} |
| 259 v8::Local<v8::Value> v8Value, const V8CrossOriginSetterInfo& info | 259 v8::Local<v8::Value> v8Value, const V8CrossOriginSetterInfo& info |
| 260 {%- elif attribute.is_data_type_property %} | 260 {%- elif attribute.is_data_type_property %} |
| 261 v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info | 261 v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info |
| 262 {%- else %} | 262 {%- else %} |
| 263 v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info | 263 v8::Local<v8::Value> v8Value, const v8::FunctionCallbackInfo<v8::Value>& info |
| 264 {%- endif %}) { | 264 {%- endif %}) { |
| 265 {% filter format_remove_duplicates(['ExceptionState exceptionState']) %} | 265 {% filter format_remove_duplicates(['ExceptionState exceptionState']) %} |
| 266 {% set define_exception_state -%} | 266 {% set define_exception_state -%} |
| 267 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext
, "{{interface_name}}", "{{attribute.name}}"); | 267 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kSetterContex
t, "{{interface_name}}", "{{attribute.name}}"); |
| 268 {%- endset %} | 268 {%- endset %} |
| 269 | 269 |
| 270 {% if attribute.is_lenient_this %} | 270 {% if attribute.is_lenient_this %} |
| 271 // [LenientThis] | 271 // [LenientThis] |
| 272 // Make sure that info.Holder() really points to an instance if [LenientThis]. | 272 // Make sure that info.Holder() really points to an instance if [LenientThis]. |
| 273 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) | 273 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) |
| 274 return; // Return silently because of [LenientThis]. | 274 return; // Return silently because of [LenientThis]. |
| 275 {% endif %} | 275 {% endif %} |
| 276 | 276 |
| 277 {% if not attribute.is_static and not attribute.is_replaceable %} | 277 {% if not attribute.is_static and not attribute.is_replaceable %} |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 return; | 325 return; |
| 326 } | 326 } |
| 327 {% endif %} | 327 {% endif %} |
| 328 | 328 |
| 329 {% if attribute.enum_values %} | 329 {% if attribute.enum_values %} |
| 330 // Type check per: http://heycam.github.io/webidl/#dfn-attribute-setter | 330 // Type check per: http://heycam.github.io/webidl/#dfn-attribute-setter |
| 331 // Returns undefined without setting the value if the value is invalid. | 331 // Returns undefined without setting the value if the value is invalid. |
| 332 DummyExceptionStateForTesting dummyExceptionState; | 332 DummyExceptionStateForTesting dummyExceptionState; |
| 333 {{declare_enum_validation_variable(attribute.enum_values) | indent(2)}} | 333 {{declare_enum_validation_variable(attribute.enum_values) | indent(2)}} |
| 334 if (!isValidEnum(cppValue, validValues, WTF_ARRAY_LENGTH(validValues), "{{attr
ibute.enum_type}}", dummyExceptionState)) { | 334 if (!isValidEnum(cppValue, validValues, WTF_ARRAY_LENGTH(validValues), "{{attr
ibute.enum_type}}", dummyExceptionState)) { |
| 335 currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMessage
::create(JSMessageSource, WarningMessageLevel, dummyExceptionState.message())); | 335 currentExecutionContext(info.GetIsolate())->addConsoleMessage(ConsoleMessage
::create(kJSMessageSource, kWarningMessageLevel, dummyExceptionState.message()))
; |
| 336 return; | 336 return; |
| 337 } | 337 } |
| 338 {% endif %} | 338 {% endif %} |
| 339 | 339 |
| 340 {% if attribute.is_call_with_execution_context or attribute.is_setter_call_wit
h_execution_context %} | 340 {% if attribute.is_call_with_execution_context or attribute.is_setter_call_wit
h_execution_context %} |
| 341 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()
); | 341 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()
); |
| 342 {% endif %} | 342 {% endif %} |
| 343 | 343 |
| 344 {% if attribute.is_call_with_script_state %} | 344 {% if attribute.is_call_with_script_state %} |
| 345 {% if attribute.is_static %} | 345 {% if attribute.is_static %} |
| (...skipping 24 matching lines...) Expand all Loading... |
| 370 {%- if attribute.is_data_type_property %} | 370 {%- if attribute.is_data_type_property %} |
| 371 v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInf
o<void>& info | 371 v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInf
o<void>& info |
| 372 {%- else %} | 372 {%- else %} |
| 373 const v8::FunctionCallbackInfo<v8::Value>& info | 373 const v8::FunctionCallbackInfo<v8::Value>& info |
| 374 {%- endif %}) { | 374 {%- endif %}) { |
| 375 {% if not attribute.is_data_type_property %} | 375 {% if not attribute.is_data_type_property %} |
| 376 v8::Local<v8::Value> v8Value = info[0]; | 376 v8::Local<v8::Value> v8Value = info[0]; |
| 377 {% endif %} | 377 {% endif %} |
| 378 | 378 |
| 379 {% if attribute.deprecate_as %} | 379 {% if attribute.deprecate_as %} |
| 380 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::{{attribute.deprecate_as}}); | 380 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::k{{attribute.deprecate_as}}); |
| 381 {% endif %} | 381 {% endif %} |
| 382 | 382 |
| 383 {% if attribute.measure_as %} | 383 {% if attribute.measure_as %} |
| 384 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{at
tribute.measure_as('AttributeSetter')}}); | 384 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::k{{a
ttribute.measure_as('AttributeSetter')}}); |
| 385 {% endif %} | 385 {% endif %} |
| 386 | 386 |
| 387 {% if world_suffix in attribute.activity_logging_world_list_for_setter %} | 387 {% if world_suffix in attribute.activity_logging_world_list_for_setter %} |
| 388 {% if attribute.is_static %} | 388 {% if attribute.is_static %} |
| 389 ScriptState* scriptState = ScriptState::forFunctionObject(info); | 389 ScriptState* scriptState = ScriptState::forFunctionObject(info); |
| 390 {% else %} | 390 {% else %} |
| 391 ScriptState* scriptState = ScriptState::forReceiverObject(info); | 391 ScriptState* scriptState = ScriptState::forReceiverObject(info); |
| 392 {% endif %} | 392 {% endif %} |
| 393 V8PerContextData* contextData = scriptState->perContextData(); | 393 V8PerContextData* contextData = scriptState->perContextData(); |
| 394 if ( | 394 if ( |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 ' | '.join(attribute.access_control_list) %} | 450 ' | '.join(attribute.access_control_list) %} |
| 451 {% else %} | 451 {% else %} |
| 452 {% set access_control = 'v8::DEFAULT' %} | 452 {% set access_control = 'v8::DEFAULT' %} |
| 453 {% endif %} | 453 {% endif %} |
| 454 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % | 454 {% set property_attribute = 'static_cast<v8::PropertyAttribute>(%s)' % |
| 455 ' | '.join(attribute.property_attributes) %} | 455 ' | '.join(attribute.property_attributes) %} |
| 456 {% set cached_accessor_callback = | 456 {% set cached_accessor_callback = |
| 457 '%sV8Internal::%sCachedAccessorCallback' % (cpp_class_or_partial, attribu
te.name) | 457 '%sV8Internal::%sCachedAccessorCallback' % (cpp_class_or_partial, attribu
te.name) |
| 458 if attribute.is_cached_accessor else | 458 if attribute.is_cached_accessor else |
| 459 'nullptr' %} | 459 'nullptr' %} |
| 460 {% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' | 460 {% set holder_check = 'V8DOMConfiguration::kDoNotCheckHolder' |
| 461 if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} | 461 if attribute.is_lenient_this else 'V8DOMConfiguration::kCheckHolder' %} |
| 462 {% set attribute_configuration_list = [ | 462 {% set attribute_configuration_list = [ |
| 463 '"%s"' % attribute.name, | 463 '"%s"' % attribute.name, |
| 464 getter_callback, | 464 getter_callback, |
| 465 setter_callback, | 465 setter_callback, |
| 466 getter_callback_for_main_world, | 466 getter_callback_for_main_world, |
| 467 setter_callback_for_main_world, | 467 setter_callback_for_main_world, |
| 468 cached_accessor_callback, | 468 cached_accessor_callback, |
| 469 wrapper_type_info, | 469 wrapper_type_info, |
| 470 access_control, | 470 access_control, |
| 471 property_attribute, | 471 property_attribute, |
| 472 property_location(attribute), | 472 property_location(attribute), |
| 473 holder_check, | 473 holder_check, |
| 474 ] %} | 474 ] %} |
| 475 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 475 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
| 476 {%- endmacro %} | 476 {%- endmacro %} |
| OLD | NEW |