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

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

Issue 2671553003: Remove uses of VisitDOMWrapper (Closed)
Patch Set: Add DependentLifetime when removing Custom=VisitDOMWrapper Created 3 years, 10 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 {% extends 'interface_base.cpp.tmpl' %} 1 {% extends 'interface_base.cpp.tmpl' %}
2 2
3 {% set has_prepare_prototype_and_interface_object = 3 {% set has_prepare_prototype_and_interface_object =
4 unscopables or has_conditional_attributes_on_prototype or 4 unscopables or has_conditional_attributes_on_prototype or
5 methods | conditionally_exposed(is_partial) %} 5 methods | conditionally_exposed(is_partial) %}
6 {% set prepare_prototype_and_interface_object_func = 6 {% set prepare_prototype_and_interface_object_func =
7 '%s::preparePrototypeAndInterfaceObject' % v8_class 7 '%s::preparePrototypeAndInterfaceObject' % v8_class
8 if has_prepare_prototype_and_interface_object 8 if has_prepare_prototype_and_interface_object
9 else 'nullptr' %} 9 else 'nullptr' %}
10 10
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 {% set active_scriptwrappable_inheritance = 528 {% set active_scriptwrappable_inheritance =
529 'InheritFromActiveScriptWrappable' 529 'InheritFromActiveScriptWrappable'
530 if active_scriptwrappable else 530 if active_scriptwrappable else
531 'NotInheritFromActiveScriptWrappable' %} 531 'NotInheritFromActiveScriptWrappable' %}
532 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial 532 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial
533 // and does not depend on another global objects. 533 // and does not depend on another global objects.
534 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 534 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
535 #pragma clang diagnostic push 535 #pragma clang diagnostic push
536 #pragma clang diagnostic ignored "-Wglobal-constructors" 536 #pragma clang diagnostic ignored "-Wglobal-constructors"
537 #endif 537 #endif
538 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::trace, {{v8_class}}: :traceWrappers, 0, {{prepare_prototype_and_interface_object_func}}, "{{interface _name}}", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::{{wra pper_class_id}}, WrapperTypeInfo::{{active_scriptwrappable_inheritance}}, Wrappe rTypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}} }; 538 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::trace, {{v8_class}}: :traceWrappers, {{prepare_prototype_and_interface_object_func}}, "{{interface_na me}}", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::{{wrappe r_class_id}}, WrapperTypeInfo::{{active_scriptwrappable_inheritance}}, WrapperTy peInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}} };
539 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 539 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
540 #pragma clang diagnostic pop 540 #pragma clang diagnostic pop
541 #endif 541 #endif
542 542
543 {{generate_constructor(named_constructor)}} 543 {{generate_constructor(named_constructor)}}
544 v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate * isolate, const DOMWrapperWorld& world) { 544 v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate * isolate, const DOMWrapperWorld& world) {
545 static int domTemplateKey; // This address is used for a key to look up the do m template. 545 static int domTemplateKey; // This address is used for a key to look up the do m template.
546 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 546 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
547 v8::Local<v8::FunctionTemplate> result = data->findInterfaceTemplate(world, &d omTemplateKey); 547 v8::Local<v8::FunctionTemplate> result = data->findInterfaceTemplate(world, &d omTemplateKey);
548 if (!result.IsEmpty()) 548 if (!result.IsEmpty())
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 } 595 }
596 {# No match, throw error #} 596 {# No match, throw error #}
597 exceptionState.throwTypeError("No matching constructor signature."); 597 exceptionState.throwTypeError("No matching constructor signature.");
598 } 598 }
599 599
600 {% endif %} 600 {% endif %}
601 {% endblock %} 601 {% endblock %}
602 602
603 603
604 {##############################################################################} 604 {##############################################################################}
605 {% block visit_dom_wrapper %}
606 {% if has_visit_dom_wrapper %}
607 void {{v8_class}}::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* script Wrappable, const v8::Persistent<v8::Object>& wrapper) {
608 {% if has_visit_dom_wrapper_custom %}
609 {{v8_class}}::visitDOMWrapperCustom(isolate, scriptWrappable, wrapper);
610 {% endif %}
611 {% if set_wrapper_reference_to or set_wrapper_reference_from %}
612 {{cpp_class}}* impl = scriptWrappable->toImpl<{{cpp_class}}>();
613 {% endif %}
614 {% if set_wrapper_reference_to %}
615 {{set_wrapper_reference_to.cpp_type}} {{set_wrapper_reference_to.name}} = impl ->{{set_wrapper_reference_to.name}}();
616 if ({{set_wrapper_reference_to.name}}) {
617 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, {{set_wrapper_refe rence_to.name}}, isolate);
618 }
619 {% endif %}
620 {% if set_wrapper_reference_from %}
621 // The {{set_wrapper_reference_from}}() method may return a reference or a poi nter.
622 if (Node* owner = WTF::getPtr(impl->{{set_wrapper_reference_from}}())) {
623 Node* root = V8GCController::opaqueRootForGC(isolate, owner);
624 isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(root) ), wrapper);
625 return;
626 }
627 {% endif %}
628 }
629
630 {% endif %}
631 {% endblock %}
632
633
634 {##############################################################################}
635 {% block constructor_callback %} 605 {% block constructor_callback %}
636 {% if constructors or has_custom_constructor or has_event_constructor or has_htm l_constructor %} 606 {% if constructors or has_custom_constructor or has_event_constructor or has_htm l_constructor %}
637 void {{v8_class}}::constructorCallback(const v8::FunctionCallbackInfo<v8::Value> & info) { 607 void {{v8_class}}::constructorCallback(const v8::FunctionCallbackInfo<v8::Value> & info) {
638 {% if measure_as %} 608 {% if measure_as %}
639 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{me asure_as('Constructor')}}); 609 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{me asure_as('Constructor')}});
640 {% endif %} 610 {% endif %}
641 if (!info.IsConstructCall()) { 611 if (!info.IsConstructCall()) {
642 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::const ructorNotCallableAsFunction("{{interface_name}}")); 612 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::const ructorNotCallableAsFunction("{{interface_name}}"));
643 return; 613 return;
644 } 614 }
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 } 929 }
960 930
961 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 931 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
962 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) { 932 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) {
963 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 933 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
964 } 934 }
965 935
966 {% endfor %} 936 {% endfor %}
967 {% endif %} 937 {% endif %}
968 {% endblock %} 938 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698