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

Side by Side Diff: Source/bindings/tests/results/V8TestInterfacePython.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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 915
916 static const V8DOMConfiguration::MethodConfiguration V8TestInterfacePythonMethod s[] = { 916 static const V8DOMConfiguration::MethodConfiguration V8TestInterfacePythonMethod s[] = {
917 {"voidMethodTestInterfaceEmptyArg", TestInterfacePythonImplementationV8Inter nal::voidMethodTestInterfaceEmptyArgMethodCallback, 0, 1}, 917 {"voidMethodTestInterfaceEmptyArg", TestInterfacePythonImplementationV8Inter nal::voidMethodTestInterfaceEmptyArgMethodCallback, 0, 1},
918 {"voidMethod", TestInterfacePythonImplementationV8Internal::voidMethodMethod Callback, TestInterfacePythonImplementationV8Internal::voidMethodMethodCallbackF orMainWorld, 0}, 918 {"voidMethod", TestInterfacePythonImplementationV8Internal::voidMethodMethod Callback, TestInterfacePythonImplementationV8Internal::voidMethodMethodCallbackF orMainWorld, 0},
919 {"implementsVoidMethod", TestInterfacePythonImplementationV8Internal::implem entsVoidMethodMethodCallback, 0, 0}, 919 {"implementsVoidMethod", TestInterfacePythonImplementationV8Internal::implem entsVoidMethodMethodCallback, 0, 0},
920 {"implementsComplexMethod", TestInterfacePythonImplementationV8Internal::imp lementsComplexMethodMethodCallback, 0, 2}, 920 {"implementsComplexMethod", TestInterfacePythonImplementationV8Internal::imp lementsComplexMethodMethodCallback, 0, 2},
921 {"implementsCustomVoidMethod", TestInterfacePythonImplementationV8Internal:: implementsCustomVoidMethodMethodCallback, 0, 0}, 921 {"implementsCustomVoidMethod", TestInterfacePythonImplementationV8Internal:: implementsCustomVoidMethodMethodCallback, 0, 0},
922 {"partial2VoidMethod", TestInterfacePythonImplementationV8Internal::partial2 VoidMethodMethodCallback, 0, 0}, 922 {"partial2VoidMethod", TestInterfacePythonImplementationV8Internal::partial2 VoidMethodMethodCallback, 0, 0},
923 }; 923 };
924 924
925 static void configureV8TestInterfacePythonTemplate(v8::Handle<v8::FunctionTempla te> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) 925 static void configureV8TestInterfacePythonTemplate(v8::Handle<v8::FunctionTempla te> functionTemplate, v8::Isolate* isolate)
926 { 926 {
927 functionTemplate->ReadOnlyPrototype(); 927 functionTemplate->ReadOnlyPrototype();
928 928
929 v8::Local<v8::Signature> defaultSignature; 929 v8::Local<v8::Signature> defaultSignature;
930 if (!RuntimeEnabledFeatures::featureNameEnabled()) 930 if (!RuntimeEnabledFeatures::featureNameEnabled())
931 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", V8TestInterfaceEmpty::domTemplate(isolate, currentWorldType), V8Tes tInterfacePython::internalFieldCount, 0, 0, 0, 0, 0, 0, isolate, currentWorldTyp e); 931 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "", V8TestInterfaceEmpty::domTemplate(isolate), V8TestInterfacePython:: internalFieldCount, 0, 0, 0, 0, 0, 0, isolate);
932 else 932 else
933 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "TestInterfacePython", V8TestInterfaceEmpty::domTemplate(isolate, curre ntWorldType), V8TestInterfacePython::internalFieldCount, 933 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionT emplate, "TestInterfacePython", V8TestInterfaceEmpty::domTemplate(isolate), V8Te stInterfacePython::internalFieldCount,
934 V8TestInterfacePythonAttributes, WTF_ARRAY_LENGTH(V8TestInterfacePyt honAttributes), 934 V8TestInterfacePythonAttributes, WTF_ARRAY_LENGTH(V8TestInterfacePyt honAttributes),
935 0, 0, 935 0, 0,
936 V8TestInterfacePythonMethods, WTF_ARRAY_LENGTH(V8TestInterfacePython Methods), 936 V8TestInterfacePythonMethods, WTF_ARRAY_LENGTH(V8TestInterfacePython Methods),
937 isolate, currentWorldType); 937 isolate);
938 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate(); 938 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
939 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate(); 939 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate();
940 if (RuntimeEnabledFeatures::implementsFeatureNameEnabled()) { 940 if (RuntimeEnabledFeatures::implementsFeatureNameEnabled()) {
941 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ 941 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
942 {"implementsRuntimeEnabledNodeAttribute", TestInterfacePythonImplementat ionV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGetterCallback, Tes tInterfacePythonImplementationV8Internal::implementsRuntimeEnabledNodeAttributeA ttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), st atic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; 942 {"implementsRuntimeEnabledNodeAttribute", TestInterfacePythonImplementat ionV8Internal::implementsRuntimeEnabledNodeAttributeAttributeGetterCallback, Tes tInterfacePythonImplementationV8Internal::implementsRuntimeEnabledNodeAttributeA ttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), st atic_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
943 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate, currentWorldType); 943 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
944 } 944 }
945 if (RuntimeEnabledFeatures::implements2FeatureNameEnabled()) { 945 if (RuntimeEnabledFeatures::implements2FeatureNameEnabled()) {
946 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ 946 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
947 {"implements2StringAttribute", TestInterfacePythonImplementationV8Intern al::implements2StringAttributeAttributeGetterCallback, TestInterfacePythonImplem entationV8Internal::implements2StringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>( v8::None), 0 /* on instance */}; 947 {"implements2StringAttribute", TestInterfacePythonImplementationV8Intern al::implements2StringAttributeAttributeGetterCallback, TestInterfacePythonImplem entationV8Internal::implements2StringAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>( v8::None), 0 /* on instance */};
948 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate, currentWorldType); 948 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
949 } 949 }
950 #if ENABLE(PARTIAL_CONDITION) 950 #if ENABLE(PARTIAL_CONDITION)
951 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { 951 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
952 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ 952 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
953 {"partialLongAttribute", TestInterfacePythonImplementationV8Internal::pa rtialLongAttributeAttributeGetterCallback, TestInterfacePythonImplementationV8In ternal::partialLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::Ac cessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}; 953 {"partialLongAttribute", TestInterfacePythonImplementationV8Internal::pa rtialLongAttributeAttributeGetterCallback, TestInterfacePythonImplementationV8In ternal::partialLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::Ac cessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */};
954 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate, currentWorldType); 954 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
955 } 955 }
956 #endif // ENABLE(PARTIAL_CONDITION) 956 #endif // ENABLE(PARTIAL_CONDITION)
957 #if ENABLE(PARTIAL_CONDITION) 957 #if ENABLE(PARTIAL_CONDITION)
958 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { 958 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
959 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\ 959 static const V8DOMConfiguration::AttributeConfiguration attributeConfigu ration =\
960 {"partialCallWithExecutionContextLongAttribute", TestInterfacePythonImpl ementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeGette rCallback, TestInterfacePythonImplementationV8Internal::partialCallWithExecution ContextLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessCont rol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instanc e */}; 960 {"partialCallWithExecutionContextLongAttribute", TestInterfacePythonImpl ementationV8Internal::partialCallWithExecutionContextLongAttributeAttributeGette rCallback, TestInterfacePythonImplementationV8Internal::partialCallWithExecution ContextLongAttributeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessCont rol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instanc e */};
961 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate, currentWorldType); 961 V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate , attributeConfiguration, isolate);
962 } 962 }
963 #endif // ENABLE(PARTIAL_CONDITION) 963 #endif // ENABLE(PARTIAL_CONDITION)
964 static const V8DOMConfiguration::ConstantConfiguration V8TestInterfacePython Constants[] = { 964 static const V8DOMConfiguration::ConstantConfiguration V8TestInterfacePython Constants[] = {
965 {"UNSIGNED_LONG", 0}, 965 {"UNSIGNED_LONG", 0},
966 {"IMPLEMENTS_CONSTANT_1", 1}, 966 {"IMPLEMENTS_CONSTANT_1", 1},
967 {"IMPLEMENTS_CONSTANT_2", 2}, 967 {"IMPLEMENTS_CONSTANT_2", 2},
968 {"PARTIAL2_UNSIGNED_SHORT", 0}, 968 {"PARTIAL2_UNSIGNED_SHORT", 0},
969 }; 969 };
970 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8 TestInterfacePythonConstants, WTF_ARRAY_LENGTH(V8TestInterfacePythonConstants), isolate); 970 V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, V8 TestInterfacePythonConstants, WTF_ARRAY_LENGTH(V8TestInterfacePythonConstants), isolate);
971 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) { 971 if (RuntimeEnabledFeatures::partialFeatureNameEnabled()) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implements2 StaticStringAttribute"), TestInterfacePythonImplementationV8Internal::implements 2StaticStringAttributeAttributeGetterCallback, TestInterfacePythonImplementation V8Internal::implements2StaticStringAttributeAttributeSetterCallback, v8::Externa l::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8: :AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); 1004 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "implements2 StaticStringAttribute"), TestInterfacePythonImplementationV8Internal::implements 2StaticStringAttributeAttributeGetterCallback, TestInterfacePythonImplementation V8Internal::implements2StaticStringAttributeAttributeSetterCallback, v8::Externa l::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8: :AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1005 #if ENABLE(PARTIAL_CONDITION) 1005 #if ENABLE(PARTIAL_CONDITION)
1006 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "partialStat icLongAttribute"), TestInterfacePythonImplementationV8Internal::partialStaticLon gAttributeAttributeGetterCallback, TestInterfacePythonImplementationV8Internal:: partialStaticLongAttributeAttributeSetterCallback, v8::External::New(isolate, 0) , static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature >(), static_cast<v8::AccessControl>(v8::DEFAULT)); 1006 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "partialStat icLongAttribute"), TestInterfacePythonImplementationV8Internal::partialStaticLon gAttributeAttributeGetterCallback, TestInterfacePythonImplementationV8Internal:: partialStaticLongAttributeAttributeSetterCallback, v8::External::New(isolate, 0) , static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature >(), static_cast<v8::AccessControl>(v8::DEFAULT));
1007 #endif // ENABLE(PARTIAL_CONDITION) 1007 #endif // ENABLE(PARTIAL_CONDITION)
1008 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "partial2Sta ticLongAttribute"), TestInterfacePythonImplementationV8Internal::partial2StaticL ongAttributeAttributeGetterCallback, TestInterfacePythonImplementationV8Internal ::partial2StaticLongAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignat ure>(), static_cast<v8::AccessControl>(v8::DEFAULT)); 1008 functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "partial2Sta ticLongAttribute"), TestInterfacePythonImplementationV8Internal::partial2StaticL ongAttributeAttributeGetterCallback, TestInterfacePythonImplementationV8Internal ::partial2StaticLongAttributeAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignat ure>(), static_cast<v8::AccessControl>(v8::DEFAULT));
1009 1009
1010 // Custom toString template 1010 // Custom toString template
1011 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :current()->toStringTemplate()); 1011 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :current()->toStringTemplate());
1012 } 1012 }
1013 1013
1014 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType) 1014 v8::Handle<v8::FunctionTemplate> V8TestInterfacePython::domTemplate(v8::Isolate* isolate)
1015 { 1015 {
1016 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 1016 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
1017 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 1017 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w rapperTypeInfo);
1018 if (result != data->templateMap(currentWorldType).end()) 1018 if (result != data->templateMap().end())
1019 return result->value.newLocal(isolate); 1019 return result->value.newLocal(isolate);
1020 1020
1021 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 1021 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
1022 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode); 1022 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
1023 configureV8TestInterfacePythonTemplate(templ, isolate, currentWorldType); 1023 configureV8TestInterfacePythonTemplate(templ, isolate);
1024 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 1024 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl ate>(isolate, templ));
1025 return templ; 1025 return templ;
1026 } 1026 }
1027 1027
1028 bool V8TestInterfacePython::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola te* isolate) 1028 bool V8TestInterfacePython::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isola te* isolate)
1029 { 1029 {
1030 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e); 1030 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e);
1031 } 1031 }
1032 1032
1033 v8::Handle<v8::Object> V8TestInterfacePython::findInstanceInPrototypeChain(v8::H andle<v8::Value> jsValue, v8::Isolate* isolate) 1033 v8::Handle<v8::Object> V8TestInterfacePython::findInstanceInPrototypeChain(v8::H andle<v8::Value> jsValue, v8::Isolate* isolate)
1034 { 1034 {
(...skipping 26 matching lines...) Expand all
1061 } 1061 }
1062 1062
1063 template<> 1063 template<>
1064 v8::Handle<v8::Value> toV8NoInline(TestInterfacePythonImplementation* impl, v8:: Handle<v8::Object> creationContext, v8::Isolate* isolate) 1064 v8::Handle<v8::Value> toV8NoInline(TestInterfacePythonImplementation* impl, v8:: Handle<v8::Object> creationContext, v8::Isolate* isolate)
1065 { 1065 {
1066 return toV8(impl, creationContext, isolate); 1066 return toV8(impl, creationContext, isolate);
1067 } 1067 }
1068 1068
1069 } // namespace WebCore 1069 } // namespace WebCore
1070 #endif // ENABLE(CONDITION) 1070 #endif // ENABLE(CONDITION)
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterfacePython.h ('k') | Source/bindings/tests/results/V8TestInterfacePython2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698