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 |
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 {% if attribute.api_experiment_name %} | |
15 String errorMessage; | |
16 if (!Experiments::isApiEnabled(currentExecutionContext(info.GetIsolate()), " {{ attribute.api_experiment_name }}", errorMessage)) { | |
17 v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); | |
18 Document& document = *toDocument(currentExecutionContext(info.GetIsolate ())); | |
19 document.addConsoleMessage(ConsoleMessage::create(JSMessageSource, Error MessageLevel, errorMessage)); | |
20 return; | |
21 } | |
22 {% endif %} | |
14 {% if attribute.is_reflect and not attribute.is_url | 23 {% if attribute.is_reflect and not attribute.is_url |
15 and attribute.idl_type == 'DOMString' and is_node | 24 and attribute.idl_type == 'DOMString' and is_node |
16 and not attribute.is_implemented_in_private_script %} | 25 and not attribute.is_implemented_in_private_script %} |
17 {% set cpp_class, v8_class = 'Element', 'V8Element' %} | 26 {% set cpp_class, v8_class = 'Element', 'V8Element' %} |
18 {% endif %} | 27 {% endif %} |
19 {# holder #} | 28 {# holder #} |
20 {% if not attribute.is_static %} | 29 {% if not attribute.is_static %} |
21 {% if attribute.is_lenient_this %} | 30 {% if attribute.is_lenient_this %} |
22 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(in fo.This(), info.GetIsolate()); | 31 v8::Local<v8::Object> holder = {{v8_class}}::findInstanceInPrototypeChain(in fo.This(), info.GetIsolate()); |
23 if (holder.IsEmpty()) | 32 if (holder.IsEmpty()) |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 } | 209 } |
201 {% endfilter %} | 210 {% endfilter %} |
202 {% endmacro %} | 211 {% endmacro %} |
203 | 212 |
204 | 213 |
205 {##############################################################################} | 214 {##############################################################################} |
206 {% macro constructor_getter_callback(attribute, world_suffix) %} | 215 {% macro constructor_getter_callback(attribute, world_suffix) %} |
207 {% filter conditional(attribute.conditional_string) %} | 216 {% filter conditional(attribute.conditional_string) %} |
208 static void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Loca l<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) | 217 static void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Loca l<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) |
209 { | 218 { |
219 {% if attribute.api_experiment_name %} | |
Daniel Nishi
2015/12/16 21:42:03
I've replaced the is%sExperimentallyEnabled with t
| |
220 String errorMessage; | |
221 if (!Experiments::isApiEnabled(currentExecutionContext(info.GetIsolate()), " {{ attribute.api_experiment_name }}", errorMessage)) { | |
222 v8SetReturnValue(info, v8::Undefined(info.GetIsolate())); | |
223 Document& document = *toDocument(currentExecutionContext(info.GetIsolate ())); | |
224 document.addConsoleMessage(ConsoleMessage::create(JSMessageSource, Error MessageLevel, errorMessage)); | |
225 return; | |
226 } | |
227 {% endif %} | |
210 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 228 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
211 {% if attribute.deprecate_as %} | 229 {% if attribute.deprecate_as %} |
212 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe cutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); | 230 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe cutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); |
213 {% endif %} | 231 {% endif %} |
214 {% if attribute.measure_as %} | 232 {% if attribute.measure_as %} |
215 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('ConstructorGetter')}} ); | 233 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('ConstructorGetter')}} ); |
216 {% endif %} | 234 {% endif %} |
217 v8ConstructorAttributeGetter(property, info); | 235 v8ConstructorAttributeGetter(property, info); |
218 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 236 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
219 } | 237 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
460 } | 478 } |
461 {% endmacro %} | 479 {% endmacro %} |
462 | 480 |
463 | 481 |
464 {##############################################################################} | 482 {##############################################################################} |
465 {% macro attribute_configuration(attribute) %} | 483 {% macro attribute_configuration(attribute) %} |
466 {% from 'conversions.cpp' import property_location %} | 484 {% from 'conversions.cpp' import property_location %} |
467 {% if attribute.constructor_type %} | 485 {% if attribute.constructor_type %} |
468 {% set getter_callback = | 486 {% set getter_callback = |
469 '%sV8Internal::%sConstructorGetterCallback' % (cpp_class_or_partial, attr ibute.name) | 487 '%sV8Internal::%sConstructorGetterCallback' % (cpp_class_or_partial, attr ibute.name) |
470 if attribute.needs_constructor_getter_callback else | 488 if attribute.needs_constructor_getter_callback else 'v8ConstructorAttribu teGetter' %} |
471 'v8ConstructorAttributeGetter' %} | |
472 {% set setter_callback = | 489 {% set setter_callback = |
473 '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_or_partial, attrib ute.name) | 490 '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_or_partial, attrib ute.name) |
474 if attribute.needs_constructor_setter_callback else | 491 if attribute.needs_constructor_setter_callback else |
475 '%sV8Internal::%sConstructorAttributeSetterCallback' % (cpp_class_or_part ial, cpp_class) %} | 492 '%sV8Internal::%sConstructorAttributeSetterCallback' % (cpp_class_or_part ial, cpp_class) %} |
476 {% else %}{# regular attributes #} | 493 {% else %}{# regular attributes #} |
477 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % | 494 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' % |
478 (cpp_class_or_partial, attribute.name) %} | 495 (cpp_class_or_partial, attribute.name) %} |
479 {% set setter_callback = '%sV8Internal::%sAttributeSetterCallback' % | 496 {% set setter_callback = '%sV8Internal::%sAttributeSetterCallback' % |
480 (cpp_class_or_partial, attribute.name) | 497 (cpp_class_or_partial, attribute.name) |
481 if attribute.has_setter else '0' %} | 498 if attribute.has_setter else '0' %} |
(...skipping 30 matching lines...) Expand all Loading... | |
512 setter_callback_for_main_world, | 529 setter_callback_for_main_world, |
513 wrapper_type_info, | 530 wrapper_type_info, |
514 access_control, | 531 access_control, |
515 property_attribute, | 532 property_attribute, |
516 only_exposed_to_private_script, | 533 only_exposed_to_private_script, |
517 property_location(attribute), | 534 property_location(attribute), |
518 holder_check, | 535 holder_check, |
519 ] %} | 536 ] %} |
520 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} | 537 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
521 {%- endmacro %} | 538 {%- endmacro %} |
OLD | NEW |