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

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

Issue 645833002: Refactor interface.cpp and interface_base.cpp for partial interface modularization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 6 years, 2 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 | « no previous file | Source/bindings/templates/interface_base.cpp » ('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 security_check_functions %}
6 {% if has_access_check_callbacks %}
7 bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::Access Type type, v8::Local<v8::Value>)
8 {
9 {{cpp_class}}* impl = {{v8_class}}::toImpl(host);
10 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError);
11 }
12
13 bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8 ::AccessType type, v8::Local<v8::Value>)
14 {
15 {{cpp_class}}* impl = {{v8_class}}::toImpl(host);
16 return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError);
17 }
18
19 {% endif %}
20 {% endblock %}
21
22
23 {##############################################################################}
24 {% block indexed_property_getter %} 5 {% block indexed_property_getter %}
25 {% if indexed_property_getter and not indexed_property_getter.is_custom %} 6 {% if indexed_property_getter and not indexed_property_getter.is_custom %}
26 {% set getter = indexed_property_getter %} 7 {% set getter = indexed_property_getter %}
27 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)
28 { 9 {
29 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 10 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
30 {% if getter.is_raises_exception %} 11 {% if getter.is_raises_exception %}
31 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "{{inter face_name}}", info.Holder(), info.GetIsolate()); 12 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "{{inter face_name}}", info.Holder(), info.GetIsolate());
32 {% endif %} 13 {% endif %}
33 {% set getter_name = getter.name or 'anonymousIndexedGetter' %} 14 {% set getter_name = getter.name or 'anonymousIndexedGetter' %}
(...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 {% block to_impl_with_type_check %} 754 {% block to_impl_with_type_check %}
774 {{cpp_class}}* {{v8_class}}::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handl e<v8::Value> value) 755 {{cpp_class}}* {{v8_class}}::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handl e<v8::Value> value)
775 { 756 {
776 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle <v8::Object>::Cast(value))->toImpl<{{cpp_class}}>() : 0; 757 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle <v8::Object>::Cast(value))->toImpl<{{cpp_class}}>() : 0;
777 } 758 }
778 759
779 {% endblock %} 760 {% endblock %}
780 761
781 762
782 {##############################################################################} 763 {##############################################################################}
783 {% block install_conditional_attributes %}
784 {% if has_conditional_attributes %}
785 void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate)
786 {
787 v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instance Object->GetPrototype());
788 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext());
789
790 {% for attribute in attributes if attribute.per_context_enabled_function or attribute.exposed_test %}
791 {% filter per_context_enabled(attribute.per_context_enabled_function) %}
792 {% filter exposed(attribute.exposed_test) %}
793 static const V8DOMConfiguration::AttributeConfiguration attributeConfigurati on =\
794 {{attribute_configuration(attribute)}};
795 V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attrib uteConfiguration, isolate);
796 {% endfilter %}
797 {% endfilter %}
798 {% endfor %}
799 }
800
801 {% endif %}
802 {% endblock %}
803
804
805 {##############################################################################}
806 {% block install_conditional_methods %}
807 {% if conditionally_enabled_methods %}
808 void {{v8_class}}::installConditionallyEnabledMethods(v8::Handle<v8::Object> pro totypeObject, v8::Isolate* isolate)
809 {
810 {# Define per-context enabled operations #}
811 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT emplate(isolate));
812 ExecutionContext* context = toExecutionContext(prototypeObject->CreationCont ext());
813 ASSERT(context);
814
815 {% for method in conditionally_enabled_methods %}
816 {% filter per_context_enabled(method.per_context_enabled_function) %}
817 {% filter exposed(method.exposed_test) %}
818 prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Functio nTemplate::New(isolate, {{cpp_class}}V8Internal::{{method.name}}MethodCallback, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})->GetFu nction());
819 {% endfilter %}
820 {% endfilter %}
821 {% endfor %}
822 }
823
824 {% endif %}
825 {% endblock %}
826
827
828 {##############################################################################}
829 {% block to_active_dom_object %} 764 {% block to_active_dom_object %}
830 {% if is_active_dom_object %} 765 {% if is_active_dom_object %}
831 ActiveDOMObject* {{v8_class}}::toActiveDOMObject(v8::Handle<v8::Object> wrapper) 766 ActiveDOMObject* {{v8_class}}::toActiveDOMObject(v8::Handle<v8::Object> wrapper)
832 { 767 {
833 return toImpl(wrapper); 768 return toImpl(wrapper);
834 } 769 }
835 770
836 {% endif %} 771 {% endif %}
837 {% endblock %} 772 {% endblock %}
838 773
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 {% endif %} 895 {% endif %}
961 } 896 }
962 897
963 template<> 898 template<>
964 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 899 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
965 { 900 {
966 return toV8(impl, creationContext, isolate); 901 return toV8(impl, creationContext, isolate);
967 } 902 }
968 903
969 {% endblock %} 904 {% endblock %}
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698