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

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

Issue 1685543002: Supports "class string" based on @@toStringTag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated test expectations. Created 4 years, 9 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
OLDNEW
1 {% include 'copyright_block.txt' %} 1 {% include 'copyright_block.txt' %}
2 #include "{{v8_class_or_partial}}.h" 2 #include "{{v8_class_or_partial}}.h"
3 3
4 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %} 4 {% for filename in cpp_includes if filename != '%s.h' % cpp_class_or_partial %}
5 #include "{{filename}}" 5 #include "{{filename}}"
6 {% endfor %} 6 {% endfor %}
7 7
8 namespace blink { 8 namespace blink {
9 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class 9 {% set visit_dom_wrapper = '%s::visitDOMWrapper' % v8_class
10 if has_visit_dom_wrapper else '0' %} 10 if has_visit_dom_wrapper else '0' %}
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 {% endif %} 280 {% endif %}
281 281
282 v8::Local<v8::Signature> defaultSignature; 282 v8::Local<v8::Signature> defaultSignature;
283 {% set parent_template = 283 {% set parent_template =
284 '%s::domTemplateForNamedPropertiesObject(isolate)' % v8_class 284 '%s::domTemplateForNamedPropertiesObject(isolate)' % v8_class
285 if has_named_properties_object else 285 if has_named_properties_object else
286 'V8%s::domTemplate(isolate)' % parent_interface 286 'V8%s::domTemplate(isolate)' % parent_interface
287 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} 287 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %}
288 {% if runtime_enabled_function %} 288 {% if runtime_enabled_function %}
289 if (!{{runtime_enabled_function}}()) 289 if (!{{runtime_enabled_function}}())
290 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::inter nalFieldCount, 0, 0, 0, 0, 0, 0); 290 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, functionTemplate, {{v8_class}}::wrapperTypeInfo.interfaceName, {{parent_template }}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0, 0, 0);
291 else 291 else
292 {% endif %} 292 {% endif %}
293 {% set runtime_enabled_indent = 4 if runtime_enabled_function else 0 %} 293 {% set runtime_enabled_indent = 4 if runtime_enabled_function else 0 %}
294 {% filter indent(runtime_enabled_indent, true) %} 294 {% filter indent(runtime_enabled_indent, true) %}
295 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, func tionTemplate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalF ieldCount, 295 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(isolate, func tionTemplate, {{v8_class}}::wrapperTypeInfo.interfaceName, {{parent_template}}, {{v8_class}}::internalFieldCount,
296 {# Test needed as size 0 arrays definitions are not allowed per standard 296 {# Test needed as size 0 arrays definitions are not allowed per standard
297 (so objects have distinct addresses), which is enforced by MSVC. 297 (so objects have distinct addresses), which is enforced by MSVC.
298 8.5.1 Aggregates [dcl.init.aggr] 298 8.5.1 Aggregates [dcl.init.aggr]
299 An array of unknown size initialized with a brace-enclosed 299 An array of unknown size initialized with a brace-enclosed
300 initializer-list containing n initializer-clauses, where n shall be 300 initializer-list containing n initializer-clauses, where n shall be
301 greater than zero, is defined as having n elements (8.3.4). #} 301 greater than zero, is defined as having n elements (8.3.4). #}
302 {% set attributes_name, attributes_length = 302 {% set attributes_name, attributes_length =
303 ('%sAttributes' % v8_class, 303 ('%sAttributes' % v8_class,
304 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class) 304 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class)
305 if has_attribute_configuration else (0, 0) %} 305 if has_attribute_configuration else (0, 0) %}
(...skipping 11 matching lines...) Expand all
317 {% endfilter %} 317 {% endfilter %}
318 318
319 {% if constructors or has_custom_constructor or has_event_constructor %} 319 {% if constructors or has_custom_constructor or has_event_constructor %}
320 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback); 320 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback);
321 functionTemplate->SetLength({{interface_length}}); 321 functionTemplate->SetLength({{interface_length}});
322 {% endif %} 322 {% endif %}
323 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate(); 323 v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceT emplate();
324 ALLOW_UNUSED_LOCAL(instanceTemplate); 324 ALLOW_UNUSED_LOCAL(instanceTemplate);
325 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate(); 325 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->Prototyp eTemplate();
326 ALLOW_UNUSED_LOCAL(prototypeTemplate); 326 ALLOW_UNUSED_LOCAL(prototypeTemplate);
327 {% if not is_partial %}
328 {# TODO(yukishiino): We should set the class string to the platform object
329 (|instanceTemplate|), too. The reason that we don\'t set it is that
330 it prevents minor GC to collect unreachable DOM objects (a layout test
331 fast/dom/minor-dom-gc.html fails if we set the class string).
332 See also http://heycam.github.io/webidl/#es-platform-objects #}
333 V8DOMConfiguration::setClassString(isolate, prototypeTemplate, {{v8_class}}: :wrapperTypeInfo.interfaceName);
334 {% endif %}
327 {% if custom_registration_methods %} 335 {% if custom_registration_methods %}
328 ExecutionContext* context = currentExecutionContext(isolate); 336 ExecutionContext* context = currentExecutionContext(isolate);
329 ALLOW_UNUSED_LOCAL(context); 337 ALLOW_UNUSED_LOCAL(context);
330 {% endif %} 338 {% endif %}
331 {% if has_access_check_callbacks %} 339 {% if has_access_check_callbacks %}
332 instanceTemplate->SetAccessCheckCallback({{cpp_class}}V8Internal::securityCh eck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrap perTypeInfo))); 340 instanceTemplate->SetAccessCheckCallback({{cpp_class}}V8Internal::securityCh eck, v8::External::New(isolate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrap perTypeInfo)));
333 {% endif %} 341 {% endif %}
334 {% if has_array_iterator %} 342 {% if has_array_iterator %}
335 {% filter runtime_enabled('RuntimeEnabledFeatures::iterableCollectionsEnable d') %} 343 {% filter runtime_enabled('RuntimeEnabledFeatures::iterableCollectionsEnable d') %}
336 {% if is_global %} 344 {% if is_global %}
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 {{method_implemented_in_private_script(method)}} 448 {{method_implemented_in_private_script(method)}}
441 {% endfor %} 449 {% endfor %}
442 {% for attribute in attributes if attribute.is_implemented_in_private_script %} 450 {% for attribute in attributes if attribute.is_implemented_in_private_script %}
443 {{attribute_getter_implemented_in_private_script(attribute)}} 451 {{attribute_getter_implemented_in_private_script(attribute)}}
444 {% if attribute.has_setter %} 452 {% if attribute.has_setter %}
445 {{attribute_setter_implemented_in_private_script(attribute)}} 453 {{attribute_setter_implemented_in_private_script(attribute)}}
446 {% endif %} 454 {% endif %}
447 {% endfor %} 455 {% endfor %}
448 {% block partial_interface %}{% endblock %} 456 {% block partial_interface %}{% endblock %}
449 } // namespace blink 457 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698