Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: Source/bindings/templates/interface_base.cpp

Issue 1226203012: Revert of bindings: Makes almost all attributes accessor-type properties. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 {% include 'copyright_block.txt' %} 1 {% include 'copyright_block.txt' %}
2 #include "config.h" 2 #include "config.h"
3 {% filter conditional(conditional_string) %} 3 {% filter conditional(conditional_string) %}
4 #include "{{v8_class_or_partial}}.h" 4 #include "{{v8_class_or_partial}}.h"
5 5
6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} 6 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %}
7 #include "{{filename}}" 7 #include "{{filename}}"
8 {% endfor %} 8 {% endfor %}
9 9
10 namespace blink { 10 namespace blink {
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 {% block install_attributes %} 220 {% block install_attributes %}
221 {% from 'attributes.cpp' import attribute_configuration with context %} 221 {% from 'attributes.cpp' import attribute_configuration with context %}
222 {% if has_attribute_configuration %} 222 {% if has_attribute_configuration %}
223 // Suppress warning: global constructors, because AttributeConfiguration is triv ial 223 // Suppress warning: global constructors, because AttributeConfiguration is triv ial
224 // and does not depend on another global objects. 224 // and does not depend on another global objects.
225 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 225 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
226 #pragma clang diagnostic push 226 #pragma clang diagnostic push
227 #pragma clang diagnostic ignored "-Wglobal-constructors" 227 #pragma clang diagnostic ignored "-Wglobal-constructors"
228 #endif 228 #endif
229 static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = { 229 static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = {
230 {# [Unforgeable] attributes in Window are defined as shadow_attributes, so
231 excluded here. #}
232 {% for attribute in attributes 230 {% for attribute in attributes
233 if not (attribute.exposed_test or 231 if not (attribute.is_expose_js_accessors or
234 attribute.runtime_enabled_function) and 232 attribute.is_static or
235 attribute.is_data_type_property and 233 attribute.runtime_enabled_function or
236 attribute.should_be_exposed_to_script and 234 attribute.exposed_test or
237 not (interface_name == 'Window' and attribute.is_unforgeable) %} 235 (interface_name == 'Window' and attribute.is_unforgeable))
236 and attribute.should_be_exposed_to_script %}
238 {% filter conditional(attribute.conditional_string) %} 237 {% filter conditional(attribute.conditional_string) %}
239 {{attribute_configuration(attribute)}}, 238 {{attribute_configuration(attribute)}},
240 {% endfilter %} 239 {% endfilter %}
241 {% endfor %} 240 {% endfor %}
242 }; 241 };
243 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 242 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
244 #pragma clang diagnostic pop 243 #pragma clang diagnostic pop
245 #endif 244 #endif
246 245
247 {% endif %} 246 {% endif %}
248 {% endblock %} 247 {% endblock %}
249 {##############################################################################} 248 {##############################################################################}
250 {% block install_accessors %} 249 {% block install_accessors %}
251 {% from 'attributes.cpp' import attribute_configuration with context %} 250 {% from 'attributes.cpp' import attribute_configuration with context %}
252 {% if has_accessor_configuration %} 251 {% if has_accessor_configuration %}
253 static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = { 252 static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = {
254 {# [Unforgeable] attributes in Window are defined as shadow_attributes, so
255 excluded here. #}
256 {% for attribute in attributes 253 {% for attribute in attributes
257 if not (attribute.exposed_test or 254 if (attribute.is_expose_js_accessors and
258 attribute.runtime_enabled_function) and 255 not (attribute.is_static or
259 not attribute.is_data_type_property and 256 attribute.runtime_enabled_function or
260 attribute.should_be_exposed_to_script and 257 attribute.exposed_test) and
261 not (interface_name == 'Window' and attribute.is_unforgeable) %} 258 attribute.should_be_exposed_to_script) %}
262 {% filter conditional(attribute.conditional_string) %} 259 {% filter conditional(attribute.conditional_string) %}
263 {{attribute_configuration(attribute)}}, 260 {{attribute_configuration(attribute)}},
264 {% endfilter %} 261 {% endfilter %}
265 {% endfor %} 262 {% endfor %}
266 }; 263 };
267 264
268 {% endif %} 265 {% endif %}
269 {% endblock %} 266 {% endblock %}
270 {##############################################################################} 267 {##############################################################################}
271 {% block install_methods %} 268 {% block install_methods %}
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 ALLOW_UNUSED_LOCAL(prototypeTemplate); 346 ALLOW_UNUSED_LOCAL(prototypeTemplate);
350 {% if has_access_check_callbacks %} 347 {% if has_access_check_callbacks %}
351 instanceTemplate->SetAccessCheckCallbacks({{cpp_class}}V8Internal::namedSecu rityCheck, {{cpp_class}}V8Internal::indexedSecurityCheck, v8::External::New(isol ate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo))); 348 instanceTemplate->SetAccessCheckCallbacks({{cpp_class}}V8Internal::namedSecu rityCheck, {{cpp_class}}V8Internal::indexedSecurityCheck, v8::External::New(isol ate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo)));
352 {% endif %} 349 {% endif %}
353 {% for attribute in attributes 350 {% for attribute in attributes
354 if attribute.runtime_enabled_function and 351 if attribute.runtime_enabled_function and
355 not attribute.exposed_test and 352 not attribute.exposed_test and
356 not attribute.is_static %} 353 not attribute.is_static %}
357 {% filter conditional(attribute.conditional_string) %} 354 {% filter conditional(attribute.conditional_string) %}
358 if ({{attribute.runtime_enabled_function}}()) { 355 if ({{attribute.runtime_enabled_function}}()) {
359 {% if attribute.is_data_type_property %} 356 {% if attribute.is_expose_js_accessors %}
360 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration = \ 357 static const V8DOMConfiguration::AccessorConfiguration accessorConfigura tion =\
358 {{attribute_configuration(attribute)}};
359 V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototype Template, functionTemplate, defaultSignature, accessorConfiguration);
360 {% else %}
361 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
361 {{attribute_configuration(attribute)}}; 362 {{attribute_configuration(attribute)}};
362 V8DOMConfiguration::installAttribute(isolate, instanceTemplate, prototyp eTemplate, attributeConfiguration); 363 V8DOMConfiguration::installAttribute(isolate, instanceTemplate, prototyp eTemplate, attributeConfiguration);
363 {% else %}
364 static const V8DOMConfiguration::AccessorConfiguration accessorConfigura tion = \
365 {{attribute_configuration(attribute)}};
366 V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototype Template, functionTemplate, defaultSignature, accessorConfiguration);
367 {% endif %} 364 {% endif %}
368 } 365 }
369 {% endfilter %} 366 {% endfilter %}
370 {% endfor %} 367 {% endfor %}
371 {% if constants %} 368 {% if constants %}
372 {{install_constants() | indent}} 369 {{install_constants() | indent}}
373 {% endif %} 370 {% endif %}
374 {# Special operations #} 371 {# Special operations #}
375 {# V8 has access-check callback API and it\'s used on Window instead of 372 {# V8 has access-check callback API and it\'s used on Window instead of
376 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks. 373 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 method.runtime_enabled_function) %} 457 method.runtime_enabled_function) %}
461 {% if method.is_do_not_check_security %} 458 {% if method.is_do_not_check_security %}
462 {{install_do_not_check_security_signature(method) | indent}} 459 {{install_do_not_check_security_signature(method) | indent}}
463 {% else %}{# is_do_not_check_security #} 460 {% else %}{# is_do_not_check_security #}
464 {{install_custom_signature(method) | indent}} 461 {{install_custom_signature(method) | indent}}
465 {% endif %}{# is_do_not_check_security #} 462 {% endif %}{# is_do_not_check_security #}
466 {% endfilter %}{# runtime_enabled() #} 463 {% endfilter %}{# runtime_enabled() #}
467 {% endfilter %}{# exposed() #} 464 {% endfilter %}{# exposed() #}
468 {% endfilter %}{# conditional() #} 465 {% endfilter %}{# conditional() #}
469 {% endfor %} 466 {% endfor %}
467 {% for attribute in attributes if attribute.is_static %}
468 {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' %
469 (cpp_class, attribute.name) %}
470 {% set setter_callback = '%sV8Internal::%sAttributeSetterCallback' %
471 (cpp_class, attribute.name)
472 if attribute.has_setter else '0' %}
473 {% filter conditional(attribute.conditional_string) %}
474 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "{{attribute .name}}"), {{getter_callback}}, {{setter_callback}}, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Local<v8::AccessorSignatur e>(), static_cast<v8::AccessControl>(v8::DEFAULT));
475 {% endfilter %}
476 {% endfor %}
470 {# Special interfaces #} 477 {# Special interfaces #}
471 {% if not is_partial %} 478 {% if not is_partial %}
472 {% if interface_name == 'Window' %} 479 {% if interface_name == 'Window' %}
473 480
474 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount); 481 prototypeTemplate->SetInternalFieldCount(V8Window::internalFieldCount);
475 functionTemplate->SetHiddenPrototype(true); 482 functionTemplate->SetHiddenPrototype(true);
476 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount); 483 instanceTemplate->SetInternalFieldCount(V8Window::internalFieldCount);
477 {% elif interface_name in [ 484 {% elif interface_name in [
478 'HTMLDocument', 'DedicatedWorkerGlobalScope', 'CompositorWorkerGlobal Scope', 485 'HTMLDocument', 'DedicatedWorkerGlobalScope', 'CompositorWorkerGlobal Scope',
479 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %} 486 'SharedWorkerGlobalScope', 'ServiceWorkerGlobalScope'] %}
(...skipping 24 matching lines...) Expand all
504 {% endfor %} 511 {% endfor %}
505 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 512 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
506 {{attribute_getter_implemented_in_private_script(attribute)}} 513 {{attribute_getter_implemented_in_private_script(attribute)}}
507 {% if attribute.has_setter %} 514 {% if attribute.has_setter %}
508 {{attribute_setter_implemented_in_private_script(attribute)}} 515 {{attribute_setter_implemented_in_private_script(attribute)}}
509 {% endif %} 516 {% endif %}
510 {% endfor %} 517 {% endfor %}
511 {% block partial_interface %}{% endblock %} 518 {% block partial_interface %}{% endblock %}
512 } // namespace blink 519 } // namespace blink
513 {% endfilter %} 520 {% endfilter %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/interface.h ('k') | Source/bindings/tests/results/core/V8SVGTestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698