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

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

Issue 176963017: Remove WrapperWorldType from V8 binding (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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/methods.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 {% macro attribute_configuration(attribute) %} 5 {% macro attribute_configuration(attribute) %}
6 {% set getter_callback = 6 {% set getter_callback =
7 '%sV8Internal::%sAttributeGetterCallback' % 7 '%sV8Internal::%sAttributeGetterCallback' %
8 (cpp_class, attribute.name) 8 (cpp_class, attribute.name)
9 if not attribute.constructor_type else 9 if not attribute.constructor_type else
10 ('%sV8Internal::%sConstructorGetterCallback' % 10 ('%sV8Internal::%sConstructorGetterCallback' %
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 {% from 'methods.cpp' import named_constructor_callback with context %} 554 {% from 'methods.cpp' import named_constructor_callback with context %}
555 {% block named_constructor %} 555 {% block named_constructor %}
556 {% if named_constructor %} 556 {% if named_constructor %}
557 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class 557 {% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class
558 if is_active_dom_object else '0' %} 558 if is_active_dom_object else '0' %}
559 {% set to_event_target = '%s::toEventTarget' % v8_class 559 {% set to_event_target = '%s::toEventTarget' % v8_class
560 if is_event_target else '0' %} 560 if is_event_target else '0' %}
561 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::derefObject, {{to_ac tive_dom_object}}, {{to_event_target}}, 0, {{v8_class}}::installPerContextEnable dMethods, 0, WrapperTypeObjectPrototype, false }; 561 const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde rBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::derefObject, {{to_ac tive_dom_object}}, {{to_event_target}}, 0, {{v8_class}}::installPerContextEnable dMethods, 0, WrapperTypeObjectPrototype, false };
562 562
563 {{named_constructor_callback(named_constructor)}} 563 {{named_constructor_callback(named_constructor)}}
564 v8::Handle<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolat e* isolate, WrapperWorldType currentWorldType) 564 v8::Handle<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolat e* isolate)
565 { 565 {
566 static int domTemplateKey; // This address is used for a key to look up the dom template. 566 static int domTemplateKey; // This address is used for a key to look up the dom template.
567 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 567 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
568 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(currentWo rldType, &domTemplateKey); 568 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTempl ateKey);
569 if (!result.IsEmpty()) 569 if (!result.IsEmpty())
570 return result; 570 return result;
571 571
572 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 572 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
573 v8::EscapableHandleScope scope(isolate); 573 v8::EscapableHandleScope scope(isolate);
574 result = v8::FunctionTemplate::New(isolate, {{v8_class}}ConstructorCallback) ; 574 result = v8::FunctionTemplate::New(isolate, {{v8_class}}ConstructorCallback) ;
575 575
576 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate(); 576 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
577 instanceTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount); 577 instanceTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount);
578 result->SetClassName(v8AtomicString(isolate, "{{cpp_class}}")); 578 result->SetClassName(v8AtomicString(isolate, "{{cpp_class}}"));
579 result->Inherit({{v8_class}}::domTemplate(isolate, currentWorldType)); 579 result->Inherit({{v8_class}}::domTemplate(isolate));
580 data->setDOMTemplate(currentWorldType, &domTemplateKey, result); 580 data->setDOMTemplate(&domTemplateKey, result);
581
582 return scope.Escape(result); 581 return scope.Escape(result);
583 } 582 }
584 583
585 {% endif %} 584 {% endif %}
586 {% endblock %} 585 {% endblock %}
587 586
588 {##############################################################################} 587 {##############################################################################}
589 {% block overloaded_constructor %} 588 {% block overloaded_constructor %}
590 {% if constructors|length > 1 %} 589 {% if constructors|length > 1 %}
591 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) 590 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
836 {% endif %} 835 {% endif %}
837 } 836 }
838 837
839 {% endif %} 838 {% endif %}
840 {% endblock %} 839 {% endblock %}
841 840
842 841
843 {##############################################################################} 842 {##############################################################################}
844 {% block configure_shadow_object_template %} 843 {% block configure_shadow_object_template %}
845 {% if interface_name == 'Window' %} 844 {% if interface_name == 'Window' %}
846 static void configureShadowObjectTemplate(v8::Handle<v8::ObjectTemplate> templ, v8::Isolate* isolate, WrapperWorldType currentWorldType) 845 static void configureShadowObjectTemplate(v8::Handle<v8::ObjectTemplate> templ, v8::Isolate* isolate)
847 { 846 {
848 V8DOMConfiguration::installAttributes(templ, v8::Handle<v8::ObjectTemplate>( ), shadowAttributes, WTF_ARRAY_LENGTH(shadowAttributes), isolate, currentWorldTy pe); 847 V8DOMConfiguration::installAttributes(templ, v8::Handle<v8::ObjectTemplate>( ), shadowAttributes, WTF_ARRAY_LENGTH(shadowAttributes), isolate);
849 848
850 // Install a security handler with V8. 849 // Install a security handler with V8.
851 templ->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom, V8Window: :indexedSecurityCheckCustom, v8::External::New(isolate, const_cast<WrapperTypeIn fo*>(&V8Window::wrapperTypeInfo))); 850 templ->SetAccessCheckCallbacks(V8Window::namedSecurityCheckCustom, V8Window: :indexedSecurityCheckCustom, v8::External::New(isolate, const_cast<WrapperTypeIn fo*>(&V8Window::wrapperTypeInfo)));
852 templ->SetInternalFieldCount(V8Window::internalFieldCount); 851 templ->SetInternalFieldCount(V8Window::internalFieldCount);
853 } 852 }
854 853
855 {% endif %} 854 {% endif %}
856 {% endblock %} 855 {% endblock %}
857 856
858 857
859 {##############################################################################} 858 {##############################################################################}
860 {% block configure_class_template %} 859 {% block configure_class_template %}
861 {# FIXME: rename to install_dom_template and Install{{v8_class}}DOMTemplate #} 860 {# FIXME: rename to install_dom_template and Install{{v8_class}}DOMTemplate #}
862 static void configure{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> funct ionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) 861 static void configure{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> funct ionTemplate, v8::Isolate* isolate)
863 { 862 {
864 functionTemplate->ReadOnlyPrototype(); 863 functionTemplate->ReadOnlyPrototype();
865 864
866 v8::Local<v8::Signature> defaultSignature; 865 v8::Local<v8::Signature> defaultSignature;
867 {% set parent_template = 866 {% set parent_template =
868 'V8%s::domTemplate(isolate, currentWorldType)' % parent_interface 867 'V8%s::domTemplate(isolate)' % parent_interface
869 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %} 868 if parent_interface else 'v8::Local<v8::FunctionTemplate>()' %}
870 {% if runtime_enabled_function %} 869 {% if runtime_enabled_function %}
871 if (!{{runtime_enabled_function}}()) 870 if (!{{runtime_enabled_function}}())
872 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate, currentWorldType); 871 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", {{parent_template}}, {{v8_class}}::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate);
873 else 872 else
874 {% endif %} 873 {% endif %}
875 {% set runtime_enabled_indent = 4 if runtime_enabled_function else 0 %} 874 {% set runtime_enabled_indent = 4 if runtime_enabled_function else 0 %}
876 {% filter indent(runtime_enabled_indent, true) %} 875 {% filter indent(runtime_enabled_indent, true) %}
877 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalFieldCount , 876 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "{{interface_name}}", {{parent_template}}, {{v8_class}}::internalFieldCount ,
878 {# Test needed as size 0 constant arrays are not allowed in VC++ #} 877 {# Test needed as size 0 constant arrays are not allowed in VC++ #}
879 {% set attributes_name, attributes_length = 878 {% set attributes_name, attributes_length =
880 ('%sAttributes' % v8_class, 879 ('%sAttributes' % v8_class,
881 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class) 880 'WTF_ARRAY_LENGTH(%sAttributes)' % v8_class)
882 if has_attribute_configuration else (0, 0) %} 881 if has_attribute_configuration else (0, 0) %}
883 {% set accessors_name, accessors_length = 882 {% set accessors_name, accessors_length =
884 ('%sAccessors' % v8_class, 883 ('%sAccessors' % v8_class,
885 'WTF_ARRAY_LENGTH(%sAccessors)' % v8_class) 884 'WTF_ARRAY_LENGTH(%sAccessors)' % v8_class)
886 if has_accessors else (0, 0) %} 885 if has_accessors else (0, 0) %}
887 {% set methods_name, methods_length = 886 {% set methods_name, methods_length =
888 ('%sMethods' % v8_class, 887 ('%sMethods' % v8_class,
889 'WTF_ARRAY_LENGTH(%sMethods)' % v8_class) 888 'WTF_ARRAY_LENGTH(%sMethods)' % v8_class)
890 if has_method_configuration else (0, 0) %} 889 if has_method_configuration else (0, 0) %}
891 {{attributes_name}}, {{attributes_length}}, 890 {{attributes_name}}, {{attributes_length}},
892 {{accessors_name}}, {{accessors_length}}, 891 {{accessors_name}}, {{accessors_length}},
893 {{methods_name}}, {{methods_length}}, 892 {{methods_name}}, {{methods_length}},
894 isolate, currentWorldType); 893 isolate);
895 {% endfilter %} 894 {% endfilter %}
896 895
897 {% if constructors or has_custom_constructor or has_event_constructor %} 896 {% if constructors or has_custom_constructor or has_event_constructor %}
898 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback); 897 functionTemplate->SetCallHandler({{v8_class}}::constructorCallback);
899 functionTemplate->SetLength({{interface_length}}); 898 functionTemplate->SetLength({{interface_length}});
900 {% endif %} 899 {% endif %}
901 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); 900 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
902 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate(); 901 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate();
903 {% if is_check_security and interface_name != 'Window' %} 902 {% if is_check_security and interface_name != 'Window' %}
904 instanceTemplate->SetAccessCheckCallbacks({{cpp_class}}V8Internal::namedSecu rityCheck, {{cpp_class}}V8Internal::indexedSecurityCheck, v8::External::New(isol ate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo))); 903 instanceTemplate->SetAccessCheckCallbacks({{cpp_class}}V8Internal::namedSecu rityCheck, {{cpp_class}}V8Internal::indexedSecurityCheck, v8::External::New(isol ate, const_cast<WrapperTypeInfo*>(&{{v8_class}}::wrapperTypeInfo)));
905 {% endif %} 904 {% endif %}
906 {% for attribute in attributes 905 {% for attribute in attributes
907 if attribute.runtime_enabled_function and 906 if attribute.runtime_enabled_function and
908 not attribute.per_context_enabled_function and 907 not attribute.per_context_enabled_function and
909 not attribute.is_static %} 908 not attribute.is_static %}
910 {% filter conditional(attribute.conditional_string) %} 909 {% filter conditional(attribute.conditional_string) %}
911 if ({{attribute.runtime_enabled_function}}()) { 910 if ({{attribute.runtime_enabled_function}}()) {
912 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ 911 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
913 {{attribute_configuration(attribute)}}; 912 {{attribute_configuration(attribute)}};
914 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate, currentWorldType); 913 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
915 } 914 }
916 {% endfilter %} 915 {% endfilter %}
917 {% endfor %} 916 {% endfor %}
918 {% if constants %} 917 {% if constants %}
919 {{install_constants() | indent}} 918 {{install_constants() | indent}}
920 {% endif %} 919 {% endif %}
921 {# Special operations #} 920 {# Special operations #}
922 {# V8 has access-check callback API and it's used on Window instead of 921 {# V8 has access-check callback API and it's used on Window instead of
923 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks. 922 deleters or enumerators; see ObjectTemplate::SetAccessCheckCallbacks.
924 In addition, the getter should be set on the prototype template, to get 923 In addition, the getter should be set on the prototype template, to get
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 {# Needed for legacy support of document.all #} 967 {# Needed for legacy support of document.all #}
969 functionTemplate->InstanceTemplate()->MarkAsUndetectable(); 968 functionTemplate->InstanceTemplate()->MarkAsUndetectable();
970 {% endif %} 969 {% endif %}
971 {% for method in methods if not method.do_not_check_signature %} 970 {% for method in methods if not method.do_not_check_signature %}
972 {# install_custom_signature #} 971 {# install_custom_signature #}
973 {% if not method.overload_index or method.overload_index == 1 %} 972 {% if not method.overload_index or method.overload_index == 1 %}
974 {# For overloaded methods, only generate one accessor #} 973 {# For overloaded methods, only generate one accessor #}
975 {% filter conditional(method.conditional_string) %} 974 {% filter conditional(method.conditional_string) %}
976 {% if method.is_do_not_check_security %} 975 {% if method.is_do_not_check_security %}
977 {% if method.is_per_world_bindings %} 976 {% if method.is_per_world_bindings %}
978 if (currentWorldType == MainWorld) { 977 if (DOMWrapperWorld::current(isolate)->isMainWorld()) {
979 {{install_do_not_check_security_signature(method, 'ForMainWorld')}} 978 {{install_do_not_check_security_signature(method, 'ForMainWorld')}}
980 } else { 979 } else {
981 {{install_do_not_check_security_signature(method)}} 980 {{install_do_not_check_security_signature(method)}}
982 } 981 }
983 {% else %} 982 {% else %}
984 {{install_do_not_check_security_signature(method)}} 983 {{install_do_not_check_security_signature(method)}}
985 {% endif %} 984 {% endif %}
986 {% else %}{# is_do_not_check_security #} 985 {% else %}{# is_do_not_check_security #}
987 {% if method.is_per_world_bindings %} 986 {% if method.is_per_world_bindings %}
988 if (currentWorldType == MainWorld) { 987 if (DOMWrapperWorld::current(isolate)->isMainWorld()) {
989 {% filter runtime_enabled(method.runtime_enabled_function) %} 988 {% filter runtime_enabled(method.runtime_enabled_function) %}
990 {{install_custom_signature(method, 'ForMainWorld')}} 989 {{install_custom_signature(method, 'ForMainWorld')}}
991 {% endfilter %} 990 {% endfilter %}
992 } else { 991 } else {
993 {% filter runtime_enabled(method.runtime_enabled_function) %} 992 {% filter runtime_enabled(method.runtime_enabled_function) %}
994 {{install_custom_signature(method)}} 993 {{install_custom_signature(method)}}
995 {% endfilter %} 994 {% endfilter %}
996 } 995 }
997 {% else %} 996 {% else %}
998 {% filter runtime_enabled(method.runtime_enabled_function) %} 997 {% filter runtime_enabled(method.runtime_enabled_function) %}
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 {% set constant_cpp_class = constant.cpp_class or cpp_class %} 1086 {% set constant_cpp_class = constant.cpp_class or cpp_class %}
1088 COMPILE_ASSERT({{constant.value}} == {{constant_cpp_class}}::{{constant.reflecte d_name}}, TheValueOf{{cpp_class}}_{{constant.reflected_name}}DoesntMatchWithImpl ementation); 1087 COMPILE_ASSERT({{constant.value}} == {{constant_cpp_class}}::{{constant.reflecte d_name}}, TheValueOf{{cpp_class}}_{{constant.reflected_name}}DoesntMatchWithImpl ementation);
1089 {% endfor %} 1088 {% endfor %}
1090 {% endif %} 1089 {% endif %}
1091 {% endmacro %} 1090 {% endmacro %}
1092 1091
1093 1092
1094 {##############################################################################} 1093 {##############################################################################}
1095 {% block get_template %} 1094 {% block get_template %}
1096 {# FIXME: rename to get_dom_template and GetDOMTemplate #} 1095 {# FIXME: rename to get_dom_template and GetDOMTemplate #}
1097 v8::Handle<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType) 1096 v8::Handle<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate)
1098 { 1097 {
1099 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 1098 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
1100 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 1099 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w rapperTypeInfo);
1101 if (result != data->templateMap(currentWorldType).end()) 1100 if (result != data->templateMap().end())
1102 return result->value.newLocal(isolate); 1101 return result->value.newLocal(isolate);
1103 1102
1104 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 1103 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
1105 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode); 1104 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
1106 configure{{v8_class}}Template(templ, isolate, currentWorldType); 1105 configure{{v8_class}}Template(templ, isolate);
1107 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 1106 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl ate>(isolate, templ));
1108 return templ; 1107 return templ;
1109 } 1108 }
1110 1109
1111 {% endblock %} 1110 {% endblock %}
1112 1111
1113 1112
1114 {##############################################################################} 1113 {##############################################################################}
1115 {% block has_instance %} 1114 {% block has_instance %}
1116 bool {{v8_class}}::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isola te) 1115 bool {{v8_class}}::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isola te)
1117 { 1116 {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 {% endif %} 1153 {% endif %}
1155 {% endblock %} 1154 {% endblock %}
1156 1155
1157 1156
1158 {##############################################################################} 1157 {##############################################################################}
1159 {% block install_per_context_methods %} 1158 {% block install_per_context_methods %}
1160 {% if has_per_context_enabled_methods %} 1159 {% if has_per_context_enabled_methods %}
1161 void {{v8_class}}::installPerContextEnabledMethods(v8::Handle<v8::Object> protot ypeTemplate, v8::Isolate* isolate) 1160 void {{v8_class}}::installPerContextEnabledMethods(v8::Handle<v8::Object> protot ypeTemplate, v8::Isolate* isolate)
1162 { 1161 {
1163 {# Define per-context enabled operations #} 1162 {# Define per-context enabled operations #}
1164 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT emplate(isolate, worldType(isolate))); 1163 v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domT emplate(isolate));
1165 1164
1166 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo ntext()); 1165 ExecutionContext* context = toExecutionContext(prototypeTemplate->CreationCo ntext());
1167 {% for method in methods if method.per_context_enabled_function %} 1166 {% for method in methods if method.per_context_enabled_function %}
1168 if (context && context->isDocument() && {{method.per_context_enabled_functio n}}(toDocument(context))) 1167 if (context && context->isDocument() && {{method.per_context_enabled_functio n}}(toDocument(context)))
1169 prototypeTemplate->Set(v8AtomicString(isolate, "{{method.name}}"), v8::F unctionTemplate::New(isolate, {{cpp_class}}V8Internal::{{method.name}}MethodCall back, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})- >GetFunction()); 1168 prototypeTemplate->Set(v8AtomicString(isolate, "{{method.name}}"), v8::F unctionTemplate::New(isolate, {{cpp_class}}V8Internal::{{method.name}}MethodCall back, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})- >GetFunction());
1170 {% endfor %} 1169 {% endfor %}
1171 } 1170 }
1172 1171
1173 {% endif %} 1172 {% endif %}
1174 {% endblock %} 1173 {% endblock %}
(...skipping 19 matching lines...) Expand all
1194 return toNative(object); 1193 return toNative(object);
1195 } 1194 }
1196 1195
1197 {% endif %} 1196 {% endif %}
1198 {% endblock %} 1197 {% endblock %}
1199 1198
1200 1199
1201 {##############################################################################} 1200 {##############################################################################}
1202 {% block get_shadow_object_template %} 1201 {% block get_shadow_object_template %}
1203 {% if interface_name == 'Window' %} 1202 {% if interface_name == 'Window' %}
1204 v8::Handle<v8::ObjectTemplate> V8Window::getShadowObjectTemplate(v8::Isolate* is olate, WrapperWorldType currentWorldType) 1203 v8::Handle<v8::ObjectTemplate> V8Window::getShadowObjectTemplate(v8::Isolate* is olate)
1205 { 1204 {
1206 if (currentWorldType == MainWorld) { 1205 if (DOMWrapperWorld::current(isolate)->isMainWorld()) {
1207 DEFINE_STATIC_LOCAL(v8::Persistent<v8::ObjectTemplate>, V8WindowShadowOb jectCacheForMainWorld, ()); 1206 DEFINE_STATIC_LOCAL(v8::Persistent<v8::ObjectTemplate>, V8WindowShadowOb jectCacheForMainWorld, ());
1208 if (V8WindowShadowObjectCacheForMainWorld.IsEmpty()) { 1207 if (V8WindowShadowObjectCacheForMainWorld.IsEmpty()) {
1209 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 1208 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
1210 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isola te); 1209 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isola te);
1211 configureShadowObjectTemplate(templ, isolate, currentWorldType); 1210 configureShadowObjectTemplate(templ, isolate);
1212 V8WindowShadowObjectCacheForMainWorld.Reset(isolate, templ); 1211 V8WindowShadowObjectCacheForMainWorld.Reset(isolate, templ);
1213 return templ; 1212 return templ;
1214 } 1213 }
1215 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC acheForMainWorld); 1214 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC acheForMainWorld);
1216 } else { 1215 } else {
1217 DEFINE_STATIC_LOCAL(v8::Persistent<v8::ObjectTemplate>, V8WindowShadowOb jectCacheForNonMainWorld, ()); 1216 DEFINE_STATIC_LOCAL(v8::Persistent<v8::ObjectTemplate>, V8WindowShadowOb jectCacheForNonMainWorld, ());
1218 if (V8WindowShadowObjectCacheForNonMainWorld.IsEmpty()) { 1217 if (V8WindowShadowObjectCacheForNonMainWorld.IsEmpty()) {
1219 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 1218 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
1220 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isola te); 1219 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isola te);
1221 configureShadowObjectTemplate(templ, isolate, currentWorldType); 1220 configureShadowObjectTemplate(templ, isolate);
1222 V8WindowShadowObjectCacheForNonMainWorld.Reset(isolate, templ); 1221 V8WindowShadowObjectCacheForNonMainWorld.Reset(isolate, templ);
1223 return templ; 1222 return templ;
1224 } 1223 }
1225 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC acheForNonMainWorld); 1224 return v8::Local<v8::ObjectTemplate>::New(isolate, V8WindowShadowObjectC acheForNonMainWorld);
1226 } 1225 }
1227 } 1226 }
1228 1227
1229 {% endif %} 1228 {% endif %}
1230 {% endblock %} 1229 {% endblock %}
1231 1230
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1320 {% endfilter %} 1319 {% endfilter %}
1321 } 1320 }
1322 1321
1323 template<> 1322 template<>
1324 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 1323 v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
1325 { 1324 {
1326 return toV8(impl, creationContext, isolate); 1325 return toV8(impl, creationContext, isolate);
1327 } 1326 }
1328 1327
1329 {% endblock %} 1328 {% endblock %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/interface.h ('k') | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698