| Index: third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
|
| diff --git a/third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
|
| index e840b30e4d2e371a0a757ef362698e425b79a28d..289ea7ebb4aca137de40131adcd5010ace36367c 100644
|
| --- a/third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
|
| +++ b/third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
|
| @@ -6,7 +6,7 @@
|
| {% set getter = indexed_property_getter %}
|
| static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| {% if getter.is_raises_exception %}
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedGetterContext, "{{interface_name}}");
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kIndexedGetterContext, "{{interface_name}}");
|
| {% endif %}
|
|
|
| {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| @@ -18,10 +18,10 @@ static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
|
| if (index >= impl->length())
|
| return; // Returns undefined due to out-of-range.
|
|
|
| - {% set getter_name = getter.name or 'anonymousIndexedGetter' %}
|
| + {% set getter_name = getter.name or 'AnonymousIndexedGetter' %}
|
| {% set getter_arguments = ['index'] %}
|
| {% if getter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + ScriptState* scriptState = ScriptState::ForReceiverObject(info);
|
| {% set getter_arguments = ['scriptState'] + getter_arguments %}
|
| {% endif %}
|
| {% if getter.is_raises_exception %}
|
| @@ -50,7 +50,7 @@ void {{v8_class_or_partial}}::indexedPropertyGetterCallback(uint32_t index, cons
|
|
|
| {% else %}{# otherwise, named property #}
|
|
|
| - const AtomicString& propertyName = AtomicString::number(index);
|
| + const AtomicString& propertyName = AtomicString::Number(index);
|
|
|
| {% if getter.is_custom %}
|
| {{v8_class}}::namedPropertyGetterCustom(propertyName, info);
|
| @@ -72,7 +72,7 @@ void {{v8_class_or_partial}}::indexedPropertyGetterCallback(uint32_t index, cons
|
| {% set setter = indexed_property_setter %}
|
| static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| {% if setter.has_exception_state %}
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedSetterContext, "{{interface_name}}");
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kIndexedSetterContext, "{{interface_name}}");
|
| {% endif %}
|
|
|
| {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| @@ -80,16 +80,16 @@ static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value,
|
| {% if setter.has_type_checking_interface %}
|
| {# Type checking for interface types (if interface not implemented, throw
|
| TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
|
| - if (!propertyValue{% if setter.is_nullable %} && !isUndefinedOrNull(v8Value){% endif %}) {
|
| - exceptionState.throwTypeError("The provided value is not of type '{{setter.idl_type}}'.");
|
| + if (!propertyValue{% if setter.is_nullable %} && !IsUndefinedOrNull(v8Value){% endif %}) {
|
| + exceptionState.ThrowTypeError("The provided value is not of type '{{setter.idl_type}}'.");
|
| return;
|
| }
|
| {% endif %}
|
|
|
| - {% set setter_name = setter.name or 'anonymousIndexedSetter' %}
|
| + {% set setter_name = setter.name or 'AnonymousIndexedSetter' %}
|
| {% set setter_arguments = ['index', 'propertyValue'] %}
|
| {% if setter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + ScriptState* scriptState = ScriptState::ForReceiverObject(info);
|
| {% set setter_arguments = ['scriptState'] + setter_arguments %}
|
| {% endif %}
|
| {% if setter.is_raises_exception %}
|
| @@ -97,12 +97,12 @@ static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value,
|
| {% endif %}
|
| bool result = impl->{{setter_name}}({{setter_arguments | join(', ')}});
|
| {% if setter.is_raises_exception %}
|
| - if (exceptionState.hadException())
|
| + if (exceptionState.HadException())
|
| return;
|
| {% endif %}
|
| if (!result)
|
| return;
|
| - v8SetReturnValue(info, v8Value);
|
| + V8SetReturnValue(info, v8Value);
|
| }
|
|
|
| {% endif %}
|
| @@ -128,7 +128,7 @@ void {{v8_class_or_partial}}::indexedPropertySetterCallback(uint32_t index, v8::
|
|
|
| {% else %}{# otherwise, named property #}
|
|
|
| - const AtomicString& propertyName = AtomicString::number(index);
|
| + const AtomicString& propertyName = AtomicString::Number(index);
|
|
|
| {% if setter.is_custom %}
|
| {{v8_class}}::namedPropertySetterCustom(propertyName, v8Value, info);
|
| @@ -149,15 +149,15 @@ void {{v8_class_or_partial}}::indexedPropertySetterCallback(uint32_t index, v8::
|
| {% set deleter = indexed_property_deleter %}
|
| static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
| {% if deleter.is_raises_exception %}
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::IndexedDeletionContext, "{{interface_name}}");
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kIndexedDeletionContext, "{{interface_name}}");
|
| {% endif %}
|
|
|
| {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
|
|
| - {% set deleter_name = deleter.name or 'anonymousIndexedDeleter' %}
|
| + {% set deleter_name = deleter.name or 'AnonymousIndexedDeleter' %}
|
| {% set deleter_arguments = ['index'] %}
|
| {% if deleter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + ScriptState* scriptState = ScriptState::ForReceiverObject(info);
|
| {% set deleter_arguments = ['scriptState'] + deleter_arguments %}
|
| {% endif %}
|
| {% if deleter.is_raises_exception %}
|
| @@ -165,12 +165,12 @@ static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf
|
| {% endif %}
|
| DeleteResult result = impl->{{deleter_name}}({{deleter_arguments | join(', ')}});
|
| {% if deleter.is_raises_exception %}
|
| - if (exceptionState.hadException())
|
| + if (exceptionState.HadException())
|
| return;
|
| {% endif %}
|
| - if (result == DeleteUnknownProperty)
|
| + if (result == kDeleteUnknownProperty)
|
| return;
|
| - v8SetReturnValue(info, result == DeleteSuccess);
|
| + V8SetReturnValue(info, result == kDeleteSuccess);
|
| }
|
|
|
| {% endif %}
|
| @@ -196,7 +196,7 @@ void {{v8_class_or_partial}}::indexedPropertyDeleterCallback(uint32_t index, con
|
|
|
| {% else %}{# otherwise, named property #}
|
|
|
| - const AtomicString& propertyName = AtomicString::number(index);
|
| + const AtomicString& propertyName = AtomicString::Number(index);
|
|
|
| {% if deleter.is_custom %}
|
| {{v8_class}}::namedPropertyDeleterCustom(propertyName, info);
|
| @@ -217,11 +217,11 @@ void {{v8_class_or_partial}}::indexedPropertyDeleterCallback(uint32_t index, con
|
| {% set getter = named_property_getter %}
|
| static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| {% if getter.is_raises_exception %}
|
| - const CString& nameInUtf8 = name.utf8();
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext, "{{interface_name}}", nameInUtf8.data());
|
| + const CString& nameInUtf8 = name.Utf8();
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kGetterContext, "{{interface_name}}", nameInUtf8.Data());
|
| {% endif %}
|
| {% if getter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + ScriptState* scriptState = ScriptState::ForReceiverObject(info);
|
| {% endif %}
|
|
|
| {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| @@ -247,7 +247,7 @@ static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCall
|
| void {{v8_class_or_partial}}::namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| if (!name->IsString())
|
| return;
|
| - const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
| + const AtomicString& propertyName = ToCoreAtomicString(name.As<v8::String>());
|
|
|
| {% if getter.is_custom %}
|
| {{v8_class}}::namedPropertyGetterCustom(propertyName, info);
|
| @@ -267,11 +267,11 @@ void {{v8_class_or_partial}}::namedPropertyGetterCallback(v8::Local<v8::Name> na
|
| {% set setter = named_property_setter %}
|
| static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| {% if setter.has_exception_state %}
|
| - const CString& nameInUtf8 = name.utf8();
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "{{interface_name}}", nameInUtf8.data());
|
| + const CString& nameInUtf8 = name.Utf8();
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kSetterContext, "{{interface_name}}", nameInUtf8.Data());
|
| {% endif %}
|
| {% if setter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + ScriptState* scriptState = ScriptState::ForReceiverObject(info);
|
| {% endif %}
|
|
|
| {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| @@ -279,13 +279,13 @@ static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v
|
| {% if setter.has_type_checking_interface %}
|
| {# Type checking for interface types (if interface not implemented, throw
|
| TypeError), per http://www.w3.org/TR/WebIDL/#es-interface #}
|
| - if (!propertyValue{% if setter.is_nullable %} && !isUndefinedOrNull(v8Value){% endif %}) {
|
| - exceptionState.throwTypeError("The provided value is not of type '{{setter.idl_type}}'.");
|
| + if (!propertyValue{% if setter.is_nullable %} && !IsUndefinedOrNull(v8Value){% endif %}) {
|
| + exceptionState.ThrowTypeError("The provided value is not of type '{{setter.idl_type}}'.");
|
| return;
|
| }
|
| {% endif %}
|
|
|
| - {% set setter_name = setter.name or 'anonymousNamedSetter' %}
|
| + {% set setter_name = setter.name or 'AnonymousNamedSetter' %}
|
| {% set setter_arguments = ['name', 'propertyValue'] %}
|
| {% if setter.is_call_with_script_state %}
|
| {% set setter_arguments = ['scriptState'] + setter_arguments %}
|
| @@ -295,12 +295,12 @@ static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v
|
| {% endif %}
|
| bool result = impl->{{setter_name}}({{setter_arguments | join(', ')}});
|
| {% if setter.is_raises_exception %}
|
| - if (exceptionState.hadException())
|
| + if (exceptionState.HadException())
|
| return;
|
| {% endif %}
|
| if (!result)
|
| return;
|
| - v8SetReturnValue(info, v8Value);
|
| + V8SetReturnValue(info, v8Value);
|
| }
|
|
|
| {% endif %}
|
| @@ -314,7 +314,7 @@ static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v
|
| void {{v8_class_or_partial}}::namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| if (!name->IsString())
|
| return;
|
| - const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
| + const AtomicString& propertyName = ToCoreAtomicString(name.As<v8::String>());
|
|
|
| {% if setter.is_ce_reactions %}
|
| CEReactionsScope ceReactionsScope;
|
| @@ -337,16 +337,16 @@ void {{v8_class_or_partial}}::namedPropertySetterCallback(v8::Local<v8::Name> na
|
| {% set deleter = named_property_deleter %}
|
| static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
| {% if deleter.is_raises_exception %}
|
| - const CString& nameInUtf8 = name.utf8();
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::DeletionContext, "{{interface_name}}", nameInUtf8.data());
|
| + const CString& nameInUtf8 = name.Utf8();
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kDeletionContext, "{{interface_name}}", nameInUtf8.Data());
|
| {% endif %}
|
| {% if deleter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + ScriptState* scriptState = ScriptState::ForReceiverObject(info);
|
| {% endif %}
|
|
|
| {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
|
|
| - {% set deleter_name = deleter.name or 'anonymousNamedDeleter' %}
|
| + {% set deleter_name = deleter.name or 'AnonymousNamedDeleter' %}
|
| {% set deleter_arguments = ['name'] %}
|
| {% if deleter.is_call_with_script_state %}
|
| {% set deleter_arguments = ['scriptState'] + deleter_arguments %}
|
| @@ -356,12 +356,12 @@ static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCal
|
| {% endif %}
|
| DeleteResult result = impl->{{deleter_name}}({{deleter_arguments | join(', ')}});
|
| {% if deleter.is_raises_exception %}
|
| - if (exceptionState.hadException())
|
| + if (exceptionState.HadException())
|
| return;
|
| {% endif %}
|
| - if (result == DeleteUnknownProperty)
|
| + if (result == kDeleteUnknownProperty)
|
| return;
|
| - v8SetReturnValue(info, result == DeleteSuccess);
|
| + V8SetReturnValue(info, result == kDeleteSuccess);
|
| }
|
|
|
| {% endif %}
|
| @@ -375,7 +375,7 @@ static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCal
|
| void {{v8_class_or_partial}}::namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
| if (!name->IsString())
|
| return;
|
| - const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
| + const AtomicString& propertyName = ToCoreAtomicString(name.As<v8::String>());
|
|
|
| {% if deleter.is_ce_reactions %}
|
| CEReactionsScope ceReactionsScope;
|
| @@ -400,10 +400,10 @@ void {{v8_class_or_partial}}::namedPropertyDeleterCallback(v8::Local<v8::Name> n
|
| {# If there is an enumerator, there MUST be a query method to properly
|
| communicate property attributes. #}
|
| static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallbackInfo<v8::Integer>& info) {
|
| - const CString& nameInUtf8 = name.utf8();
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::GetterContext, "{{interface_name}}", nameInUtf8.data());
|
| + const CString& nameInUtf8 = name.Utf8();
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kGetterContext, "{{interface_name}}", nameInUtf8.Data());
|
| {% if getter.is_call_with_script_state %}
|
| - ScriptState* scriptState = ScriptState::forReceiverObject(info);
|
| + ScriptState* scriptState = ScriptState::ForReceiverObject(info);
|
| {% endif %}
|
|
|
| {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
| @@ -412,10 +412,10 @@ static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallb
|
| {% if getter.is_call_with_script_state %}
|
| {% set getter_arguments = ['scriptState'] + getter_arguments %}
|
| {% endif %}
|
| - bool result = impl->namedPropertyQuery({{getter_arguments | join(', ')}});
|
| + bool result = impl->NamedPropertyQuery({{getter_arguments | join(', ')}});
|
| if (!result)
|
| return;
|
| - v8SetReturnValueInt(info, v8::None);
|
| + V8SetReturnValueInt(info, v8::None);
|
| }
|
|
|
| {% endif %}
|
| @@ -429,7 +429,7 @@ static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallb
|
| void {{v8_class_or_partial}}::namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info) {
|
| if (!name->IsString())
|
| return;
|
| - const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
|
| + const AtomicString& propertyName = ToCoreAtomicString(name.As<v8::String>());
|
|
|
| {% if getter.is_custom_property_query %}
|
| {{v8_class}}::namedPropertyQueryCustom(propertyName, info);
|
| @@ -447,15 +447,15 @@ void {{v8_class_or_partial}}::namedPropertyQueryCallback(v8::Local<v8::Name> nam
|
| {% if named_property_getter and named_property_getter.is_enumerable and
|
| not named_property_getter.is_custom_property_enumerator %}
|
| static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& info) {
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::EnumerationContext, "{{interface_name}}");
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kEnumerationContext, "{{interface_name}}");
|
|
|
| {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
|
|
|
| Vector<String> names;
|
| - impl->namedPropertyEnumerator(names, exceptionState);
|
| - if (exceptionState.hadException())
|
| + impl->NamedPropertyEnumerator(names, exceptionState);
|
| + if (exceptionState.HadException())
|
| return;
|
| - v8SetReturnValue(info, ToV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>());
|
| + V8SetReturnValue(info, ToV8(names, info.Holder(), info.GetIsolate()).As<v8::Array>());
|
| }
|
|
|
| {% endif %}
|
| @@ -492,8 +492,8 @@ static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::Name> name, v8::Lo
|
| return;
|
| {{cpp_class}}* impl = {{v8_class}}::toImpl(holder);
|
| v8::String::Utf8Value methodName(name);
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::SetterContext, "{{interface_name}}", *methodName);
|
| - if (!BindingSecurity::shouldAllowAccessTo(currentDOMWindow(info.GetIsolate()), impl, exceptionState)) {
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kSetterContext, "{{interface_name}}", *methodName);
|
| + if (!BindingSecurity::ShouldAllowAccessTo(CurrentDOMWindow(info.GetIsolate()), impl, exceptionState)) {
|
| return;
|
| }
|
|
|
| @@ -503,8 +503,8 @@ static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::Name> name, v8::Lo
|
| // {{method.name}}OriginSafeMethodGetter{{world_suffix}} defined in
|
| // methods.cpp.tmpl
|
| {% endraw %}
|
| - V8PrivateProperty::getSymbol(info.GetIsolate(), *methodName)
|
| - .set(v8::Local<v8::Object>::Cast(info.Holder()), v8Value);
|
| + V8PrivateProperty::GetSymbol(info.GetIsolate(), *methodName)
|
| + .Set(v8::Local<v8::Object>::Cast(info.Holder()), v8Value);
|
| }
|
| {% endif %}
|
| {% endblock %}
|
| @@ -523,16 +523,16 @@ void {{v8_class_or_partial}}::{{cpp_class}}OriginSafeMethodSetterCallback(v8::Lo
|
| {% from 'methods.cpp.tmpl' import generate_constructor with context %}
|
| {% if named_constructor %}
|
| {% set active_scriptwrappable_inheritance =
|
| - 'InheritFromActiveScriptWrappable'
|
| + 'kInheritFromActiveScriptWrappable'
|
| if active_scriptwrappable else
|
| - 'NotInheritFromActiveScriptWrappable' %}
|
| + 'kNotInheritFromActiveScriptWrappable' %}
|
| // Suppress warning: global constructors, because struct WrapperTypeInfo is trivial
|
| // and does not depend on another global objects.
|
| #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
|
| #pragma clang diagnostic push
|
| #pragma clang diagnostic ignored "-Wglobal-constructors"
|
| #endif
|
| -const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedderBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::trace, {{v8_class}}::traceWrappers, {{prepare_prototype_and_interface_object_func or 'nullptr'}}, "{{interface_name}}", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{active_scriptwrappable_inheritance}}, WrapperTypeInfo::{{lifetime}} };
|
| +const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedderBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::Trace, {{v8_class}}::TraceWrappers, {{prepare_prototype_and_interface_object_func or 'nullptr'}}, "{{interface_name}}", 0, WrapperTypeInfo::kWrapperTypeObjectPrototype, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{active_scriptwrappable_inheritance}}, WrapperTypeInfo::{{lifetime}} };
|
| #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
|
| #pragma clang diagnostic pop
|
| #endif
|
| @@ -540,17 +540,17 @@ const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedde
|
| {{generate_constructor(named_constructor)}}
|
| v8::Local<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) {
|
| static int domTemplateKey; // This address is used for a key to look up the dom template.
|
| - V8PerIsolateData* data = V8PerIsolateData::from(isolate);
|
| - v8::Local<v8::FunctionTemplate> result = data->findInterfaceTemplate(world, &domTemplateKey);
|
| + V8PerIsolateData* data = V8PerIsolateData::From(isolate);
|
| + v8::Local<v8::FunctionTemplate> result = data->FindInterfaceTemplate(world, &domTemplateKey);
|
| if (!result.IsEmpty())
|
| return result;
|
|
|
| result = v8::FunctionTemplate::New(isolate, {{v8_class}}ConstructorCallback);
|
| v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
|
| instanceTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount);
|
| - result->SetClassName(v8AtomicString(isolate, "{{named_constructor.name}}"));
|
| + result->SetClassName(V8AtomicString(isolate, "{{named_constructor.name}}"));
|
| result->Inherit({{v8_class}}::domTemplate(isolate, world));
|
| - data->setInterfaceTemplate(world, &domTemplateKey, result);
|
| + data->SetInterfaceTemplate(world, &domTemplateKey, result);
|
| return result;
|
| }
|
|
|
| @@ -558,29 +558,29 @@ void {{v8_class}}Constructor::NamedConstructorAttributeGetter(
|
| v8::Local<v8::Name> propertyName,
|
| const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| v8::Local<v8::Context> creationContext = info.Holder()->CreationContext();
|
| - V8PerContextData* perContextData = V8PerContextData::from(creationContext);
|
| + V8PerContextData* perContextData = V8PerContextData::From(creationContext);
|
| if (!perContextData) {
|
| // TODO(yukishiino): Return a valid named constructor even after the context is detached
|
| return;
|
| }
|
|
|
| - v8::Local<v8::Function> namedConstructor = perContextData->constructorForType(&{{v8_class}}Constructor::wrapperTypeInfo);
|
| + v8::Local<v8::Function> namedConstructor = perContextData->ConstructorForType(&{{v8_class}}Constructor::wrapperTypeInfo);
|
|
|
| // Set the prototype of named constructors to the regular constructor.
|
| - auto privateProperty = V8PrivateProperty::getNamedConstructorInitialized(info.GetIsolate());
|
| + auto privateProperty = V8PrivateProperty::GetNamedConstructorInitialized(info.GetIsolate());
|
| v8::Local<v8::Context> currentContext = info.GetIsolate()->GetCurrentContext();
|
| - v8::Local<v8::Value> privateValue = privateProperty.getOrEmpty(namedConstructor);
|
| + v8::Local<v8::Value> privateValue = privateProperty.GetOrEmpty(namedConstructor);
|
|
|
| if (privateValue.IsEmpty()) {
|
| - v8::Local<v8::Function> interface = perContextData->constructorForType(&{{v8_class}}::wrapperTypeInfo);
|
| - v8::Local<v8::Value> interfacePrototype = interface->Get(currentContext, v8AtomicString(info.GetIsolate(), "prototype")).ToLocalChecked();
|
| - bool result = namedConstructor->Set(currentContext, v8AtomicString(info.GetIsolate(), "prototype"), interfacePrototype).ToChecked();
|
| + v8::Local<v8::Function> interface = perContextData->ConstructorForType(&{{v8_class}}::wrapperTypeInfo);
|
| + v8::Local<v8::Value> interfacePrototype = interface->Get(currentContext, V8AtomicString(info.GetIsolate(), "prototype")).ToLocalChecked();
|
| + bool result = namedConstructor->Set(currentContext, V8AtomicString(info.GetIsolate(), "prototype"), interfacePrototype).ToChecked();
|
| if (!result)
|
| return;
|
| - privateProperty.set(namedConstructor, v8::True(info.GetIsolate()));
|
| + privateProperty.Set(namedConstructor, v8::True(info.GetIsolate()));
|
| }
|
|
|
| - v8SetReturnValue(info, namedConstructor);
|
| + V8SetReturnValue(info, namedConstructor);
|
| }
|
|
|
| {% endif %}
|
| @@ -590,7 +590,7 @@ void {{v8_class}}Constructor::NamedConstructorAttributeGetter(
|
| {% block overloaded_constructor %}
|
| {% if constructor_overloads %}
|
| static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
| - ExceptionState exceptionState(info.GetIsolate(), ExceptionState::ConstructionContext, "{{interface_name}}");
|
| + ExceptionState exceptionState(info.GetIsolate(), ExceptionState::kConstructionContext, "{{interface_name}}");
|
| {# 2. Initialize argcount to be min(maxarg, n). #}
|
| switch (std::min({{constructor_overloads.maxarg}}, info.Length())) {
|
| {# 3. Remove from S all entries whose type list is not of length argcount. #}
|
| @@ -611,16 +611,16 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
| {# Report full list of valid arities if gaps and above minimum #}
|
| {% if constructor_overloads.valid_arities %}
|
| if (info.Length() >= {{constructor_overloads.length}}) {
|
| - exceptionState.throwTypeError(ExceptionMessages::invalidArity("{{constructor_overloads.valid_arities}}", info.Length()));
|
| + exceptionState.ThrowTypeError(ExceptionMessages::InvalidArity("{{constructor_overloads.valid_arities}}", info.Length()));
|
| return;
|
| }
|
| {% endif %}
|
| {# Otherwise just report "not enough arguments" #}
|
| - exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments({{constructor_overloads.length}}, info.Length()));
|
| + exceptionState.ThrowTypeError(ExceptionMessages::NotEnoughArguments({{constructor_overloads.length}}, info.Length()));
|
| return;
|
| }
|
| {# No match, throw error #}
|
| - exceptionState.throwTypeError("No matching constructor signature.");
|
| + exceptionState.ThrowTypeError("No matching constructor signature.");
|
| }
|
|
|
| {% endif %}
|
| @@ -632,22 +632,22 @@ static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
| {% if constructors or has_custom_constructor or has_event_constructor or has_html_constructor %}
|
| void {{v8_class}}::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
| {% if measure_as %}
|
| - UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{measure_as('Constructor')}});
|
| + UseCounter::Count(CurrentExecutionContext(info.GetIsolate()), UseCounter::k{{measure_as('Constructor')}});
|
| {% endif %}
|
| if (!info.IsConstructCall()) {
|
| - V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::constructorNotCallableAsFunction("{{interface_name}}"));
|
| + V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::ConstructorNotCallableAsFunction("{{interface_name}}"));
|
| return;
|
| }
|
|
|
| - if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) {
|
| - v8SetReturnValue(info, info.Holder());
|
| + if (ConstructorMode::Current(info.GetIsolate()) == ConstructorMode::kWrapExistingObject) {
|
| + V8SetReturnValue(info, info.Holder());
|
| return;
|
| }
|
|
|
| {% if has_custom_constructor %}
|
| {{v8_class}}::constructorCustom(info);
|
| {% elif has_html_constructor %}
|
| - V8HTMLConstructor::htmlConstructor(info, {{v8_class}}::wrapperTypeInfo, HTMLElementType::k{{interface_name}});
|
| + V8HTMLConstructor::HtmlConstructor(info, {{v8_class}}::wrapperTypeInfo, HTMLElementType::k{{interface_name}});
|
| {% else %}
|
| {{cpp_class}}V8Internal::constructor(info);
|
| {% endif %}
|
| @@ -672,7 +672,7 @@ void {{v8_class}}::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>
|
| {% set property_attribute =
|
| 'static_cast<v8::PropertyAttribute>(%s)' %
|
| ' | '.join(method.property_attributes or ['v8::None']) %}
|
| -{% set holder_check = 'V8DOMConfiguration::CheckHolder' %}
|
| +{% set holder_check = 'V8DOMConfiguration::kCheckHolder' %}
|
| static const V8DOMConfiguration::AttributeConfiguration {{method.name}}OriginSafeAttributeConfiguration[] = {
|
| {% if method.is_per_world_bindings %}
|
| {% set getter_callback_for_main_world = '%sForMainWorld' % getter_callback %}
|
| @@ -681,11 +681,11 @@ static const V8DOMConfiguration::AttributeConfiguration {{method.name}}OriginSaf
|
| {"{{method.name}}", {{getter_callback_for_main_world}}, {{setter_callback_for_main_world}}, nullptr, &{{v8_class}}::wrapperTypeInfo, {{property_attribute}}, {{property_location(method)}}, {{holder_check}}, V8DOMConfiguration::MainWorld},
|
| {"{{method.name}}", {{getter_callback}}, {{setter_callback}}, nullptr, &{{v8_class}}::wrapperTypeInfo, {{property_attribute}}, {{property_location(method)}}, {{holder_check}}, V8DOMConfiguration::NonMainWorlds}}
|
| {% else %}
|
| - {"{{method.name}}", {{getter_callback}}, {{setter_callback}}, nullptr, &{{v8_class}}::wrapperTypeInfo, {{property_attribute}}, {{property_location(method)}}, {{holder_check}}, V8DOMConfiguration::AllWorlds}
|
| + {"{{method.name}}", {{getter_callback}}, {{setter_callback}}, nullptr, &{{v8_class}}::wrapperTypeInfo, {{property_attribute}}, {{property_location(method)}}, {{holder_check}}, V8DOMConfiguration::kAllWorlds}
|
| {% endif %}
|
| };
|
| for (const auto& attributeConfig : {{method.name}}OriginSafeAttributeConfiguration)
|
| - V8DOMConfiguration::installAttribute(isolate, world, {{instance_template}}, {{prototype_template}}, attributeConfig);
|
| + V8DOMConfiguration::InstallAttribute(isolate, world, {{instance_template}}, {{prototype_template}}, attributeConfig);
|
| {%- endmacro %}
|
|
|
|
|
| @@ -701,7 +701,7 @@ for (const auto& attributeConfig : {{method.name}}OriginSafeAttributeConfigurati
|
| '%s::indexedPropertyDeleterCallback' % v8_class_or_partial
|
| if indexed_property_deleter or named_property_deleter else 'nullptr' %}
|
| {% set indexed_property_enumerator_callback =
|
| - 'indexedPropertyEnumerator<%s>' % cpp_class
|
| + 'IndexedPropertyEnumerator<%s>' % cpp_class
|
| if indexed_property_getter.is_enumerable else 'nullptr' %}
|
| {% set property_handler_flags =
|
| 'v8::PropertyHandlerFlags::kNone' %}
|
| @@ -745,7 +745,7 @@ v8::NamedPropertyHandlerConfiguration namedPropertyHandlerConfig({{named_propert
|
| {% if not is_array_buffer_or_view %}
|
| v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate, const DOMWrapperWorld& world) {
|
| {% set installTemplateFunction = '%s::install%sTemplateFunction' % (v8_class, v8_class) if has_partial_interface else 'install%sTemplate' % v8_class %}
|
| - return V8DOMConfiguration::domClassTemplate(isolate, world, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), {{installTemplateFunction}});
|
| + return V8DOMConfiguration::DomClassTemplate(isolate, world, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), {{installTemplateFunction}});
|
| }
|
|
|
| {% endif %}
|
| @@ -758,15 +758,15 @@ v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate,
|
| v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplateForNamedPropertiesObject(v8::Isolate* isolate, const DOMWrapperWorld& world) {
|
| v8::Local<v8::FunctionTemplate> parentTemplate = V8{{parent_interface}}::domTemplate(isolate, world);
|
|
|
| - v8::Local<v8::FunctionTemplate> namedPropertiesObjectFunctionTemplate = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidConstructorMode);
|
| - namedPropertiesObjectFunctionTemplate->SetClassName(v8AtomicString(isolate, "{{interface_name}}Properties"));
|
| + v8::Local<v8::FunctionTemplate> namedPropertiesObjectFunctionTemplate = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::IsValidConstructorMode);
|
| + namedPropertiesObjectFunctionTemplate->SetClassName(V8AtomicString(isolate, "{{interface_name}}Properties"));
|
| namedPropertiesObjectFunctionTemplate->Inherit(parentTemplate);
|
|
|
| v8::Local<v8::ObjectTemplate> namedPropertiesObjectTemplate = namedPropertiesObjectFunctionTemplate->PrototypeTemplate();
|
| namedPropertiesObjectTemplate->SetInternalFieldCount({{v8_class}}::internalFieldCount);
|
| // Named Properties object has SetPrototype method of Immutable Prototype Exotic Objects
|
| namedPropertiesObjectTemplate->SetImmutableProto();
|
| - V8DOMConfiguration::setClassString(isolate, namedPropertiesObjectTemplate, "{{interface_name}}Properties");
|
| + V8DOMConfiguration::SetClassString(isolate, namedPropertiesObjectTemplate, "{{interface_name}}Properties");
|
| {{install_named_property_handler('namedPropertiesObjectTemplate') | indent(2)}}
|
|
|
| return namedPropertiesObjectFunctionTemplate;
|
| @@ -781,11 +781,11 @@ v8::Local<v8::FunctionTemplate> {{v8_class}}::domTemplateForNamedPropertiesObjec
|
| {% if not is_array_buffer_or_view %}
|
|
|
| bool {{v8_class}}::hasInstance(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) {
|
| - return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
|
| + return V8PerIsolateData::From(isolate)->HasInstance(&wrapperTypeInfo, v8Value);
|
| }
|
|
|
| v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::Value> v8Value, v8::Isolate* isolate) {
|
| - return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
|
| + return V8PerIsolateData::From(isolate)->FindInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
|
| }
|
|
|
| {% endif %}
|
| @@ -799,19 +799,19 @@ v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::V
|
| DCHECK(object->Is{{interface_name}}());
|
| v8::Local<v8::{{interface_name}}> v8buffer = object.As<v8::{{interface_name}}>();
|
| if (v8buffer->IsExternal()) {
|
| - const WrapperTypeInfo* wrapperTypeInfo = toWrapperTypeInfo(object);
|
| + const WrapperTypeInfo* wrapperTypeInfo = ToWrapperTypeInfo(object);
|
| CHECK(wrapperTypeInfo);
|
| - CHECK_EQ(wrapperTypeInfo->ginEmbedder, gin::kEmbedderBlink);
|
| - return toScriptWrappable(object)->toImpl<{{cpp_class}}>();
|
| + CHECK_EQ(wrapperTypeInfo->gin_embedder, gin::kEmbedderBlink);
|
| + return ToScriptWrappable(object)->ToImpl<{{cpp_class}}>();
|
| }
|
|
|
| // Transfer the ownership of the allocated memory to an {{interface_name}} without
|
| // copying.
|
| v8::{{interface_name}}::Contents v8Contents = v8buffer->Externalize();
|
| - WTF::ArrayBufferContents::DataHandle data(v8Contents.Data(), WTF::ArrayBufferContents::freeMemory);
|
| - WTF::ArrayBufferContents contents(std::move(data), v8Contents.ByteLength(), WTF::ArrayBufferContents::{% if interface_name == 'ArrayBuffer' %}Not{% endif %}Shared);
|
| - {{cpp_class}}* buffer = {{cpp_class}}::create(contents);
|
| - v8::Local<v8::Object> associatedWrapper = buffer->associateWithWrapper(v8::Isolate::GetCurrent(), buffer->wrapperTypeInfo(), object);
|
| + WTF::ArrayBufferContents::DataHandle data(v8Contents.Data(), WTF::ArrayBufferContents::FreeMemory);
|
| + WTF::ArrayBufferContents contents(std::move(data), v8Contents.ByteLength(), WTF::ArrayBufferContents::k{% if interface_name == 'ArrayBuffer' %}Not{% endif %}Shared);
|
| + {{cpp_class}}* buffer = {{cpp_class}}::Create(contents);
|
| + v8::Local<v8::Object> associatedWrapper = buffer->AssociateWithWrapper(v8::Isolate::GetCurrent(), buffer->GetWrapperTypeInfo(), object);
|
| DCHECK(associatedWrapper == object);
|
|
|
| return buffer;
|
| @@ -820,9 +820,9 @@ v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::V
|
| {% elif interface_name == 'ArrayBufferView' %}
|
| {{cpp_class}}* V8ArrayBufferView::toImpl(v8::Local<v8::Object> object) {
|
| DCHECK(object->IsArrayBufferView());
|
| - ScriptWrappable* scriptWrappable = toScriptWrappable(object);
|
| + ScriptWrappable* scriptWrappable = ToScriptWrappable(object);
|
| if (scriptWrappable)
|
| - return scriptWrappable->toImpl<{{cpp_class}}>();
|
| + return scriptWrappable->ToImpl<{{cpp_class}}>();
|
|
|
| if (object->IsInt8Array())
|
| return V8Int8Array::toImpl(object);
|
| @@ -852,24 +852,24 @@ v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::V
|
| {% elif is_array_buffer_or_view %}
|
| {{cpp_class}}* {{v8_class}}::toImpl(v8::Local<v8::Object> object) {
|
| DCHECK(object->Is{{interface_name}}());
|
| - ScriptWrappable* scriptWrappable = toScriptWrappable(object);
|
| + ScriptWrappable* scriptWrappable = ToScriptWrappable(object);
|
| if (scriptWrappable)
|
| - return scriptWrappable->toImpl<{{cpp_class}}>();
|
| + return scriptWrappable->ToImpl<{{cpp_class}}>();
|
|
|
| v8::Local<v8::{{interface_name}}> v8View = object.As<v8::{{interface_name}}>();
|
| v8::Local<v8::Object> arrayBuffer = v8View->Buffer();
|
| {{cpp_class}}* typedArray = nullptr;
|
| if (arrayBuffer->IsArrayBuffer()) {
|
| - typedArray = {{cpp_class}}::create(V8ArrayBuffer::toImpl(arrayBuffer), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %}Length());
|
| + typedArray = {{cpp_class}}::Create(V8ArrayBuffer::toImpl(arrayBuffer), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %}Length());
|
| } else if (arrayBuffer->IsSharedArrayBuffer()) {
|
| - typedArray = {{cpp_class}}::create(V8SharedArrayBuffer::toImpl(arrayBuffer), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %}Length());
|
| + typedArray = {{cpp_class}}::Create(V8SharedArrayBuffer::toImpl(arrayBuffer), v8View->ByteOffset(), v8View->{% if interface_name == 'DataView' %}Byte{% endif %}Length());
|
| } else {
|
| NOTREACHED();
|
| }
|
| - v8::Local<v8::Object> associatedWrapper = typedArray->associateWithWrapper(v8::Isolate::GetCurrent(), typedArray->wrapperTypeInfo(), object);
|
| + v8::Local<v8::Object> associatedWrapper = typedArray->AssociateWithWrapper(v8::Isolate::GetCurrent(), typedArray->GetWrapperTypeInfo(), object);
|
| DCHECK(associatedWrapper == object);
|
|
|
| - return typedArray->toImpl<{{cpp_class}}>();
|
| + return typedArray->ToImpl<{{cpp_class}}>();
|
| }
|
|
|
| {% endif %}
|
| @@ -891,10 +891,10 @@ v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::V
|
|
|
| {##############################################################################}
|
| {% block native_value_traits %}
|
| -{{cpp_class}}* NativeValueTraits<{{cpp_class}}>::nativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
|
| +{{cpp_class}}* NativeValueTraits<{{cpp_class}}>::NativeValue(v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exceptionState) {
|
| {{cpp_class}}* nativeValue = {{v8_class}}::toImplWithTypeCheck(isolate, value);
|
| if (!nativeValue)
|
| - exceptionState.throwTypeError("Unable to convert value to {{interface_name}}.");
|
| + exceptionState.ThrowTypeError("Unable to convert value to {{interface_name}}.");
|
| return nativeValue;
|
| }
|
|
|
| @@ -926,7 +926,7 @@ void {{v8_class}}::updateWrapperTypeInfo(
|
| installRuntimeEnabledFunction;
|
| {% endif %}
|
| if (preparePrototypeAndInterfaceObjectFunction) {
|
| - {{v8_class}}::wrapperTypeInfo.preparePrototypeAndInterfaceObjectFunction =
|
| + {{v8_class}}::wrapperTypeInfo.prepare_prototype_and_interface_object_function =
|
| preparePrototypeAndInterfaceObjectFunction;
|
| }
|
| }
|
|
|