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

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

Issue 1202683002: bindings: Supports per-member [Exposed] for attributes on prototype. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed a review comment. Created 5 years, 6 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
« no previous file with comments | « Source/bindings/templates/interface.h ('k') | Source/bindings/templates/partial_interface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 { 790 {
791 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu e)) : 0; 791 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu e)) : 0;
792 } 792 }
793 793
794 {% endblock %} 794 {% endblock %}
795 795
796 796
797 {##############################################################################} 797 {##############################################################################}
798 {% block install_conditional_attributes %} 798 {% block install_conditional_attributes %}
799 {% from 'attributes.cpp' import attribute_configuration with context %} 799 {% from 'attributes.cpp' import attribute_configuration with context %}
800 {% if has_conditional_attributes %} 800 {% if has_conditional_attributes_on_instance %}
801 void {{v8_class}}::installConditionallyEnabledProperties(v8::Local<v8::Object> i nstanceObject, v8::Isolate* isolate) 801 void {{v8_class}}::installConditionallyEnabledProperties(v8::Local<v8::Object> i nstanceObject, v8::Isolate* isolate)
802 { 802 {
803 v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instance Object->GetPrototype()); 803 #error TODO(yukishiino): Rename this function to prepareInstanceObject (c.f. pre parePrototypeObject) and implement this function if necessary. http://crbug.com /503508
804 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext());
805
806 {% for attribute in attributes if attribute.exposed_test %}
807 {% filter exposed(attribute.exposed_test) %}
808 #error No one is actually using per-member [Exposed] extended attribute. Not su pported. Contact to blink-reviews-bindings@ if you need.
809 // TODO(yukishiino): Implement the feature again if there is a client.
810 {% endfilter %}
811 {% endfor %}
812 {% for method in methods if method.exposed_test %}
813 {% filter exposed(method.exposed_test) %}
814 #error No one is actually using per-member [Exposed] extended attribute. Not su pported. Contact to blink-reviews-bindings@ if you need.
815 // TODO(yukishiino): Implement the feature again if there is a client.
816 {% endfilter %}
817 {% endfor %}
818 } 804 }
819 805
820 {% endif %} 806 {% endif %}
821 {% endblock %} 807 {% endblock %}
822 808
823 809
824 {##############################################################################} 810 {##############################################################################}
825 {% block prepare_prototype_object %} 811 {% block prepare_prototype_object %}
826 {% from 'methods.cpp' import install_conditionally_enabled_methods with context %} 812 {% from 'methods.cpp' import install_conditionally_enabled_methods with context %}
827 {% if unscopeables or conditionally_enabled_methods %} 813 {% if unscopeables or has_conditional_attributes_on_prototype or conditionally_e nabled_methods %}
828 void {{v8_class}}::preparePrototypeObject(v8::Isolate* isolate, v8::Local<v8::Ob ject> prototypeObject) 814 void {{v8_class}}::preparePrototypeObject(v8::Isolate* isolate, v8::Local<v8::Ob ject> prototypeObject, v8::Local<v8::FunctionTemplate> interfaceTemplate)
829 { 815 {
830 {% if unscopeables %} 816 {% if unscopeables %}
831 {{install_unscopeables() | indent}} 817 {{install_unscopeables() | indent}}
832 {% endif %} 818 {% endif %}
819 {% if has_conditional_attributes_on_prototype %}
820 {{install_conditionally_enabled_attributes_on_prototype() | indent}}
821 {% endif %}
833 {% if conditionally_enabled_methods %} 822 {% if conditionally_enabled_methods %}
834 {{install_conditionally_enabled_methods() | indent}} 823 {{install_conditionally_enabled_methods() | indent}}
835 {% endif %} 824 {% endif %}
836 } 825 }
837 826
838 {% endif %} 827 {% endif %}
839 {% endblock %} 828 {% endblock %}
840 829
841 830
842 {##############################################################################} 831 {##############################################################################}
843 {% macro install_unscopeables() %} 832 {% macro install_unscopeables() %}
844 v8::Local<v8::Context> v8Context(prototypeObject->CreationContext()); 833 v8::Local<v8::Context> v8Context(prototypeObject->CreationContext());
845 v8::Local<v8::Name> unscopablesSymbol(v8::Symbol::GetUnscopables(isolate)); 834 v8::Local<v8::Name> unscopablesSymbol(v8::Symbol::GetUnscopables(isolate));
846 v8::Local<v8::Object> unscopeables; 835 v8::Local<v8::Object> unscopeables;
847 if (v8CallBoolean(prototypeObject->HasOwnProperty(v8Context, unscopablesSymbol)) ) 836 if (v8CallBoolean(prototypeObject->HasOwnProperty(v8Context, unscopablesSymbol)) )
848 unscopeables = prototypeObject->Get(v8Context, unscopablesSymbol).ToLocalChe cked().As<v8::Object>(); 837 unscopeables = prototypeObject->Get(v8Context, unscopablesSymbol).ToLocalChe cked().As<v8::Object>();
849 else 838 else
850 unscopeables = v8::Object::New(isolate); 839 unscopeables = v8::Object::New(isolate);
851 {% for name, runtime_enabled_function in unscopeables %} 840 {% for name, runtime_enabled_function in unscopeables %}
852 {% filter runtime_enabled(runtime_enabled_function) %} 841 {% filter runtime_enabled(runtime_enabled_function) %}
853 unscopeables->CreateDataProperty(v8Context, v8AtomicString(isolate, "{{name}}"), v8::True(isolate)).FromJust(); 842 unscopeables->CreateDataProperty(v8Context, v8AtomicString(isolate, "{{name}}"), v8::True(isolate)).FromJust();
854 {% endfilter %} 843 {% endfilter %}
855 {% endfor %} 844 {% endfor %}
856 prototypeObject->CreateDataProperty(v8Context, unscopablesSymbol, unscopeables). FromJust(); 845 prototypeObject->CreateDataProperty(v8Context, unscopablesSymbol, unscopeables). FromJust();
857 {% endmacro %} 846 {% endmacro %}
858 847
859 848
860 {##############################################################################} 849 {##############################################################################}
850 {% macro install_conditionally_enabled_attributes_on_prototype() %}
851 {% from 'attributes.cpp' import attribute_configuration with context %}
852 ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext( ));
853 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTempla te);
854 {% for attribute in attributes if attribute.exposed_test and attribute.on_protot ype %}
855 {% filter exposed(attribute.exposed_test) %}
856 static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = { {attribute_configuration(attribute)}};
857 V8DOMConfiguration::installAccessor(isolate, v8::Local<v8::Object>(), prototypeO bject, v8::Local<v8::Function>(), signature, accessorConfiguration);
858 {% endfilter %}
859 {% endfor %}
860 {% endmacro %}
861
862
863 {##############################################################################}
861 {% block to_active_dom_object %} 864 {% block to_active_dom_object %}
862 {% if is_active_dom_object %} 865 {% if is_active_dom_object %}
863 ActiveDOMObject* {{v8_class}}::toActiveDOMObject(v8::Local<v8::Object> wrapper) 866 ActiveDOMObject* {{v8_class}}::toActiveDOMObject(v8::Local<v8::Object> wrapper)
864 { 867 {
865 return toImpl(wrapper); 868 return toImpl(wrapper);
866 } 869 }
867 870
868 {% endif %} 871 {% endif %}
869 {% endblock %} 872 {% endblock %}
870 873
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 } 943 }
941 944
942 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 945 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
943 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) 946 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&))
944 { 947 {
945 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 948 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
946 } 949 }
947 {% endfor %} 950 {% endfor %}
948 {% endif %} 951 {% endif %}
949 {% endblock %} 952 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/interface.h ('k') | Source/bindings/templates/partial_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698