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