OLD | NEW |
1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_cpp_value %} | 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_cpp_value, check_api_experiment %} |
2 | 2 |
3 | |
4 {##############################################################################} | 3 {##############################################################################} |
5 {% macro attribute_getter(attribute, world_suffix) %} | 4 {% macro attribute_getter(attribute, world_suffix) %} |
6 {% filter conditional(attribute.conditional_string) %} | 5 {% filter conditional(attribute.conditional_string) %} |
7 static void {{attribute.name}}AttributeGetter{{world_suffix}}( | 6 static void {{attribute.name}}AttributeGetter{{world_suffix}}( |
8 {%- if attribute.is_data_type_property %} | 7 {%- if attribute.is_data_type_property %} |
9 const v8::PropertyCallbackInfo<v8::Value>& info | 8 const v8::PropertyCallbackInfo<v8::Value>& info |
10 {%- else %} | 9 {%- else %} |
11 const v8::FunctionCallbackInfo<v8::Value>& info | 10 const v8::FunctionCallbackInfo<v8::Value>& info |
12 {%- endif %}) | 11 {%- endif %}) |
13 { | 12 { |
| 13 {% if attribute.is_api_experiment_enabled %} |
| 14 {{check_api_experiment(attribute) | indent}} |
| 15 {% endif %} |
14 {% if attribute.is_reflect and not attribute.is_url | 16 {% if attribute.is_reflect and not attribute.is_url |
15 and attribute.idl_type == 'DOMString' and is_node | 17 and attribute.idl_type == 'DOMString' and is_node |
16 and not attribute.is_implemented_in_private_script %} | 18 and not attribute.is_implemented_in_private_script %} |
17 {% set cpp_class, v8_class = 'Element', 'V8Element' %} | 19 {% set cpp_class, v8_class = 'Element', 'V8Element' %} |
18 {% endif %} | 20 {% endif %} |
19 {# holder #} | 21 {# holder #} |
20 {% if not attribute.is_static %} | 22 {% if not attribute.is_static %} |
21 {% if attribute.is_lenient_this %} | 23 {% if attribute.is_lenient_this %} |
22 {# Make sure that info.Holder() really points to an instance if [LenientThis
]. #} | 24 {# Make sure that info.Holder() really points to an instance if [LenientThis
]. #} |
23 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) | 25 if (!{{v8_class}}::hasInstance(info.Holder(), info.GetIsolate())) |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 const v8::FunctionCallbackInfo<v8::Value>& info | 173 const v8::FunctionCallbackInfo<v8::Value>& info |
172 {%- endif %}) | 174 {%- endif %}) |
173 { | 175 { |
174 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 176 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
175 {% if attribute.deprecate_as %} | 177 {% if attribute.deprecate_as %} |
176 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); | 178 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); |
177 {% endif %} | 179 {% endif %} |
178 {% if attribute.measure_as %} | 180 {% if attribute.measure_as %} |
179 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte
xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('AttributeGetter')}}); | 181 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte
xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('AttributeGetter')}}); |
180 {% endif %} | 182 {% endif %} |
| 183 {% if attribute.is_api_experiment_enabled %} |
| 184 {{check_api_experiment(attribute) | indent}} |
| 185 {% endif %} |
181 {% if world_suffix in attribute.activity_logging_world_list_for_getter %} | 186 {% if world_suffix in attribute.activity_logging_world_list_for_getter %} |
182 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo
ntext()); | 187 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo
ntext()); |
183 V8PerContextData* contextData = scriptState->perContextData(); | 188 V8PerContextData* contextData = scriptState->perContextData(); |
184 {% if attribute.activity_logging_world_check %} | 189 {% if attribute.activity_logging_world_check %} |
185 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac
tivityLogger()) | 190 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac
tivityLogger()) |
186 {% else %} | 191 {% else %} |
187 if (contextData && contextData->activityLogger()) | 192 if (contextData && contextData->activityLogger()) |
188 {% endif %} | 193 {% endif %} |
189 contextData->activityLogger()->logGetter("{{interface_name}}.{{attribute
.name}}"); | 194 contextData->activityLogger()->logGetter("{{interface_name}}.{{attribute
.name}}"); |
190 {% endif %} | 195 {% endif %} |
(...skipping 13 matching lines...) Expand all Loading... |
204 {% filter conditional(attribute.conditional_string) %} | 209 {% filter conditional(attribute.conditional_string) %} |
205 static void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Loca
l<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) | 210 static void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Loca
l<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) |
206 { | 211 { |
207 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 212 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
208 {% if attribute.deprecate_as %} | 213 {% if attribute.deprecate_as %} |
209 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); | 214 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); |
210 {% endif %} | 215 {% endif %} |
211 {% if attribute.measure_as %} | 216 {% if attribute.measure_as %} |
212 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte
xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('ConstructorGetter')}}
); | 217 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte
xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('ConstructorGetter')}}
); |
213 {% endif %} | 218 {% endif %} |
| 219 {% if attribute.is_api_experiment_enabled %} |
| 220 {{check_api_experiment(attribute) | indent}} |
| 221 {% endif %} |
214 v8ConstructorAttributeGetter(property, info); | 222 v8ConstructorAttributeGetter(property, info); |
215 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 223 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
216 } | 224 } |
217 {% endfilter %} | 225 {% endfilter %} |
218 {% endmacro %} | 226 {% endmacro %} |
219 | 227 |
220 | 228 |
221 {##############################################################################} | 229 {##############################################################################} |
222 {% macro attribute_setter(attribute, world_suffix) %} | 230 {% macro attribute_setter(attribute, world_suffix) %} |
223 {% filter conditional(attribute.conditional_string) %} | 231 {% filter conditional(attribute.conditional_string) %} |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 return false; | 419 return false; |
412 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); | 420 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); |
413 if (!scriptState->contextIsValid()) | 421 if (!scriptState->contextIsValid()) |
414 return false; | 422 return false; |
415 | 423 |
416 ScriptState::Scope scope(scriptState); | 424 ScriptState::Scope scope(scriptState); |
417 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa
l(), scriptState->isolate()); | 425 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa
l(), scriptState->isolate()); |
418 if (holder.IsEmpty()) | 426 if (holder.IsEmpty()) |
419 return false; | 427 return false; |
420 | 428 |
| 429 {% if attribute.is_api_experiment_enabled %} |
| 430 {{check_api_experiment(attribute, "scriptState->isolate()") | indent}} |
| 431 {% endif %} |
| 432 |
421 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); | 433 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); |
422 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc
riptState, scriptStateInUserScript, "{{cpp_class}}", "{{attribute.name}}", holde
r); | 434 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc
riptState, scriptStateInUserScript, "{{cpp_class}}", "{{attribute.name}}", holde
r); |
423 if (v8Value.IsEmpty()) | 435 if (v8Value.IsEmpty()) |
424 return false; | 436 return false; |
425 {{v8_value_to_local_cpp_value(attribute.private_script_v8_value_to_local_cpp
_value) | indent}} | 437 {{v8_value_to_local_cpp_value(attribute.private_script_v8_value_to_local_cpp
_value) | indent}} |
426 RELEASE_ASSERT(!exceptionState.hadException()); | 438 RELEASE_ASSERT(!exceptionState.hadException()); |
427 *result = cppValue; | 439 *result = cppValue; |
428 return true; | 440 return true; |
429 } | 441 } |
430 {% endmacro %} | 442 {% endmacro %} |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 setter_callback_for_main_world, | 518 setter_callback_for_main_world, |
507 wrapper_type_info, | 519 wrapper_type_info, |
508 access_control, | 520 access_control, |
509 property_attribute, | 521 property_attribute, |
510 only_exposed_to_private_script, | 522 only_exposed_to_private_script, |
511 property_location(attribute), | 523 property_location(attribute), |
512 holder_check, | 524 holder_check, |
513 ] %} | 525 ] %} |
514 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 526 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
515 {%- endmacro %} | 527 {%- endmacro %} |
OLD | NEW |