| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| 6 | 6 |
| 7 // clang-format off | 7 // clang-format off |
| 8 #include "V8TestInterface5.h" | 8 #include "V8TestInterface5.h" |
| 9 | 9 |
| 10 #include "bindings/core/v8/ExceptionState.h" | 10 #include "bindings/core/v8/ExceptionState.h" |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 779 return; | 779 return; |
| 780 } | 780 } |
| 781 v8SetReturnValue(info, result); | 781 v8SetReturnValue(info, result); |
| 782 } | 782 } |
| 783 | 783 |
| 784 void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 784 void iteratorMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
| 785 { | 785 { |
| 786 TestInterface5ImplementationV8Internal::iteratorMethod(info); | 786 TestInterface5ImplementationV8Internal::iteratorMethod(info); |
| 787 } | 787 } |
| 788 | 788 |
| 789 static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCall
backInfo<v8::Value>& info) | 789 static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCall
backInfo<v8::Value>& info) { |
| 790 { | 790 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| 791 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder())
; | 791 String result = impl->anonymousNamedGetter(name); |
| 792 String result = impl->anonymousNamedGetter(name); | 792 if (result.isNull()) |
| 793 if (result.isNull()) | 793 return; |
| 794 return; | 794 v8SetReturnValueString(info, result, info.GetIsolate()); |
| 795 v8SetReturnValueString(info, result, info.GetIsolate()); | |
| 796 } | 795 } |
| 797 | 796 |
| 798 void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCal
lbackInfo<v8::Value>& info) | 797 void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCal
lbackInfo<v8::Value>& info) { |
| 799 { | 798 if (!name->IsString()) |
| 800 if (!name->IsString()) | 799 return; |
| 801 return; | 800 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); |
| 802 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>())
; | |
| 803 | 801 |
| 804 TestInterface5ImplementationV8Internal::namedPropertyGetter(propertyName, in
fo); | 802 TestInterface5ImplementationV8Internal::namedPropertyGetter(propertyName, info
); |
| 805 } | 803 } |
| 806 | 804 |
| 807 static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 805 static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 808 { | 806 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| 809 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder())
; | 807 V8StringResource<> propertyValue = v8Value; |
| 810 V8StringResource<> propertyValue = v8Value; | 808 if (!propertyValue.prepare()) |
| 811 if (!propertyValue.prepare()) | 809 return; |
| 812 return; | |
| 813 | 810 |
| 814 bool result = impl->anonymousNamedSetter(name, propertyValue); | 811 bool result = impl->anonymousNamedSetter(name, propertyValue); |
| 815 if (!result) | 812 if (!result) |
| 816 return; | 813 return; |
| 817 v8SetReturnValue(info, v8Value); | 814 v8SetReturnValue(info, v8Value); |
| 818 } | 815 } |
| 819 | 816 |
| 820 void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value>
v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | 817 void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value>
v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 821 { | 818 if (!name->IsString()) |
| 822 if (!name->IsString()) | 819 return; |
| 823 return; | 820 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); |
| 824 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>())
; | |
| 825 | 821 |
| 826 TestInterface5ImplementationV8Internal::namedPropertySetter(propertyName, v8
Value, info); | 822 TestInterface5ImplementationV8Internal::namedPropertySetter(propertyName, v8Va
lue, info); |
| 827 } | 823 } |
| 828 | 824 |
| 829 static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) | 825 static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCal
lbackInfo<v8::Boolean>& info) { |
| 830 { | 826 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| 831 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder())
; | |
| 832 | 827 |
| 833 DeleteResult result = impl->anonymousNamedDeleter(name); | 828 DeleteResult result = impl->anonymousNamedDeleter(name); |
| 834 if (result == DeleteUnknownProperty) | 829 if (result == DeleteUnknownProperty) |
| 835 return; | 830 return; |
| 836 v8SetReturnValue(info, result == DeleteSuccess); | 831 v8SetReturnValue(info, result == DeleteSuccess); |
| 837 } | 832 } |
| 838 | 833 |
| 839 void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCa
llbackInfo<v8::Boolean>& info) | 834 void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCa
llbackInfo<v8::Boolean>& info) { |
| 840 { | 835 if (!name->IsString()) |
| 841 if (!name->IsString()) | 836 return; |
| 842 return; | 837 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); |
| 843 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>())
; | |
| 844 | 838 |
| 845 TestInterface5ImplementationV8Internal::namedPropertyDeleter(propertyName, i
nfo); | 839 TestInterface5ImplementationV8Internal::namedPropertyDeleter(propertyName, inf
o); |
| 846 } | 840 } |
| 847 | 841 |
| 848 static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallb
ackInfo<v8::Integer>& info) | 842 static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallb
ackInfo<v8::Integer>& info) { |
| 849 { | 843 const CString& nameInUtf8 = name.utf8(); |
| 850 const CString& nameInUtf8 = name.utf8(); | 844 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext
, "TestInterface5", nameInUtf8.data()); |
| 851 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterConte
xt, "TestInterface5", nameInUtf8.data()); | |
| 852 | 845 |
| 853 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder())
; | 846 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| 854 | 847 |
| 855 bool result = impl->namedPropertyQuery(name, exceptionState); | 848 bool result = impl->namedPropertyQuery(name, exceptionState); |
| 856 if (!result) | 849 if (!result) |
| 857 return; | 850 return; |
| 858 v8SetReturnValueInt(info, v8::None); | 851 v8SetReturnValueInt(info, v8::None); |
| 859 } | 852 } |
| 860 | 853 |
| 861 void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCall
backInfo<v8::Integer>& info) | 854 void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCall
backInfo<v8::Integer>& info) { |
| 862 { | 855 if (!name->IsString()) |
| 863 if (!name->IsString()) | 856 return; |
| 864 return; | 857 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>()); |
| 865 const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>())
; | |
| 866 | 858 |
| 867 TestInterface5ImplementationV8Internal::namedPropertyQuery(propertyName, inf
o); | 859 TestInterface5ImplementationV8Internal::namedPropertyQuery(propertyName, info)
; |
| 868 } | 860 } |
| 869 | 861 |
| 870 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | 862 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) { |
| 871 { | 863 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::EnumerationCo
ntext, "TestInterface5"); |
| 872 ExceptionState exceptionState(info.GetIsolate(), ExceptionState::Enumeration
Context, "TestInterface5"); | |
| 873 | 864 |
| 874 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder())
; | 865 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| 875 | 866 |
| 876 Vector<String> names; | 867 Vector<String> names; |
| 877 impl->namedPropertyEnumerator(names, exceptionState); | 868 impl->namedPropertyEnumerator(names, exceptionState); |
| 878 if (exceptionState.hadException()) | 869 if (exceptionState.hadException()) |
| 879 return; | 870 return; |
| 880 v8SetReturnValue(info, toV8(names, info.Holder(), info.GetIsolate()).As<v8::
Array>()); | 871 v8SetReturnValue(info, toV8(names, info.Holder(), info.GetIsolate()).As<v8::Ar
ray>()); |
| 881 } | 872 } |
| 882 | 873 |
| 883 void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>&
info) | 874 void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>&
info) { |
| 884 { | 875 TestInterface5ImplementationV8Internal::namedPropertyEnumerator(info); |
| 885 TestInterface5ImplementationV8Internal::namedPropertyEnumerator(info); | |
| 886 } | 876 } |
| 887 | 877 |
| 888 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | 878 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) { |
| 889 { | 879 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| 890 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder())
; | |
| 891 | 880 |
| 892 // We assume that all the implementations support length() method, although | 881 // We assume that all the implementations support length() method, although |
| 893 // the spec doesn't require that length() must exist. It's okay that | 882 // the spec doesn't require that length() must exist. It's okay that |
| 894 // the interface does not have length attribute as long as the | 883 // the interface does not have length attribute as long as the |
| 895 // implementation supports length() member function. | 884 // implementation supports length() member function. |
| 896 if (index >= impl->length()) | 885 if (index >= impl->length()) |
| 897 return; // Returns undefined due to out-of-range. | 886 return; // Returns undefined due to out-of-range. |
| 898 | 887 |
| 899 String result = impl->anonymousIndexedGetter(index); | 888 String result = impl->anonymousIndexedGetter(index); |
| 900 v8SetReturnValueString(info, result, info.GetIsolate()); | 889 v8SetReturnValueString(info, result, info.GetIsolate()); |
| 901 } | 890 } |
| 902 | 891 |
| 903 void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInf
o<v8::Value>& info) | 892 void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInf
o<v8::Value>& info) { |
| 904 { | 893 TestInterface5ImplementationV8Internal::indexedPropertyGetter(index, info); |
| 905 TestInterface5ImplementationV8Internal::indexedPropertyGetter(index, info); | |
| 906 } | 894 } |
| 907 | 895 |
| 908 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value,
const v8::PropertyCallbackInfo<v8::Value>& info) | 896 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value,
const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 909 { | 897 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| 910 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder())
; | 898 V8StringResource<> propertyValue = v8Value; |
| 911 V8StringResource<> propertyValue = v8Value; | 899 if (!propertyValue.prepare()) |
| 912 if (!propertyValue.prepare()) | 900 return; |
| 913 return; | |
| 914 | 901 |
| 915 bool result = impl->anonymousIndexedSetter(index, propertyValue); | 902 bool result = impl->anonymousIndexedSetter(index, propertyValue); |
| 916 if (!result) | 903 if (!result) |
| 917 return; | 904 return; |
| 918 v8SetReturnValue(info, v8Value); | 905 v8SetReturnValue(info, v8Value); |
| 919 } | 906 } |
| 920 | 907 |
| 921 void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value,
const v8::PropertyCallbackInfo<v8::Value>& info) | 908 void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value,
const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 922 { | 909 TestInterface5ImplementationV8Internal::indexedPropertySetter(index, v8Value,
info); |
| 923 TestInterface5ImplementationV8Internal::indexedPropertySetter(index, v8Value
, info); | |
| 924 } | 910 } |
| 925 | 911 |
| 926 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf
o<v8::Boolean>& info) | 912 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf
o<v8::Boolean>& info) { |
| 927 { | 913 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder()); |
| 928 TestInterface5Implementation* impl = V8TestInterface5::toImpl(info.Holder())
; | |
| 929 | 914 |
| 930 DeleteResult result = impl->anonymousIndexedDeleter(index); | 915 DeleteResult result = impl->anonymousIndexedDeleter(index); |
| 931 if (result == DeleteUnknownProperty) | 916 if (result == DeleteUnknownProperty) |
| 932 return; | 917 return; |
| 933 v8SetReturnValue(info, result == DeleteSuccess); | 918 v8SetReturnValue(info, result == DeleteSuccess); |
| 934 } | 919 } |
| 935 | 920 |
| 936 void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackIn
fo<v8::Boolean>& info) | 921 void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackIn
fo<v8::Boolean>& info) { |
| 937 { | 922 TestInterface5ImplementationV8Internal::indexedPropertyDeleter(index, info); |
| 938 TestInterface5ImplementationV8Internal::indexedPropertyDeleter(index, info); | |
| 939 } | 923 } |
| 940 | 924 |
| 941 } // namespace TestInterface5ImplementationV8Internal | 925 } // namespace TestInterface5ImplementationV8Internal |
| 942 | 926 |
| 943 void V8TestInterface5::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* sc
riptWrappable, const v8::Persistent<v8::Object>& wrapper) | 927 void V8TestInterface5::visitDOMWrapper(v8::Isolate* isolate, ScriptWrappable* sc
riptWrappable, const v8::Persistent<v8::Object>& wrapper) { |
| 944 { | 928 TestInterface5Implementation* impl = scriptWrappable->toImpl<TestInterface5Imp
lementation>(); |
| 945 TestInterface5Implementation* impl = scriptWrappable->toImpl<TestInterface5I
mplementation>(); | 929 TestInterface5Implementation* referencedName = impl->referencedName(); |
| 946 TestInterface5Implementation* referencedName = impl->referencedName(); | 930 if (referencedName) { |
| 947 if (referencedName) { | 931 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, referencedName, is
olate); |
| 948 DOMWrapperWorld::setWrapperReferencesInAllWorlds(wrapper, referencedName
, isolate); | 932 } |
| 949 } | |
| 950 } | 933 } |
| 951 | 934 |
| 952 // Suppress warning: global constructors, because AttributeConfiguration is triv
ial | 935 // Suppress warning: global constructors, because AttributeConfiguration is triv
ial |
| 953 // and does not depend on another global objects. | 936 // and does not depend on another global objects. |
| 954 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) | 937 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG) |
| 955 #pragma clang diagnostic push | 938 #pragma clang diagnostic push |
| 956 #pragma clang diagnostic ignored "-Wglobal-constructors" | 939 #pragma clang diagnostic ignored "-Wglobal-constructors" |
| 957 #endif | 940 #endif |
| 958 const V8DOMConfiguration::AttributeConfiguration V8TestInterface5Attributes[] =
{ | 941 const V8DOMConfiguration::AttributeConfiguration V8TestInterface5Attributes[] =
{ |
| 959 {"testInterfaceConstructorAttribute", v8ConstructorAttributeGetter, 0, 0, 0,
const_cast<WrapperTypeInfo*>(&V8TestInterface5::wrapperTypeInfo), static_cast<v
8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum)
, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOM
Configuration::CheckHolder}, | 942 {"testInterfaceConstructorAttribute", v8ConstructorAttributeGetter, 0, 0, 0,
const_cast<WrapperTypeInfo*>(&V8TestInterface5::wrapperTypeInfo), static_cast<v
8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::DontEnum)
, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance, V8DOM
Configuration::CheckHolder}, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 983 {"voidMethodDoubleOrDOMStringArg", TestInterface5ImplementationV8Internal::v
oidMethodDoubleOrDOMStringArgMethodCallback, 0, 1, v8::None, V8DOMConfiguration:
:ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, | 966 {"voidMethodDoubleOrDOMStringArg", TestInterface5ImplementationV8Internal::v
oidMethodDoubleOrDOMStringArgMethodCallback, 0, 1, v8::None, V8DOMConfiguration:
:ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| 984 {"voidMethodVoidExperimentalCallbackFunction", TestInterface5ImplementationV
8Internal::voidMethodVoidExperimentalCallbackFunctionMethodCallback, 0, 1, v8::N
one, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, | 967 {"voidMethodVoidExperimentalCallbackFunction", TestInterface5ImplementationV
8Internal::voidMethodVoidExperimentalCallbackFunctionMethodCallback, 0, 1, v8::N
one, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| 985 {"voidMethodVoidCallbackFunctionModulesArg", TestInterface5ImplementationV8I
nternal::voidMethodVoidCallbackFunctionModulesArgMethodCallback, 0, 1, v8::None,
V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, | 968 {"voidMethodVoidCallbackFunctionModulesArg", TestInterface5ImplementationV8I
nternal::voidMethodVoidCallbackFunctionModulesArgMethodCallback, 0, 1, v8::None,
V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| 986 {"keys", TestInterface5ImplementationV8Internal::keysMethodCallback, 0, 0, v
8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototyp
e}, | 969 {"keys", TestInterface5ImplementationV8Internal::keysMethodCallback, 0, 0, v
8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototyp
e}, |
| 987 {"values", TestInterface5ImplementationV8Internal::valuesMethodCallback, 0,
0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnProt
otype}, | 970 {"values", TestInterface5ImplementationV8Internal::valuesMethodCallback, 0,
0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnProt
otype}, |
| 988 {"entries", TestInterface5ImplementationV8Internal::entriesMethodCallback, 0
, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPr
ototype}, | 971 {"entries", TestInterface5ImplementationV8Internal::entriesMethodCallback, 0
, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPr
ototype}, |
| 989 {"forEach", TestInterface5ImplementationV8Internal::forEachMethodCallback, 0
, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPr
ototype}, | 972 {"forEach", TestInterface5ImplementationV8Internal::forEachMethodCallback, 0
, 1, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPr
ototype}, |
| 990 {"toString", TestInterface5ImplementationV8Internal::toStringMethodCallback,
0, 0, static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::Exp
osedToAllScripts, V8DOMConfiguration::OnPrototype}, | 973 {"toString", TestInterface5ImplementationV8Internal::toStringMethodCallback,
0, 0, static_cast<v8::PropertyAttribute>(v8::DontEnum), V8DOMConfiguration::Exp
osedToAllScripts, V8DOMConfiguration::OnPrototype}, |
| 991 }; | 974 }; |
| 992 | 975 |
| 993 static void installV8TestInterface5Template(v8::Isolate* isolate, const DOMWrapp
erWorld& world, v8::Local<v8::FunctionTemplate> interfaceTemplate) | 976 static void installV8TestInterface5Template(v8::Isolate* isolate, const DOMWrapp
erWorld& world, v8::Local<v8::FunctionTemplate> interfaceTemplate) { |
| 994 { | 977 // Initialize the interface object's template. |
| 995 // Initialize the interface object's template. | 978 V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplate,
V8TestInterface5::wrapperTypeInfo.interfaceName, V8TestInterfaceEmpty::domTempl
ate(isolate, world), V8TestInterface5::internalFieldCount); |
| 996 V8DOMConfiguration::initializeDOMInterfaceTemplate(isolate, interfaceTemplat
e, V8TestInterface5::wrapperTypeInfo.interfaceName, V8TestInterfaceEmpty::domTem
plate(isolate, world), V8TestInterface5::internalFieldCount); | 979 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp
late); |
| 997 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTe
mplate); | 980 ALLOW_UNUSED_LOCAL(signature); |
| 998 ALLOW_UNUSED_LOCAL(signature); | 981 v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->InstanceTe
mplate(); |
| 999 v8::Local<v8::ObjectTemplate> instanceTemplate = interfaceTemplate->Instance
Template(); | 982 ALLOW_UNUSED_LOCAL(instanceTemplate); |
| 1000 ALLOW_UNUSED_LOCAL(instanceTemplate); | 983 v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->Prototype
Template(); |
| 1001 v8::Local<v8::ObjectTemplate> prototypeTemplate = interfaceTemplate->Prototy
peTemplate(); | 984 ALLOW_UNUSED_LOCAL(prototypeTemplate); |
| 1002 ALLOW_UNUSED_LOCAL(prototypeTemplate); | 985 // Register DOM constants, attributes and operations. |
| 1003 // Register DOM constants, attributes and operations. | 986 if (RuntimeEnabledFeatures::featureNameEnabled()) { |
| 1004 if (RuntimeEnabledFeatures::featureNameEnabled()) { | 987 const V8DOMConfiguration::ConstantConfiguration V8TestInterface5Constants[
] = { |
| 1005 const V8DOMConfiguration::ConstantConfiguration V8TestInterface5Constant
s[] = { | 988 {"UNSIGNED_LONG", 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong}, |
| 1006 {"UNSIGNED_LONG", 0, 0, V8DOMConfiguration::ConstantTypeUnsignedLong
}, | 989 {"CONST_JAVASCRIPT", 1, 0, V8DOMConfiguration::ConstantTypeShort}, |
| 1007 {"CONST_JAVASCRIPT", 1, 0, V8DOMConfiguration::ConstantTypeShort}, | 990 }; |
| 1008 }; | 991 V8DOMConfiguration::installConstants(isolate, interfaceTemplate, prototype
Template, V8TestInterface5Constants, WTF_ARRAY_LENGTH(V8TestInterface5Constants)
); |
| 1009 V8DOMConfiguration::installConstants(isolate, interfaceTemplate, prototy
peTemplate, V8TestInterface5Constants, WTF_ARRAY_LENGTH(V8TestInterface5Constant
s)); | 992 V8DOMConfiguration::installAttributes(isolate, world, instanceTemplate, pr
ototypeTemplate, V8TestInterface5Attributes, WTF_ARRAY_LENGTH(V8TestInterface5At
tributes)); |
| 1010 V8DOMConfiguration::installAttributes(isolate, world, instanceTemplate,
prototypeTemplate, V8TestInterface5Attributes, WTF_ARRAY_LENGTH(V8TestInterface5
Attributes)); | 993 V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, pro
totypeTemplate, interfaceTemplate, signature, V8TestInterface5Accessors, WTF_ARR
AY_LENGTH(V8TestInterface5Accessors)); |
| 1011 V8DOMConfiguration::installAccessors(isolate, world, instanceTemplate, p
rototypeTemplate, interfaceTemplate, signature, V8TestInterface5Accessors, WTF_A
RRAY_LENGTH(V8TestInterface5Accessors)); | 994 V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, proto
typeTemplate, interfaceTemplate, signature, V8TestInterface5Methods, WTF_ARRAY_L
ENGTH(V8TestInterface5Methods)); |
| 1012 V8DOMConfiguration::installMethods(isolate, world, instanceTemplate, pro
totypeTemplate, interfaceTemplate, signature, V8TestInterface5Methods, WTF_ARRAY
_LENGTH(V8TestInterface5Methods)); | 995 } |
| 1013 } | |
| 1014 | 996 |
| 1015 // Indexed properties | 997 // Indexed properties |
| 1016 v8::IndexedPropertyHandlerConfiguration indexedPropertyHandlerConfig(TestInt
erface5ImplementationV8Internal::indexedPropertyGetterCallback, TestInterface5Im
plementationV8Internal::indexedPropertySetterCallback, 0, TestInterface5Implemen
tationV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<Test
Interface5Implementation>, v8::Local<v8::Value>(), v8::PropertyHandlerFlags::kNo
ne); | 998 v8::IndexedPropertyHandlerConfiguration indexedPropertyHandlerConfig(TestInter
face5ImplementationV8Internal::indexedPropertyGetterCallback, TestInterface5Impl
ementationV8Internal::indexedPropertySetterCallback, 0, TestInterface5Implementa
tionV8Internal::indexedPropertyDeleterCallback, indexedPropertyEnumerator<TestIn
terface5Implementation>, v8::Local<v8::Value>(), v8::PropertyHandlerFlags::kNone
); |
| 1017 instanceTemplate->SetHandler(indexedPropertyHandlerConfig); | 999 instanceTemplate->SetHandler(indexedPropertyHandlerConfig); |
| 1018 // Named properties | 1000 // Named properties |
| 1019 v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig(TestInterfa
ce5ImplementationV8Internal::namedPropertyGetterCallback, TestInterface5Implemen
tationV8Internal::namedPropertySetterCallback, TestInterface5ImplementationV8Int
ernal::namedPropertyQueryCallback, TestInterface5ImplementationV8Internal::named
PropertyDeleterCallback, TestInterface5ImplementationV8Internal::namedPropertyEn
umeratorCallback, v8::Local<v8::Value>(), static_cast<v8::PropertyHandlerFlags>(
int(v8::PropertyHandlerFlags::kOnlyInterceptStrings) | int(v8::PropertyHandlerFl
ags::kNonMasking))); | 1001 v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig(TestInterface
5ImplementationV8Internal::namedPropertyGetterCallback, TestInterface5Implementa
tionV8Internal::namedPropertySetterCallback, TestInterface5ImplementationV8Inter
nal::namedPropertyQueryCallback, TestInterface5ImplementationV8Internal::namedPr
opertyDeleterCallback, TestInterface5ImplementationV8Internal::namedPropertyEnum
eratorCallback, v8::Local<v8::Value>(), static_cast<v8::PropertyHandlerFlags>(in
t(v8::PropertyHandlerFlags::kOnlyInterceptStrings) | int(v8::PropertyHandlerFlag
s::kNonMasking))); |
| 1020 instanceTemplate->SetHandler(namedPropertyHandlerConfig); | 1002 instanceTemplate->SetHandler(namedPropertyHandlerConfig); |
| 1021 | 1003 |
| 1022 // Iterator (@@iterator) | 1004 // Iterator (@@iterator) |
| 1023 const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIterator
Configuration = { v8::Symbol::GetIterator, TestInterface5ImplementationV8Interna
l::iteratorMethodCallback, 0, v8::DontEnum, V8DOMConfiguration::ExposedToAllScri
pts, V8DOMConfiguration::OnPrototype }; | 1005 const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorCo
nfiguration = { v8::Symbol::GetIterator, TestInterface5ImplementationV8Internal:
:iteratorMethodCallback, 0, v8::DontEnum, V8DOMConfiguration::ExposedToAllScript
s, V8DOMConfiguration::OnPrototype }; |
| 1024 V8DOMConfiguration::installMethod(isolate, world, prototypeTemplate, signatu
re, symbolKeyedIteratorConfiguration); | 1006 V8DOMConfiguration::installMethod(isolate, world, prototypeTemplate, signature
, symbolKeyedIteratorConfiguration); |
| 1025 | 1007 |
| 1026 instanceTemplate->SetCallAsFunctionHandler(V8TestInterface5::legacyCallCusto
m); | 1008 instanceTemplate->SetCallAsFunctionHandler(V8TestInterface5::legacyCallCustom)
; |
| 1027 } | 1009 } |
| 1028 | 1010 |
| 1029 v8::Local<v8::FunctionTemplate> V8TestInterface5::domTemplate(v8::Isolate* isola
te, const DOMWrapperWorld& world) | 1011 v8::Local<v8::FunctionTemplate> V8TestInterface5::domTemplate(v8::Isolate* isola
te, const DOMWrapperWorld& world) { |
| 1030 { | 1012 return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<Wrapper
TypeInfo*>(&wrapperTypeInfo), installV8TestInterface5Template); |
| 1031 return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<Wrapp
erTypeInfo*>(&wrapperTypeInfo), installV8TestInterface5Template); | |
| 1032 } | 1013 } |
| 1033 | 1014 |
| 1034 bool V8TestInterface5::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* is
olate) | 1015 bool V8TestInterface5::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* is
olate) { |
| 1035 { | 1016 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value)
; |
| 1036 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
| 1037 } | 1017 } |
| 1038 | 1018 |
| 1039 v8::Local<v8::Object> V8TestInterface5::findInstanceInPrototypeChain(v8::Local<v
8::Value> v8Value, v8::Isolate* isolate) | 1019 v8::Local<v8::Object> V8TestInterface5::findInstanceInPrototypeChain(v8::Local<v
8::Value> v8Value, v8::Isolate* isolate) { |
| 1040 { | 1020 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperT
ypeInfo, v8Value); |
| 1041 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
| 1042 } | 1021 } |
| 1043 | 1022 |
| 1044 TestInterface5Implementation* V8TestInterface5::toImplWithTypeCheck(v8::Isolate*
isolate, v8::Local<v8::Value> value) | 1023 TestInterface5Implementation* V8TestInterface5::toImplWithTypeCheck(v8::Isolate*
isolate, v8::Local<v8::Value> value) { |
| 1045 { | 1024 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(value)
) : nullptr; |
| 1046 return hasInstance(value, isolate) ? toImpl(v8::Local<v8::Object>::Cast(valu
e)) : nullptr; | |
| 1047 } | 1025 } |
| 1048 | 1026 |
| 1049 void V8TestInterface5::preparePrototypeAndInterfaceObject(v8::Local<v8::Context>
context, const DOMWrapperWorld& world, v8::Local<v8::Object> prototypeObject, v
8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfac
eTemplate) | 1027 void V8TestInterface5::preparePrototypeAndInterfaceObject(v8::Local<v8::Context>
context, const DOMWrapperWorld& world, v8::Local<v8::Object> prototypeObject, v
8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfac
eTemplate) { |
| 1050 { | 1028 v8::Isolate* isolate = context->GetIsolate(); |
| 1051 v8::Isolate* isolate = context->GetIsolate(); | 1029 ExecutionContext* executionContext = toExecutionContext(context); |
| 1052 ExecutionContext* executionContext = toExecutionContext(context); | 1030 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp
late); |
| 1053 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTe
mplate); | 1031 if (executionContext && (executionContext->isWorkerGlobalScope())) { |
| 1054 if (executionContext && (executionContext->isWorkerGlobalScope())) { | 1032 const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {"
workerExposedAttribute", TestInterface5ImplementationV8Internal::workerExposedAt
tributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::workerEx
posedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::Pro
pertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfigu
ration::OnPrototype, V8DOMConfiguration::CheckHolder}; |
| 1055 const V8DOMConfiguration::AccessorConfiguration accessorConfiguration =
{"workerExposedAttribute", TestInterface5ImplementationV8Internal::workerExposed
AttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::worker
ExposedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::P
ropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfi
guration::OnPrototype, V8DOMConfiguration::CheckHolder}; | 1033 V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(
), prototypeObject, interfaceObject, signature, accessorConfiguration); |
| 1056 V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object
>(), prototypeObject, interfaceObject, signature, accessorConfiguration); | 1034 } |
| 1057 } | 1035 if (executionContext && (executionContext->isDocument())) { |
| 1058 if (executionContext && (executionContext->isDocument())) { | 1036 const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {"
windowExposedAttribute", TestInterface5ImplementationV8Internal::windowExposedAt
tributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::windowEx
posedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::Pro
pertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfigu
ration::OnPrototype, V8DOMConfiguration::CheckHolder}; |
| 1059 const V8DOMConfiguration::AccessorConfiguration accessorConfiguration =
{"windowExposedAttribute", TestInterface5ImplementationV8Internal::windowExposed
AttributeAttributeGetterCallback, TestInterface5ImplementationV8Internal::window
ExposedAttributeAttributeSetterCallback, 0, 0, 0, v8::DEFAULT, static_cast<v8::P
ropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfi
guration::OnPrototype, V8DOMConfiguration::CheckHolder}; | 1037 V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(
), prototypeObject, interfaceObject, signature, accessorConfiguration); |
| 1060 V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object
>(), prototypeObject, interfaceObject, signature, accessorConfiguration); | 1038 } |
| 1061 } | 1039 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemp
late); |
| 1062 v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTe
mplate); | 1040 ExecutionContext* executionContext = toExecutionContext(prototypeObject->Creat
ionContext()); |
| 1063 ExecutionContext* executionContext = toExecutionContext(prototypeObject->Cre
ationContext()); | 1041 ASSERT(executionContext); |
| 1064 ASSERT(executionContext); | 1042 if (executionContext && (executionContext->isWorkerGlobalScope())) { |
| 1065 if (executionContext && (executionContext->isWorkerGlobalScope())) { | 1043 const V8DOMConfiguration::MethodConfiguration workerExposedMethodMethodCon
figuration = {"workerExposedMethod", TestInterface5ImplementationV8Internal::wor
kerExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAll
Scripts, V8DOMConfiguration::OnPrototype}; |
| 1066 const V8DOMConfiguration::MethodConfiguration workerExposedMethodMethodC
onfiguration = {"workerExposedMethod", TestInterface5ImplementationV8Internal::w
orkerExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToA
llScripts, V8DOMConfiguration::OnPrototype}; | 1044 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(),
prototypeObject, interfaceObject, signature, workerExposedMethodMethodConfigura
tion); |
| 1067 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(
), prototypeObject, interfaceObject, signature, workerExposedMethodMethodConfigu
ration); | 1045 } |
| 1068 } | 1046 if (executionContext && (executionContext->isDocument())) { |
| 1069 if (executionContext && (executionContext->isDocument())) { | 1047 const V8DOMConfiguration::MethodConfiguration windowExposedMethodMethodCon
figuration = {"windowExposedMethod", TestInterface5ImplementationV8Internal::win
dowExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToAll
Scripts, V8DOMConfiguration::OnPrototype}; |
| 1070 const V8DOMConfiguration::MethodConfiguration windowExposedMethodMethodC
onfiguration = {"windowExposedMethod", TestInterface5ImplementationV8Internal::w
indowExposedMethodMethodCallback, 0, 0, v8::None, V8DOMConfiguration::ExposedToA
llScripts, V8DOMConfiguration::OnPrototype}; | 1048 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(),
prototypeObject, interfaceObject, signature, windowExposedMethodMethodConfigura
tion); |
| 1071 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(
), prototypeObject, interfaceObject, signature, windowExposedMethodMethodConfigu
ration); | 1049 } |
| 1072 } | 1050 if (executionContext && (executionContext->isWorkerGlobalScope())) { |
| 1073 if (executionContext && (executionContext->isWorkerGlobalScope())) { | 1051 const V8DOMConfiguration::MethodConfiguration workerExposedStaticMethodMet
hodConfiguration = {"workerExposedStaticMethod", TestInterface5ImplementationV8I
nternal::workerExposedStaticMethodMethodCallback, 0, 0, v8::None, V8DOMConfigura
tion::ExposedToAllScripts, V8DOMConfiguration::OnInterface}; |
| 1074 const V8DOMConfiguration::MethodConfiguration workerExposedStaticMethodM
ethodConfiguration = {"workerExposedStaticMethod", TestInterface5ImplementationV
8Internal::workerExposedStaticMethodMethodCallback, 0, 0, v8::None, V8DOMConfigu
ration::ExposedToAllScripts, V8DOMConfiguration::OnInterface}; | 1052 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(),
prototypeObject, interfaceObject, signature, workerExposedStaticMethodMethodCon
figuration); |
| 1075 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(
), prototypeObject, interfaceObject, signature, workerExposedStaticMethodMethodC
onfiguration); | 1053 } |
| 1076 } | 1054 if (executionContext && (executionContext->isDocument())) { |
| 1077 if (executionContext && (executionContext->isDocument())) { | 1055 const V8DOMConfiguration::MethodConfiguration windowExposedStaticMethodMet
hodConfiguration = {"windowExposedStaticMethod", TestInterface5ImplementationV8I
nternal::windowExposedStaticMethodMethodCallback, 0, 0, v8::None, V8DOMConfigura
tion::ExposedToAllScripts, V8DOMConfiguration::OnInterface}; |
| 1078 const V8DOMConfiguration::MethodConfiguration windowExposedStaticMethodM
ethodConfiguration = {"windowExposedStaticMethod", TestInterface5ImplementationV
8Internal::windowExposedStaticMethodMethodCallback, 0, 0, v8::None, V8DOMConfigu
ration::ExposedToAllScripts, V8DOMConfiguration::OnInterface}; | 1056 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(),
prototypeObject, interfaceObject, signature, windowExposedStaticMethodMethodCon
figuration); |
| 1079 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(
), prototypeObject, interfaceObject, signature, windowExposedStaticMethodMethodC
onfiguration); | 1057 } |
| 1080 } | 1058 if (executionContext && (executionContext->isDocument() || executionContext->i
sServiceWorkerGlobalScope())) { |
| 1081 if (executionContext && (executionContext->isDocument() || executionContext-
>isServiceWorkerGlobalScope())) { | 1059 const V8DOMConfiguration::MethodConfiguration windowAndServiceWorkerExpose
dMethodMethodConfiguration = {"windowAndServiceWorkerExposedMethod", TestInterfa
ce5ImplementationV8Internal::windowAndServiceWorkerExposedMethodMethodCallback,
0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnP
rototype}; |
| 1082 const V8DOMConfiguration::MethodConfiguration windowAndServiceWorkerExpo
sedMethodMethodConfiguration = {"windowAndServiceWorkerExposedMethod", TestInter
face5ImplementationV8Internal::windowAndServiceWorkerExposedMethodMethodCallback
, 0, 0, v8::None, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::O
nPrototype}; | 1060 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(),
prototypeObject, interfaceObject, signature, windowAndServiceWorkerExposedMetho
dMethodConfiguration); |
| 1083 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(
), prototypeObject, interfaceObject, signature, windowAndServiceWorkerExposedMet
hodMethodConfiguration); | 1061 } |
| 1084 } | |
| 1085 } | 1062 } |
| 1086 | 1063 |
| 1087 } // namespace blink | 1064 } // namespace blink |
| OLD | NEW |