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

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

Issue 1873323002: Have bindings layer assume and insist that all interface types are GCed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 8 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' %} 1 {% extends 'interface_base.cpp' %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% block indexed_property_getter %} 5 {% block indexed_property_getter %}
6 {% if indexed_property_getter and not indexed_property_getter.is_custom %} 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %}
7 {% set getter = indexed_property_getter %} 7 {% set getter = indexed_property_getter %}
8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info) 8 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info)
9 { 9 {
10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 {% from 'methods.cpp' import generate_constructor with context %} 457 {% from 'methods.cpp' import generate_constructor with context %}
458 {% if named_constructor %} 458 {% if named_constructor %}
459 {% set to_active_scriptwrappable = '%s::toActiveScriptWrappable' % v8_class 459 {% set to_active_scriptwrappable = '%s::toActiveScriptWrappable' % v8_class
460 if active_scriptwrappable else '0' %} 460 if active_scriptwrappable else '0' %}
461 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial 461 // Suppress warning: global constructors, because struct WrapperTypeInfo is triv ial
462 // and does not depend on another global objects. 462 // and does not depend on another global objects.
463 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 463 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
464 #pragma clang diagnostic push 464 #pragma clang diagnostic push
465 #pragma clang diagnostic ignored "-Wglobal-constructors" 465 #pragma clang diagnostic ignored "-Wglobal-constructors"
466 #endif 466 #endif
467 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::refObject, {{v8_clas s}}::derefObject, {{v8_class}}::trace, {{to_active_scriptwrappable}}, 0, {{v8_cl ass}}::preparePrototypeAndInterfaceObject, {{v8_class}}::installConditionallyEna bledProperties, "{{interface_name}}", 0, WrapperTypeInfo::WrapperTypeObjectProto type, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{event_target_inh eritance}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} }; 467 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::trace, {{to_active_s criptwrappable}}, 0, {{v8_class}}::preparePrototypeAndInterfaceObject, {{v8_clas s}}::installConditionallyEnabledProperties, "{{interface_name}}", 0, WrapperType Info::WrapperTypeObjectPrototype, WrapperTypeInfo::{{wrapper_class_id}}, Wrapper TypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}} };
468 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) 468 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
469 #pragma clang diagnostic pop 469 #pragma clang diagnostic pop
470 #endif 470 #endif
471 471
472 {{generate_constructor(named_constructor)}} 472 {{generate_constructor(named_constructor)}}
473 v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate * isolate) 473 v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate * isolate)
474 { 474 {
475 static int domTemplateKey; // This address is used for a key to look up the dom template. 475 static int domTemplateKey; // This address is used for a key to look up the dom template.
476 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 476 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
477 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl ateKey); 477 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl ateKey);
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
914 ActiveScriptWrappable* {{v8_class}}::toActiveScriptWrappable(v8::Local<v8::Objec t> wrapper) 914 ActiveScriptWrappable* {{v8_class}}::toActiveScriptWrappable(v8::Local<v8::Objec t> wrapper)
915 { 915 {
916 return toImpl(wrapper); 916 return toImpl(wrapper);
917 } 917 }
918 918
919 {% endif %} 919 {% endif %}
920 {% endblock %} 920 {% endblock %}
921 921
922 922
923 {##############################################################################} 923 {##############################################################################}
924 {% block ref_object_and_deref_object %}
925 void {{v8_class}}::refObject(ScriptWrappable* scriptWrappable)
926 {
927 {% if gc_type == 'RefCountedObject' %}
928 scriptWrappable->toImpl<{{cpp_class}}>()->ref();
929 {% endif %}
930 }
931
932 void {{v8_class}}::derefObject(ScriptWrappable* scriptWrappable)
933 {
934 {% if gc_type == 'RefCountedObject' %}
935 scriptWrappable->toImpl<{{cpp_class}}>()->deref();
936 {% endif %}
937 }
938
939 {% endblock %}
940
941 {##############################################################################}
942 {% block partial_interface %} 924 {% block partial_interface %}
943 {% if has_partial_interface %} 925 {% if has_partial_interface %}
944 InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = (Ins tallTemplateFunction)&{{v8_class}}::install{{v8_class}}Template; 926 InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = (Ins tallTemplateFunction)&{{v8_class}}::install{{v8_class}}Template;
945 927
946 void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplate Function, PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInterfac eObjectFunction) 928 void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplate Function, PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInterfac eObjectFunction)
947 { 929 {
948 {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction; 930 {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction;
949 if (preparePrototypeAndInterfaceObjectFunction) 931 if (preparePrototypeAndInterfaceObjectFunction)
950 {{v8_class}}::wrapperTypeInfo.preparePrototypeAndInterfaceObjectFunction = preparePrototypeAndInterfaceObjectFunction; 932 {{v8_class}}::wrapperTypeInfo.preparePrototypeAndInterfaceObjectFunction = preparePrototypeAndInterfaceObjectFunction;
951 } 933 }
952 934
953 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 935 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
954 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) 936 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&))
955 { 937 {
956 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 938 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
957 } 939 }
958 940
959 {% endfor %} 941 {% endfor %}
960 {% endif %} 942 {% endif %}
961 {% endblock %} 943 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698