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

Side by Side Diff: Source/bindings/tests/results/V8TestInterface.cpp

Issue 104873018: Remove raw DOM templates from V8 bindings (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 830 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 } 841 }
842 842
843 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { 843 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
844 v8SetReturnValue(info, info.Holder()); 844 v8SetReturnValue(info, info.Holder());
845 return; 845 return;
846 } 846 }
847 847
848 TestInterfaceV8Internal::constructor(info); 848 TestInterfaceV8Internal::constructor(info);
849 } 849 }
850 850
851 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceTemplate(v8::Han dle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldTy pe currentWorldType) 851 static void configureV8TestInterfaceTemplate(v8::Handle<v8::FunctionTemplate> fu nctionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
852 { 852 {
853 functionTemplate->ReadOnlyPrototype(); 853 functionTemplate->ReadOnlyPrototype();
854 854
855 v8::Local<v8::Signature> defaultSignature; 855 v8::Local<v8::Signature> defaultSignature;
856 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterface", v8::Local<v8::FunctionTemplate>(), V8TestInterface::intern alFieldCount, 856 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterface", v8::Local<v8::FunctionTemplate>(), V8TestInterface::intern alFieldCount,
857 V8TestInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceAttributes), 857 V8TestInterfaceAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceAttributes),
858 0, 0, 858 0, 0,
859 V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods), 859 V8TestInterfaceMethods, WTF_ARRAY_LENGTH(V8TestInterfaceMethods),
860 isolate, currentWorldType); 860 isolate, currentWorldType);
861 functionTemplate->SetCallHandler(V8TestInterface::constructorCallback); 861 functionTemplate->SetCallHandler(V8TestInterface::constructorCallback);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "im plementsStaticAttr", v8::String::kInternalizedString), TestInterfaceV8Internal:: implementsStaticAttrAttributeGetterCallback, TestInterfaceV8Internal::implements StaticAttrAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8 ::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast <v8::AccessControl>(v8::DEFAULT)); 894 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "im plementsStaticAttr", v8::String::kInternalizedString), TestInterfaceV8Internal:: implementsStaticAttrAttributeGetterCallback, TestInterfaceV8Internal::implements StaticAttrAttributeSetterCallback, v8::External::New(isolate, 0), static_cast<v8 ::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast <v8::AccessControl>(v8::DEFAULT));
895 #if ENABLE(Condition11) || ENABLE(Condition12) 895 #if ENABLE(Condition11) || ENABLE(Condition12)
896 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "su pplementalStaticReadOnlyAttr", v8::String::kInternalizedString), TestInterfaceV8 Internal::supplementalStaticReadOnlyAttrAttributeGetterCallback, 0, v8::External ::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8:: AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT)); 896 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "su pplementalStaticReadOnlyAttr", v8::String::kInternalizedString), TestInterfaceV8 Internal::supplementalStaticReadOnlyAttrAttributeGetterCallback, 0, v8::External ::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8:: AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
897 #endif // ENABLE(Condition11) || ENABLE(Condition12) 897 #endif // ENABLE(Condition11) || ENABLE(Condition12)
898 #if ENABLE(Condition11) || ENABLE(Condition12) 898 #if ENABLE(Condition11) || ENABLE(Condition12)
899 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "su pplementalStaticAttr", v8::String::kInternalizedString), TestInterfaceV8Internal ::supplementalStaticAttrAttributeGetterCallback, TestInterfaceV8Internal::supple mentalStaticAttrAttributeSetterCallback, v8::External::New(isolate, 0), static_c ast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), stati c_cast<v8::AccessControl>(v8::DEFAULT)); 899 functionTemplate->SetNativeDataProperty(v8::String::NewFromUtf8(isolate, "su pplementalStaticAttr", v8::String::kInternalizedString), TestInterfaceV8Internal ::supplementalStaticAttrAttributeGetterCallback, TestInterfaceV8Internal::supple mentalStaticAttrAttributeSetterCallback, v8::External::New(isolate, 0), static_c ast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), stati c_cast<v8::AccessControl>(v8::DEFAULT));
900 #endif // ENABLE(Condition11) || ENABLE(Condition12) 900 #endif // ENABLE(Condition11) || ENABLE(Condition12)
901 901
902 // Custom toString template 902 // Custom toString template
903 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); 903 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate());
904 return functionTemplate;
905 } 904 }
906 905
907 v8::Handle<v8::FunctionTemplate> V8TestInterface::domTemplate(v8::Isolate* isola te, WrapperWorldType currentWorldType) 906 v8::Handle<v8::FunctionTemplate> V8TestInterface::domTemplate(v8::Isolate* isola te, WrapperWorldType currentWorldType)
908 { 907 {
909 V8PerIsolateData* data = V8PerIsolateData::from(isolate); 908 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
910 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo); 909 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo rldType).find(&wrapperTypeInfo);
911 if (result != data->templateMap(currentWorldType).end()) 910 if (result != data->templateMap(currentWorldType).end())
912 return result->value.newLocal(isolate); 911 return result->value.newLocal(isolate);
913 912
914 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); 913 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
915 v8::EscapableHandleScope handleScope(isolate); 914 v8::EscapableHandleScope handleScope(isolate);
916 v8::Local<v8::FunctionTemplate> templ = 915 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V 8ObjectConstructor::isValidConstructorMode);
917 ConfigureV8TestInterfaceTemplate(data->rawDOMTemplate(&wrapperTypeInfo, currentWorldType), isolate, currentWorldType); 916 configureV8TestInterfaceTemplate(templ, isolate, currentWorldType);
918 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ)); 917 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v 8::FunctionTemplate>(isolate, templ));
919 return handleScope.Escape(templ); 918 return handleScope.Escape(templ);
920 } 919 }
921 920
922 bool V8TestInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is olate, WrapperWorldType currentWorldType) 921 bool V8TestInterface::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* is olate, WrapperWorldType currentWorldType)
923 { 922 {
924 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType); 923 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu e, currentWorldType);
925 } 924 }
926 925
927 bool V8TestInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::I solate* isolate) 926 bool V8TestInterface::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::I solate* isolate)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 } 981 }
983 982
984 template<> 983 template<>
985 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 984 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
986 { 985 {
987 return toV8(impl, creationContext, isolate); 986 return toV8(impl, creationContext, isolate);
988 } 987 }
989 988
990 } // namespace WebCore 989 } // namespace WebCore
991 #endif // ENABLE(Condition1) || ENABLE(Condition2) 990 #endif // ENABLE(Condition1) || ENABLE(Condition2)
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestException.cpp ('k') | Source/bindings/tests/results/V8TestInterfaceCheckSecurity.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698