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

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

Issue 2578943002: [Bindings] Refactoring of binding code around runtime enabled features (Closed)
Patch Set: Work for a comment Created 4 years 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 899 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 910
911 911
912 {##############################################################################} 912 {##############################################################################}
913 {% macro install_unscopables() %} 913 {% macro install_unscopables() %}
914 v8::Local<v8::Name> unscopablesSymbol(v8::Symbol::GetUnscopables(isolate)); 914 v8::Local<v8::Name> unscopablesSymbol(v8::Symbol::GetUnscopables(isolate));
915 v8::Local<v8::Object> unscopables; 915 v8::Local<v8::Object> unscopables;
916 if (v8CallBoolean(prototypeObject->HasOwnProperty(context, unscopablesSymbol))) 916 if (v8CallBoolean(prototypeObject->HasOwnProperty(context, unscopablesSymbol)))
917 unscopables = prototypeObject->Get(context, unscopablesSymbol).ToLocalChecked( ).As<v8::Object>(); 917 unscopables = prototypeObject->Get(context, unscopablesSymbol).ToLocalChecked( ).As<v8::Object>();
918 else 918 else
919 unscopables = v8::Object::New(isolate); 919 unscopables = v8::Object::New(isolate);
920 {% for name, runtime_enabled_function in unscopables %} 920 {% for name, runtime_enabled_feature_name in unscopables %}
921 {% filter runtime_enabled(runtime_enabled_function) %} 921 {% filter runtime_enabled(runtime_enabled_feature_name) %}
922 unscopables->CreateDataProperty(context, v8AtomicString(isolate, "{{name}}"), v8 ::True(isolate)).FromJust(); 922 unscopables->CreateDataProperty(context, v8AtomicString(isolate, "{{name}}"), v8 ::True(isolate)).FromJust();
923 {% endfilter %} 923 {% endfilter %}
924 {% endfor %} 924 {% endfor %}
925 prototypeObject->CreateDataProperty(context, unscopablesSymbol, unscopables).Fro mJust(); 925 prototypeObject->CreateDataProperty(context, unscopablesSymbol, unscopables).Fro mJust();
926 {% endmacro %} 926 {% endmacro %}
927 927
928 928
929 {##############################################################################} 929 {##############################################################################}
930 {% macro install_conditionally_enabled_attributes_on_prototype() %} 930 {% macro install_conditionally_enabled_attributes_on_prototype() %}
931 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %} 931 {% from 'attributes.cpp.tmpl' import attribute_configuration with context %}
932 ExecutionContext* executionContext = toExecutionContext(context); 932 ExecutionContext* executionContext = toExecutionContext(context);
933 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTempla te); 933 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTempla te);
934 {% for attribute in attributes if (attribute.exposed_test or attribute.secure_co ntext_test) and attribute.on_prototype %} 934 {% for attribute in attributes if (attribute.exposed_test or attribute.secure_co ntext_test) and attribute.on_prototype %}
935 {% filter exposed(attribute.exposed_test) %} 935 {% filter exposed(attribute.exposed_test) %}
936 {% filter secure_context(attribute.secure_context_test) %} 936 {% filter secure_context(attribute.secure_context_test) %}
937 {% filter runtime_enabled(attribute.runtime_enabled_function) %} 937 {% filter runtime_enabled(attribute.runtime_enabled_feature_name) %}
938 const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {{attrib ute_configuration(attribute)}}; 938 const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {{attrib ute_configuration(attribute)}};
939 V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), pro totypeObject, interfaceObject, signature, accessorConfiguration); 939 V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), pro totypeObject, interfaceObject, signature, accessorConfiguration);
940 {% endfilter %}{# runtime_enabled #} 940 {% endfilter %}{# runtime_enabled #}
941 {% endfilter %}{# secure_context #} 941 {% endfilter %}{# secure_context #}
942 {% endfilter %}{# exposed #} 942 {% endfilter %}{# exposed #}
943 {% endfor %} 943 {% endfor %}
944 {% endmacro %} 944 {% endmacro %}
945 945
946 946
947 {##############################################################################} 947 {##############################################################################}
948 {% block partial_interface %} 948 {% block partial_interface %}
949 {% if has_partial_interface %} 949 {% if has_partial_interface %}
950 InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = (Ins tallTemplateFunction)&{{v8_class}}::install{{v8_class}}Template; 950 InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = (Ins tallTemplateFunction)&{{v8_class}}::install{{v8_class}}Template;
951 951
952 void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplate Function, PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInterfac eObjectFunction) { 952 void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplate Function, PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInterfac eObjectFunction) {
953 {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction; 953 {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction;
954 if (preparePrototypeAndInterfaceObjectFunction) 954 if (preparePrototypeAndInterfaceObjectFunction)
955 {{v8_class}}::wrapperTypeInfo.preparePrototypeAndInterfaceObjectFunction = p reparePrototypeAndInterfaceObjectFunction; 955 {{v8_class}}::wrapperTypeInfo.preparePrototypeAndInterfaceObjectFunction = p reparePrototypeAndInterfaceObjectFunction;
956 } 956 }
957 957
958 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 958 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
959 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) { 959 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) {
960 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 960 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
961 } 961 }
962 962
963 {% endfor %} 963 {% endfor %}
964 {% endif %} 964 {% endif %}
965 {% endblock %} 965 {% endblock %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698