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

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

Issue 1085453003: IDL: Add support for [Unscopeable] on attributes and methods (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixes Created 5 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
« no previous file with comments | « Source/bindings/templates/interface.h ('k') | 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 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 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 {% endif %} 467 {% endif %}
468 {% endblock %} 468 {% endblock %}
469 469
470 470
471 {##############################################################################} 471 {##############################################################################}
472 {% block named_constructor %} 472 {% block named_constructor %}
473 {% from 'methods.cpp' import generate_constructor with context %} 473 {% from 'methods.cpp' import generate_constructor with context %}
474 {% if named_constructor %} 474 {% if named_constructor %}
475 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class 475 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class
476 if is_active_dom_object else '0' %} 476 if is_active_dom_object else '0' %}
477 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_dom_object}}, 0, {{v8_class}} ::installConditionallyEnabledMethods, {{v8_class}}::installConditionallyEnabledP roperties, "{{interface_name}}", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{event_target_inherita nce}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} }; 477 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_dom_object}}, 0, {{v8_class}} ::preparePrototypeObject, {{v8_class}}::installConditionallyEnabledProperties, " {{interface_name}}", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperType Info::{{wrapper_class_id}}, WrapperTypeInfo::{{event_target_inheritance}}, Wrapp erTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} };
478 478
479 {{generate_constructor(named_constructor)}} 479 {{generate_constructor(named_constructor)}}
480 v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate * isolate) 480 v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate * isolate)
481 { 481 {
482 static int domTemplateKey; // This address is used for a key to look up the dom template. 482 static int domTemplateKey; // This address is used for a key to look up the dom template.
483 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 483 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
484 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl ateKey); 484 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl ateKey);
485 if (!result.IsEmpty()) 485 if (!result.IsEmpty())
486 return result; 486 return result;
487 487
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 {% endfilter %} 919 {% endfilter %}
920 {% endfilter %} 920 {% endfilter %}
921 {% endfor %} 921 {% endfor %}
922 } 922 }
923 923
924 {% endif %} 924 {% endif %}
925 {% endblock %} 925 {% endblock %}
926 926
927 927
928 {##############################################################################} 928 {##############################################################################}
929 {% block prepare_prototype_object %}
930 {% from 'methods.cpp' import install_conditionally_enabled_methods with context %}
931 {% if unscopeables or conditionally_enabled_methods %}
932 void {{v8_class}}::preparePrototypeObject(v8::Isolate* isolate, v8::Local<v8::Ob ject> prototypeObject)
933 {
934 {% if unscopeables %}
935 {{install_unscopeables() | indent}}
936 {% endif %}
937 {% if conditionally_enabled_methods %}
938 {{install_conditionally_enabled_methods() | indent}}
939 {% endif %}
940 }
941
942 {% endif %}
943 {% endblock %}
944
945
946 {##############################################################################}
947 {% macro install_unscopeables() %}
948 v8::Local<v8::Context> v8Context(prototypeObject->CreationContext());
949 v8::Local<v8::Name> unscopablesSymbol(v8::Symbol::GetUnscopables(isolate));
950 v8::Local<v8::Object> unscopeables;
951 if (v8CallBoolean(prototypeObject->HasOwnProperty(v8Context, unscopablesSymbol)) )
952 unscopeables = prototypeObject->Get(v8Context, unscopablesSymbol).ToLocalChe cked().As<v8::Object>();
953 else
954 unscopeables = v8::Object::New(isolate);
955 {% for name in unscopeables %}
956 unscopeables->ForceSet(v8Context, v8AtomicString(isolate, "{{name}}"), v8::True( isolate)).FromJust();
957 {% endfor %}
958 prototypeObject->ForceSet(v8Context, unscopablesSymbol, unscopeables).FromJust() ;
959 {% endmacro %}
960
961
962 {##############################################################################}
929 {% block to_active_dom_object %} 963 {% block to_active_dom_object %}
930 {% if is_active_dom_object %} 964 {% if is_active_dom_object %}
931 ActiveDOMObject* {{v8_class}}::toActiveDOMObject(v8::Local<v8::Object> wrapper) 965 ActiveDOMObject* {{v8_class}}::toActiveDOMObject(v8::Local<v8::Object> wrapper)
932 { 966 {
933 return toImpl(wrapper); 967 return toImpl(wrapper);
934 } 968 }
935 969
936 {% endif %} 970 {% endif %}
937 {% endblock %} 971 {% endblock %}
938 972
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 {% endif %} 1027 {% endif %}
994 } 1028 }
995 1029
996 {% endblock %} 1030 {% endblock %}
997 1031
998 {##############################################################################} 1032 {##############################################################################}
999 {% block partial_interface %} 1033 {% block partial_interface %}
1000 {% if has_partial_interface %} 1034 {% if has_partial_interface %}
1001 InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = (Ins tallTemplateFunction)&{{v8_class}}::install{{v8_class}}Template; 1035 InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = (Ins tallTemplateFunction)&{{v8_class}}::install{{v8_class}}Template;
1002 1036
1003 void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplate Function, InstallConditionallyEnabledMethodsFunction installConditionallyEnabled MethodsFunction) 1037 void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplate Function, PreparePrototypeObjectFunction preparePrototypeObjectFunction)
1004 { 1038 {
1005 {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction; 1039 {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction;
1006 if (installConditionallyEnabledMethodsFunction) 1040 if (preparePrototypeObjectFunction)
1007 {{v8_class}}::wrapperTypeInfo.installConditionallyEnabledMethodsFunction = installConditionallyEnabledMethodsFunction; 1041 {{v8_class}}::wrapperTypeInfo.preparePrototypeObjectFunction = preparePr ototypeObjectFunction;
1008 } 1042 }
1009 1043
1010 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %} 1044 {% for method in methods if method.overloads and method.overloads.has_partial_ov erloads %}
1011 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&)) 1045 void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInt erface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&))
1012 { 1046 {
1013 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method; 1047 {{cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
1014 } 1048 }
1015 {% endfor %} 1049 {% endfor %}
1016 {% endif %} 1050 {% endif %}
1017 {% endblock %} 1051 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/interface.h ('k') | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698