| |
| |
| // Copyright 2017 Google Inc. All Rights Reserved. |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| // clang-format off |
| |
| // This file has been auto-generated by bindings/code_generator_cobalt.py. DO NOT MODIFY! |
| // Auto-generated from template: bindings/v8c/templates/interface.cc.template |
| |
| #include "cobalt/bindings/testing/v8c_window.h" |
| |
| #include "base/debug/trace_event.h" |
| #include "cobalt/base/polymorphic_downcast.h" |
| #include "cobalt/script/global_environment.h" |
| #include "cobalt/script/script_value.h" |
| #include "cobalt/script/value_handle.h" |
| #include "cobalt/bindings/testing/anonymous_indexed_getter_interface.h" |
| #include "cobalt/bindings/testing/anonymous_named_getter_interface.h" |
| #include "cobalt/bindings/testing/anonymous_named_indexed_getter_interface.h" |
| #include "cobalt/bindings/testing/arbitrary_interface.h" |
| #include "cobalt/bindings/testing/base_interface.h" |
| #include "cobalt/bindings/testing/boolean_type_test_interface.h" |
| #include "cobalt/bindings/testing/callback_function_interface.h" |
| #include "cobalt/bindings/testing/callback_interface_interface.h" |
| #include "cobalt/bindings/testing/conditional_interface.h" |
| #include "cobalt/bindings/testing/constants_interface.h" |
| #include "cobalt/bindings/testing/constructor_interface.h" |
| #include "cobalt/bindings/testing/constructor_with_arguments_interface.h" |
| #include "cobalt/bindings/testing/derived_getter_setter_interface.h" |
| #include "cobalt/bindings/testing/derived_interface.h" |
| #include "cobalt/bindings/testing/dictionary_interface.h" |
| #include "cobalt/bindings/testing/disabled_interface.h" |
| #include "cobalt/bindings/testing/dom_string_test_interface.h" |
| #include "cobalt/bindings/testing/enumeration_interface.h" |
| #include "cobalt/bindings/testing/exception_object_interface.h" |
| #include "cobalt/bindings/testing/exceptions_interface.h" |
| #include "cobalt/bindings/testing/extended_idl_attributes_interface.h" |
| #include "cobalt/bindings/testing/garbage_collection_test_interface.h" |
| #include "cobalt/bindings/testing/global_interface_parent.h" |
| #include "cobalt/bindings/testing/implemented_interface.h" |
| #include "cobalt/bindings/testing/indexed_getter_interface.h" |
| #include "cobalt/bindings/testing/interface_with_any.h" |
| #include "cobalt/bindings/testing/interface_with_any_dictionary.h" |
| #include "cobalt/bindings/testing/interface_with_unsupported_properties.h" |
| #include "cobalt/bindings/testing/named_constructor_interface.h" |
| #include "cobalt/bindings/testing/named_getter_interface.h" |
| #include "cobalt/bindings/testing/named_indexed_getter_interface.h" |
| #include "cobalt/bindings/testing/nested_put_forwards_interface.h" |
| #include "cobalt/bindings/testing/no_constructor_interface.h" |
| #include "cobalt/bindings/testing/no_interface_object_interface.h" |
| #include "cobalt/bindings/testing/nullable_types_test_interface.h" |
| #include "cobalt/bindings/testing/numeric_types_test_interface.h" |
| #include "cobalt/bindings/testing/object_type_bindings_interface.h" |
| #include "cobalt/bindings/testing/operations_test_interface.h" |
| #include "cobalt/bindings/testing/promise_interface.h" |
| #include "cobalt/bindings/testing/put_forwards_interface.h" |
| #include "cobalt/bindings/testing/sequence_user.h" |
| #include "cobalt/bindings/testing/single_operation_interface.h" |
| #include "cobalt/bindings/testing/static_properties_interface.h" |
| #include "cobalt/bindings/testing/stringifier_anonymous_operation_interface.h" |
| #include "cobalt/bindings/testing/stringifier_attribute_interface.h" |
| #include "cobalt/bindings/testing/stringifier_operation_interface.h" |
| #include "cobalt/bindings/testing/target_interface.h" |
| #include "cobalt/bindings/testing/union_types_interface.h" |
| #include "cobalt/bindings/testing/v8c_anonymous_indexed_getter_interface.h" |
| #include "cobalt/bindings/testing/v8c_anonymous_named_getter_interface.h" |
| #include "cobalt/bindings/testing/v8c_anonymous_named_indexed_getter_interface.h" |
| #include "cobalt/bindings/testing/v8c_arbitrary_interface.h" |
| #include "cobalt/bindings/testing/v8c_base_interface.h" |
| #include "cobalt/bindings/testing/v8c_boolean_type_test_interface.h" |
| #include "cobalt/bindings/testing/v8c_callback_function_interface.h" |
| #include "cobalt/bindings/testing/v8c_callback_interface_interface.h" |
| #include "cobalt/bindings/testing/v8c_conditional_interface.h" |
| #include "cobalt/bindings/testing/v8c_constants_interface.h" |
| #include "cobalt/bindings/testing/v8c_constructor_interface.h" |
| #include "cobalt/bindings/testing/v8c_constructor_with_arguments_interface.h" |
| #include "cobalt/bindings/testing/v8c_derived_getter_setter_interface.h" |
| #include "cobalt/bindings/testing/v8c_derived_interface.h" |
| #include "cobalt/bindings/testing/v8c_dictionary_interface.h" |
| #include "cobalt/bindings/testing/v8c_disabled_interface.h" |
| #include "cobalt/bindings/testing/v8c_dom_string_test_interface.h" |
| #include "cobalt/bindings/testing/v8c_enumeration_interface.h" |
| #include "cobalt/bindings/testing/v8c_exception_object_interface.h" |
| #include "cobalt/bindings/testing/v8c_exceptions_interface.h" |
| #include "cobalt/bindings/testing/v8c_extended_idl_attributes_interface.h" |
| #include "cobalt/bindings/testing/v8c_garbage_collection_test_interface.h" |
| #include "cobalt/bindings/testing/v8c_global_interface_parent.h" |
| #include "cobalt/bindings/testing/v8c_implemented_interface.h" |
| #include "cobalt/bindings/testing/v8c_indexed_getter_interface.h" |
| #include "cobalt/bindings/testing/v8c_interface_with_any.h" |
| #include "cobalt/bindings/testing/v8c_interface_with_any_dictionary.h" |
| #include "cobalt/bindings/testing/v8c_interface_with_unsupported_properties.h" |
| #include "cobalt/bindings/testing/v8c_named_constructor_interface.h" |
| #include "cobalt/bindings/testing/v8c_named_getter_interface.h" |
| #include "cobalt/bindings/testing/v8c_named_indexed_getter_interface.h" |
| #include "cobalt/bindings/testing/v8c_nested_put_forwards_interface.h" |
| #include "cobalt/bindings/testing/v8c_no_constructor_interface.h" |
| #include "cobalt/bindings/testing/v8c_no_interface_object_interface.h" |
| #include "cobalt/bindings/testing/v8c_nullable_types_test_interface.h" |
| #include "cobalt/bindings/testing/v8c_numeric_types_test_interface.h" |
| #include "cobalt/bindings/testing/v8c_object_type_bindings_interface.h" |
| #include "cobalt/bindings/testing/v8c_operations_test_interface.h" |
| #include "cobalt/bindings/testing/v8c_promise_interface.h" |
| #include "cobalt/bindings/testing/v8c_put_forwards_interface.h" |
| #include "cobalt/bindings/testing/v8c_sequence_user.h" |
| #include "cobalt/bindings/testing/v8c_single_operation_interface.h" |
| #include "cobalt/bindings/testing/v8c_static_properties_interface.h" |
| #include "cobalt/bindings/testing/v8c_stringifier_anonymous_operation_interface.h" |
| #include "cobalt/bindings/testing/v8c_stringifier_attribute_interface.h" |
| #include "cobalt/bindings/testing/v8c_stringifier_operation_interface.h" |
| #include "cobalt/bindings/testing/v8c_target_interface.h" |
| #include "cobalt/bindings/testing/v8c_union_types_interface.h" |
| #include "cobalt/bindings/testing/v8c_window.h" |
| #include "cobalt/bindings/testing/window.h" |
| |
| #include "v8c_gen_type_conversion.h" |
| |
| #include "cobalt/script/callback_interface_traits.h" |
| #include "cobalt/script/v8c/callback_function_conversion.h" |
| #include "cobalt/script/v8c/conversion_helpers.h" |
| #include "cobalt/script/v8c/native_promise.h" |
| #include "cobalt/script/v8c/type_traits.h" |
| #include "cobalt/script/v8c/v8c_callback_function.h" |
| #include "cobalt/script/v8c/v8c_callback_interface_holder.h" |
| #include "cobalt/script/v8c/v8c_exception_state.h" |
| #include "cobalt/script/v8c/v8c_global_environment.h" |
| #include "cobalt/script/v8c/v8c_value_handle.h" |
| #include "cobalt/script/v8c/wrapper_private.h" |
| #include "v8/include/v8.h" |
| |
| |
| namespace { |
| using cobalt::bindings::testing::Window; |
| using cobalt::bindings::testing::V8cWindow; |
| using cobalt::bindings::testing::AnonymousIndexedGetterInterface; |
| using cobalt::bindings::testing::AnonymousNamedGetterInterface; |
| using cobalt::bindings::testing::AnonymousNamedIndexedGetterInterface; |
| using cobalt::bindings::testing::ArbitraryInterface; |
| using cobalt::bindings::testing::BaseInterface; |
| using cobalt::bindings::testing::BooleanTypeTestInterface; |
| using cobalt::bindings::testing::CallbackFunctionInterface; |
| using cobalt::bindings::testing::CallbackInterfaceInterface; |
| #if defined(ENABLE_CONDITIONAL_INTERFACE) |
| using cobalt::bindings::testing::ConditionalInterface; |
| #endif // defined(ENABLE_CONDITIONAL_INTERFACE) |
| using cobalt::bindings::testing::ConstantsInterface; |
| using cobalt::bindings::testing::ConstructorInterface; |
| using cobalt::bindings::testing::ConstructorWithArgumentsInterface; |
| using cobalt::bindings::testing::DOMStringTestInterface; |
| using cobalt::bindings::testing::DerivedGetterSetterInterface; |
| using cobalt::bindings::testing::DerivedInterface; |
| using cobalt::bindings::testing::DictionaryInterface; |
| #if defined(NO_ENABLE_CONDITIONAL_INTERFACE) |
| using cobalt::bindings::testing::DisabledInterface; |
| #endif // defined(NO_ENABLE_CONDITIONAL_INTERFACE) |
| using cobalt::bindings::testing::EnumerationInterface; |
| using cobalt::bindings::testing::ExceptionObjectInterface; |
| using cobalt::bindings::testing::ExceptionsInterface; |
| using cobalt::bindings::testing::ExtendedIDLAttributesInterface; |
| using cobalt::bindings::testing::GarbageCollectionTestInterface; |
| using cobalt::bindings::testing::GlobalInterfaceParent; |
| using cobalt::bindings::testing::ImplementedInterface; |
| using cobalt::bindings::testing::IndexedGetterInterface; |
| using cobalt::bindings::testing::InterfaceWithAny; |
| using cobalt::bindings::testing::InterfaceWithAnyDictionary; |
| using cobalt::bindings::testing::InterfaceWithUnsupportedProperties; |
| using cobalt::bindings::testing::NamedConstructorInterface; |
| using cobalt::bindings::testing::NamedGetterInterface; |
| using cobalt::bindings::testing::NamedIndexedGetterInterface; |
| using cobalt::bindings::testing::NestedPutForwardsInterface; |
| using cobalt::bindings::testing::NoConstructorInterface; |
| using cobalt::bindings::testing::NoInterfaceObjectInterface; |
| using cobalt::bindings::testing::NullableTypesTestInterface; |
| using cobalt::bindings::testing::NumericTypesTestInterface; |
| using cobalt::bindings::testing::ObjectTypeBindingsInterface; |
| using cobalt::bindings::testing::OperationsTestInterface; |
| using cobalt::bindings::testing::PromiseInterface; |
| using cobalt::bindings::testing::PutForwardsInterface; |
| using cobalt::bindings::testing::SequenceUser; |
| using cobalt::bindings::testing::SingleOperationInterface; |
| using cobalt::bindings::testing::StaticPropertiesInterface; |
| using cobalt::bindings::testing::StringifierAnonymousOperationInterface; |
| using cobalt::bindings::testing::StringifierAttributeInterface; |
| using cobalt::bindings::testing::StringifierOperationInterface; |
| using cobalt::bindings::testing::TargetInterface; |
| using cobalt::bindings::testing::UnionTypesInterface; |
| using cobalt::bindings::testing::V8cAnonymousIndexedGetterInterface; |
| using cobalt::bindings::testing::V8cAnonymousNamedGetterInterface; |
| using cobalt::bindings::testing::V8cAnonymousNamedIndexedGetterInterface; |
| using cobalt::bindings::testing::V8cArbitraryInterface; |
| using cobalt::bindings::testing::V8cBaseInterface; |
| using cobalt::bindings::testing::V8cBooleanTypeTestInterface; |
| using cobalt::bindings::testing::V8cCallbackFunctionInterface; |
| using cobalt::bindings::testing::V8cCallbackInterfaceInterface; |
| #if defined(ENABLE_CONDITIONAL_INTERFACE) |
| using cobalt::bindings::testing::V8cConditionalInterface; |
| #endif // defined(ENABLE_CONDITIONAL_INTERFACE) |
| using cobalt::bindings::testing::V8cConstantsInterface; |
| using cobalt::bindings::testing::V8cConstructorInterface; |
| using cobalt::bindings::testing::V8cConstructorWithArgumentsInterface; |
| using cobalt::bindings::testing::V8cDOMStringTestInterface; |
| using cobalt::bindings::testing::V8cDerivedGetterSetterInterface; |
| using cobalt::bindings::testing::V8cDerivedInterface; |
| using cobalt::bindings::testing::V8cDictionaryInterface; |
| #if defined(NO_ENABLE_CONDITIONAL_INTERFACE) |
| using cobalt::bindings::testing::V8cDisabledInterface; |
| #endif // defined(NO_ENABLE_CONDITIONAL_INTERFACE) |
| using cobalt::bindings::testing::V8cEnumerationInterface; |
| using cobalt::bindings::testing::V8cExceptionObjectInterface; |
| using cobalt::bindings::testing::V8cExceptionsInterface; |
| using cobalt::bindings::testing::V8cExtendedIDLAttributesInterface; |
| using cobalt::bindings::testing::V8cGarbageCollectionTestInterface; |
| using cobalt::bindings::testing::V8cGlobalInterfaceParent; |
| using cobalt::bindings::testing::V8cImplementedInterface; |
| using cobalt::bindings::testing::V8cIndexedGetterInterface; |
| using cobalt::bindings::testing::V8cInterfaceWithAny; |
| using cobalt::bindings::testing::V8cInterfaceWithAnyDictionary; |
| using cobalt::bindings::testing::V8cInterfaceWithUnsupportedProperties; |
| using cobalt::bindings::testing::V8cNamedConstructorInterface; |
| using cobalt::bindings::testing::V8cNamedGetterInterface; |
| using cobalt::bindings::testing::V8cNamedIndexedGetterInterface; |
| using cobalt::bindings::testing::V8cNestedPutForwardsInterface; |
| using cobalt::bindings::testing::V8cNoConstructorInterface; |
| using cobalt::bindings::testing::V8cNoInterfaceObjectInterface; |
| using cobalt::bindings::testing::V8cNullableTypesTestInterface; |
| using cobalt::bindings::testing::V8cNumericTypesTestInterface; |
| using cobalt::bindings::testing::V8cObjectTypeBindingsInterface; |
| using cobalt::bindings::testing::V8cOperationsTestInterface; |
| using cobalt::bindings::testing::V8cPromiseInterface; |
| using cobalt::bindings::testing::V8cPutForwardsInterface; |
| using cobalt::bindings::testing::V8cSequenceUser; |
| using cobalt::bindings::testing::V8cSingleOperationInterface; |
| using cobalt::bindings::testing::V8cStaticPropertiesInterface; |
| using cobalt::bindings::testing::V8cStringifierAnonymousOperationInterface; |
| using cobalt::bindings::testing::V8cStringifierAttributeInterface; |
| using cobalt::bindings::testing::V8cStringifierOperationInterface; |
| using cobalt::bindings::testing::V8cTargetInterface; |
| using cobalt::bindings::testing::V8cUnionTypesInterface; |
| using cobalt::bindings::testing::V8cWindow; |
| using cobalt::bindings::testing::Window; |
| using cobalt::script::CallbackInterfaceTraits; |
| using cobalt::script::GlobalEnvironment; |
| using cobalt::script::ScriptValue; |
| using cobalt::script::ValueHandle; |
| using cobalt::script::ValueHandle; |
| using cobalt::script::ValueHandleHolder; |
| using cobalt::script::Wrappable; |
| |
| using cobalt::script::v8c::FromJSValue; |
| using cobalt::script::v8c::InterfaceData; |
| using cobalt::script::v8c::kConversionFlagClamped; |
| using cobalt::script::v8c::kConversionFlagNullable; |
| using cobalt::script::v8c::kConversionFlagRestricted; |
| using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString; |
| using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString; |
| using cobalt::script::v8c::kNoConversionFlags; |
| using cobalt::script::v8c::TypeTraits; |
| using cobalt::script::v8c::V8cExceptionState; |
| using cobalt::script::v8c::V8cGlobalEnvironment; |
| using cobalt::script::v8c::WrapperFactory; |
| using cobalt::script::v8c::WrapperPrivate; |
| |
| v8::Local<v8::Object> DummyFunctor(V8cGlobalEnvironment*, const scoped_refptr<Wrappable>&) { |
| NOTIMPLEMENTED(); |
| return {}; |
| } |
| |
| } // namespace |
| |
| namespace cobalt { |
| namespace bindings { |
| namespace testing { |
| |
| |
| namespace { |
| |
| void WindowConstructor(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| NOTIMPLEMENTED(); |
| if (!args.IsConstructCall()) { |
| // TODO: Probably throw something here... |
| return; |
| } |
| |
| DCHECK(args.This()->InternalFieldCount() == 1); |
| args.This()->SetInternalField(0, v8::External::New(args.GetIsolate(), nullptr)); |
| args.GetReturnValue().Set(args.This()); |
| } |
| |
| |
| void v8cGet_windowProperty( |
| v8::Local<v8::String> property, |
| const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| NOTIMPLEMENTED(); |
| |
| v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0)); |
| WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value()); |
| Window* impl = static_cast<Window*>(wrapper_private->wrappable<Window>()); |
| |
| v8::Local<v8::Value> result_value; |
| } |
| |
| |
| void v8cSet_windowProperty( |
| v8::Local<v8::String> property, |
| v8::Local<v8::Value> v8_value, |
| const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0)); |
| WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value()); |
| Window* impl = static_cast<Window*>(wrapper_private->wrappable<Window>()); |
| |
| TypeTraits<std::string>::ConversionType conversion_value; |
| V8cExceptionState exception_state{}; |
| FromJSValue(info.GetIsolate(), v8_value, kNoConversionFlags, &exception_state, &conversion_value); |
| impl->set_window_property( |
| conversion_value |
| ); |
| } |
| |
| |
| |
| void v8cGet_window( |
| v8::Local<v8::String> property, |
| const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| NOTIMPLEMENTED(); |
| |
| v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0)); |
| WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value()); |
| Window* impl = static_cast<Window*>(wrapper_private->wrappable<Window>()); |
| |
| v8::Local<v8::Value> result_value; |
| } |
| |
| |
| |
| void v8cGet_onEvent( |
| v8::Local<v8::String> property, |
| const v8::PropertyCallbackInfo<v8::Value>& info) |
| { |
| NOTIMPLEMENTED(); |
| |
| v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0)); |
| WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value()); |
| Window* impl = static_cast<Window*>(wrapper_private->wrappable<Window>()); |
| |
| v8::Local<v8::Value> result_value; |
| } |
| |
| |
| void v8cSet_onEvent( |
| v8::Local<v8::String> property, |
| v8::Local<v8::Value> v8_value, |
| const v8::PropertyCallbackInfo<void>& info) |
| { |
| v8::Local<v8::External> external = v8::Local<v8::External>::Cast(info.Holder()->GetInternalField(0)); |
| WrapperPrivate* wrapper_private = static_cast<WrapperPrivate*>(external->Value()); |
| Window* impl = static_cast<Window*>(wrapper_private->wrappable<Window>()); |
| |
| TypeTraits<::cobalt::script::CallbackInterfaceTraits<SingleOperationInterface >>::ConversionType conversion_value; |
| V8cExceptionState exception_state{}; |
| FromJSValue(info.GetIsolate(), v8_value, (kConversionFlagNullable), &exception_state, &conversion_value); |
| impl->set_on_event( |
| conversion_value |
| ); |
| } |
| |
| |
| |
| void DummyFunction(const v8::FunctionCallbackInfo<v8::Value>& info) { |
| LOG(INFO) << __func__; |
| } |
| |
| void InitializeTemplate( |
| V8cGlobalEnvironment* env, |
| InterfaceData* interface_data) { |
| v8::Isolate* isolate = env->isolate(); |
| v8::Local<v8::FunctionTemplate> function_template = v8::FunctionTemplate::New( |
| isolate); |
| function_template->SetClassName( |
| v8::String::NewFromUtf8(isolate, "Window", |
| v8::NewStringType::kInternalized).ToLocalChecked()); |
| v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate(); |
| instance_template->SetInternalFieldCount(1); |
| |
| v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate(); |
| prototype_template->SetInternalFieldCount(1); |
| |
| instance_template->SetAccessor( |
| v8::String::NewFromUtf8(isolate, "windowProperty", |
| v8::NewStringType::kInternalized) |
| .ToLocalChecked(), |
| v8cGet_windowProperty |
| ,v8cSet_windowProperty |
| ); |
| instance_template->SetAccessor( |
| v8::String::NewFromUtf8(isolate, "window", |
| v8::NewStringType::kInternalized) |
| .ToLocalChecked(), |
| v8cGet_window |
| ); |
| instance_template->SetAccessor( |
| v8::String::NewFromUtf8(isolate, "onEvent", |
| v8::NewStringType::kInternalized) |
| .ToLocalChecked(), |
| v8cGet_onEvent |
| ,v8cSet_onEvent |
| ); |
| |
| instance_template->Set( |
| v8::String::NewFromUtf8( |
| isolate, |
| "getStackTrace", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| v8::FunctionTemplate::New(isolate, DummyFunction) |
| ); |
| instance_template->Set( |
| v8::String::NewFromUtf8( |
| isolate, |
| "setTimeout", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| v8::FunctionTemplate::New(isolate, DummyFunction) |
| ); |
| instance_template->Set( |
| v8::String::NewFromUtf8( |
| isolate, |
| "windowOperation", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| v8::FunctionTemplate::New(isolate, DummyFunction) |
| ); |
| |
| interface_data->templ.Set(env->isolate(), function_template); |
| } |
| |
| inline InterfaceData* GetInterfaceData(V8cGlobalEnvironment* env) { |
| const int kInterfaceUniqueId = 52; |
| // By convention, the |V8cGlobalEnvironment| that we are associated with |
| // will hold our |InterfaceData| at index |kInterfaceUniqueId|, as we asked |
| // for it to be there in the first place, and could not have conflicted with |
| // any other interface. |
| return env->GetInterfaceData(kInterfaceUniqueId); |
| } |
| |
| } // namespace |
| |
| v8::Local<v8::Object> V8cWindow::CreateWrapper(V8cGlobalEnvironment* env, const scoped_refptr<Wrappable>& wrappable) { |
| v8::Isolate* isolate = env->isolate(); |
| v8::Isolate::Scope isolate_scope(isolate); |
| v8::EscapableHandleScope handle_scope(isolate); |
| v8::Local<v8::Context> context = env->context(); |
| v8::Context::Scope scope(context); |
| |
| InterfaceData* interface_data = GetInterfaceData(env); |
| if (interface_data->templ.IsEmpty()) { |
| InitializeTemplate(env, interface_data); |
| } |
| DCHECK(!interface_data->templ.IsEmpty()); |
| |
| v8::Local<v8::FunctionTemplate> function_template = interface_data->templ.Get(isolate); |
| DCHECK(function_template->InstanceTemplate()->InternalFieldCount() == 1); |
| v8::Local<v8::Object> object = function_template->InstanceTemplate()->NewInstance(context).ToLocalChecked(); |
| DCHECK(object->InternalFieldCount() == 1); |
| |
| // |WrapperPrivate|'s lifetime will be managed by V8. |
| new WrapperPrivate(isolate, wrappable, object); |
| return handle_scope.Escape(object); |
| } |
| |
| v8::Local<v8::FunctionTemplate> V8cWindow::CreateTemplate(V8cGlobalEnvironment* env) { |
| InterfaceData* interface_data = GetInterfaceData(env); |
| if (interface_data->templ.IsEmpty()) { |
| InitializeTemplate(env, interface_data); |
| } |
| |
| return interface_data->templ.Get(env->isolate()); |
| } |
| |
| |
| } // namespace testing |
| } // namespace bindings |
| } // namespace cobalt |
| |
| |
| namespace cobalt { |
| namespace script { |
| namespace v8c { |
| |
| template <typename GlobalInterface> |
| void V8cGlobalEnvironment::CreateGlobalObject( |
| const scoped_refptr<GlobalInterface>& global_interface, |
| EnvironmentSettings* environment_settings) { |
| v8::Isolate::Scope isolate_scope(isolate_); |
| v8::HandleScope handle_scope(isolate_); |
| |
| v8::Local<v8::ObjectTemplate> global_object_template = v8::ObjectTemplate::New(isolate_); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "AnonymousIndexedGetterInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cAnonymousIndexedGetterInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "AnonymousNamedGetterInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cAnonymousNamedGetterInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "AnonymousNamedIndexedGetterInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cAnonymousNamedIndexedGetterInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "ArbitraryInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cArbitraryInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "BaseInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cBaseInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "BooleanTypeTestInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cBooleanTypeTestInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "CallbackFunctionInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cCallbackFunctionInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "CallbackInterfaceInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cCallbackInterfaceInterface::CreateTemplate(this)); |
| #if defined(ENABLE_CONDITIONAL_INTERFACE) |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "ConditionalInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cConditionalInterface::CreateTemplate(this)); |
| #endif // defined(ENABLE_CONDITIONAL_INTERFACE) |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "ConstantsInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cConstantsInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "ConstructorInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cConstructorInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "ConstructorWithArgumentsInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cConstructorWithArgumentsInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "DOMStringTestInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cDOMStringTestInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "DerivedGetterSetterInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cDerivedGetterSetterInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "DerivedInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cDerivedInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "DictionaryInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cDictionaryInterface::CreateTemplate(this)); |
| #if defined(NO_ENABLE_CONDITIONAL_INTERFACE) |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "DisabledInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cDisabledInterface::CreateTemplate(this)); |
| #endif // defined(NO_ENABLE_CONDITIONAL_INTERFACE) |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "EnumerationInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cEnumerationInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "ExceptionObjectInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cExceptionObjectInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "ExceptionsInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cExceptionsInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "ExtendedIDLAttributesInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cExtendedIDLAttributesInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "GarbageCollectionTestInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cGarbageCollectionTestInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "GlobalInterfaceParent", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cGlobalInterfaceParent::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "ImplementedInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cImplementedInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "IndexedGetterInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cIndexedGetterInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "InterfaceWithAny", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cInterfaceWithAny::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "InterfaceWithAnyDictionary", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cInterfaceWithAnyDictionary::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "InterfaceWithUnsupportedProperties", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cInterfaceWithUnsupportedProperties::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "NamedConstructorInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cNamedConstructorInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "NamedGetterInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cNamedGetterInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "NamedIndexedGetterInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cNamedIndexedGetterInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "NestedPutForwardsInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cNestedPutForwardsInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "NoConstructorInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cNoConstructorInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "NoInterfaceObjectInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cNoInterfaceObjectInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "NullableTypesTestInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cNullableTypesTestInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "NumericTypesTestInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cNumericTypesTestInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "ObjectTypeBindingsInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cObjectTypeBindingsInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "OperationsTestInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cOperationsTestInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "PromiseInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cPromiseInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "PutForwardsInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cPutForwardsInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "SequenceUser", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cSequenceUser::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "StaticPropertiesInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cStaticPropertiesInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "StringifierAnonymousOperationInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cStringifierAnonymousOperationInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "StringifierAttributeInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cStringifierAttributeInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "StringifierOperationInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cStringifierOperationInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "TargetInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cTargetInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "UnionTypesInterface", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cUnionTypesInterface::CreateTemplate(this)); |
| global_object_template->Set( |
| v8::String::NewFromUtf8( |
| isolate_, "Window", |
| v8::NewStringType::kInternalized).ToLocalChecked(), |
| V8cWindow::CreateTemplate(this)); |
| |
| v8::Local<v8::Context> context = |
| v8::Context::New(isolate_, nullptr, global_object_template); |
| context_.Reset(isolate_, context); |
| |
| environment_settings_ = environment_settings; |
| EvaluateAutomatics(); |
| |
| wrapper_factory_->RegisterWrappableType( |
| AnonymousIndexedGetterInterface::AnonymousIndexedGetterInterfaceWrappableType(), |
| base::Bind(V8cAnonymousIndexedGetterInterface::CreateWrapper), |
| base::Bind(V8cAnonymousIndexedGetterInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| AnonymousNamedGetterInterface::AnonymousNamedGetterInterfaceWrappableType(), |
| base::Bind(V8cAnonymousNamedGetterInterface::CreateWrapper), |
| base::Bind(V8cAnonymousNamedGetterInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| AnonymousNamedIndexedGetterInterface::AnonymousNamedIndexedGetterInterfaceWrappableType(), |
| base::Bind(V8cAnonymousNamedIndexedGetterInterface::CreateWrapper), |
| base::Bind(V8cAnonymousNamedIndexedGetterInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| ArbitraryInterface::ArbitraryInterfaceWrappableType(), |
| base::Bind(V8cArbitraryInterface::CreateWrapper), |
| base::Bind(V8cArbitraryInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| BaseInterface::BaseInterfaceWrappableType(), |
| base::Bind(V8cBaseInterface::CreateWrapper), |
| base::Bind(V8cBaseInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| BooleanTypeTestInterface::BooleanTypeTestInterfaceWrappableType(), |
| base::Bind(V8cBooleanTypeTestInterface::CreateWrapper), |
| base::Bind(V8cBooleanTypeTestInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| CallbackFunctionInterface::CallbackFunctionInterfaceWrappableType(), |
| base::Bind(V8cCallbackFunctionInterface::CreateWrapper), |
| base::Bind(V8cCallbackFunctionInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| CallbackInterfaceInterface::CallbackInterfaceInterfaceWrappableType(), |
| base::Bind(V8cCallbackInterfaceInterface::CreateWrapper), |
| base::Bind(V8cCallbackInterfaceInterface::CreateTemplate)); |
| #if defined(ENABLE_CONDITIONAL_INTERFACE) |
| wrapper_factory_->RegisterWrappableType( |
| ConditionalInterface::ConditionalInterfaceWrappableType(), |
| base::Bind(V8cConditionalInterface::CreateWrapper), |
| base::Bind(V8cConditionalInterface::CreateTemplate)); |
| #endif // defined(ENABLE_CONDITIONAL_INTERFACE) |
| wrapper_factory_->RegisterWrappableType( |
| ConstantsInterface::ConstantsInterfaceWrappableType(), |
| base::Bind(V8cConstantsInterface::CreateWrapper), |
| base::Bind(V8cConstantsInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| ConstructorInterface::ConstructorInterfaceWrappableType(), |
| base::Bind(V8cConstructorInterface::CreateWrapper), |
| base::Bind(V8cConstructorInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| ConstructorWithArgumentsInterface::ConstructorWithArgumentsInterfaceWrappableType(), |
| base::Bind(V8cConstructorWithArgumentsInterface::CreateWrapper), |
| base::Bind(V8cConstructorWithArgumentsInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| DOMStringTestInterface::DOMStringTestInterfaceWrappableType(), |
| base::Bind(V8cDOMStringTestInterface::CreateWrapper), |
| base::Bind(V8cDOMStringTestInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| DerivedGetterSetterInterface::DerivedGetterSetterInterfaceWrappableType(), |
| base::Bind(V8cDerivedGetterSetterInterface::CreateWrapper), |
| base::Bind(V8cDerivedGetterSetterInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| DerivedInterface::DerivedInterfaceWrappableType(), |
| base::Bind(V8cDerivedInterface::CreateWrapper), |
| base::Bind(V8cDerivedInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| DictionaryInterface::DictionaryInterfaceWrappableType(), |
| base::Bind(V8cDictionaryInterface::CreateWrapper), |
| base::Bind(V8cDictionaryInterface::CreateTemplate)); |
| #if defined(NO_ENABLE_CONDITIONAL_INTERFACE) |
| wrapper_factory_->RegisterWrappableType( |
| DisabledInterface::DisabledInterfaceWrappableType(), |
| base::Bind(V8cDisabledInterface::CreateWrapper), |
| base::Bind(V8cDisabledInterface::CreateTemplate)); |
| #endif // defined(NO_ENABLE_CONDITIONAL_INTERFACE) |
| wrapper_factory_->RegisterWrappableType( |
| EnumerationInterface::EnumerationInterfaceWrappableType(), |
| base::Bind(V8cEnumerationInterface::CreateWrapper), |
| base::Bind(V8cEnumerationInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| ExceptionObjectInterface::ExceptionObjectInterfaceWrappableType(), |
| base::Bind(V8cExceptionObjectInterface::CreateWrapper), |
| base::Bind(V8cExceptionObjectInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| ExceptionsInterface::ExceptionsInterfaceWrappableType(), |
| base::Bind(V8cExceptionsInterface::CreateWrapper), |
| base::Bind(V8cExceptionsInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| ExtendedIDLAttributesInterface::ExtendedIDLAttributesInterfaceWrappableType(), |
| base::Bind(V8cExtendedIDLAttributesInterface::CreateWrapper), |
| base::Bind(V8cExtendedIDLAttributesInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| GarbageCollectionTestInterface::GarbageCollectionTestInterfaceWrappableType(), |
| base::Bind(V8cGarbageCollectionTestInterface::CreateWrapper), |
| base::Bind(V8cGarbageCollectionTestInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| GlobalInterfaceParent::GlobalInterfaceParentWrappableType(), |
| base::Bind(V8cGlobalInterfaceParent::CreateWrapper), |
| base::Bind(V8cGlobalInterfaceParent::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| ImplementedInterface::ImplementedInterfaceWrappableType(), |
| base::Bind(V8cImplementedInterface::CreateWrapper), |
| base::Bind(V8cImplementedInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| IndexedGetterInterface::IndexedGetterInterfaceWrappableType(), |
| base::Bind(V8cIndexedGetterInterface::CreateWrapper), |
| base::Bind(V8cIndexedGetterInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| InterfaceWithAny::InterfaceWithAnyWrappableType(), |
| base::Bind(V8cInterfaceWithAny::CreateWrapper), |
| base::Bind(V8cInterfaceWithAny::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| InterfaceWithAnyDictionary::InterfaceWithAnyDictionaryWrappableType(), |
| base::Bind(V8cInterfaceWithAnyDictionary::CreateWrapper), |
| base::Bind(V8cInterfaceWithAnyDictionary::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| InterfaceWithUnsupportedProperties::InterfaceWithUnsupportedPropertiesWrappableType(), |
| base::Bind(V8cInterfaceWithUnsupportedProperties::CreateWrapper), |
| base::Bind(V8cInterfaceWithUnsupportedProperties::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| NamedConstructorInterface::NamedConstructorInterfaceWrappableType(), |
| base::Bind(V8cNamedConstructorInterface::CreateWrapper), |
| base::Bind(V8cNamedConstructorInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| NamedGetterInterface::NamedGetterInterfaceWrappableType(), |
| base::Bind(V8cNamedGetterInterface::CreateWrapper), |
| base::Bind(V8cNamedGetterInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| NamedIndexedGetterInterface::NamedIndexedGetterInterfaceWrappableType(), |
| base::Bind(V8cNamedIndexedGetterInterface::CreateWrapper), |
| base::Bind(V8cNamedIndexedGetterInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| NestedPutForwardsInterface::NestedPutForwardsInterfaceWrappableType(), |
| base::Bind(V8cNestedPutForwardsInterface::CreateWrapper), |
| base::Bind(V8cNestedPutForwardsInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| NoConstructorInterface::NoConstructorInterfaceWrappableType(), |
| base::Bind(V8cNoConstructorInterface::CreateWrapper), |
| base::Bind(V8cNoConstructorInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| NoInterfaceObjectInterface::NoInterfaceObjectInterfaceWrappableType(), |
| base::Bind(V8cNoInterfaceObjectInterface::CreateWrapper), |
| base::Bind(V8cNoInterfaceObjectInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| NullableTypesTestInterface::NullableTypesTestInterfaceWrappableType(), |
| base::Bind(V8cNullableTypesTestInterface::CreateWrapper), |
| base::Bind(V8cNullableTypesTestInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| NumericTypesTestInterface::NumericTypesTestInterfaceWrappableType(), |
| base::Bind(V8cNumericTypesTestInterface::CreateWrapper), |
| base::Bind(V8cNumericTypesTestInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| ObjectTypeBindingsInterface::ObjectTypeBindingsInterfaceWrappableType(), |
| base::Bind(V8cObjectTypeBindingsInterface::CreateWrapper), |
| base::Bind(V8cObjectTypeBindingsInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| OperationsTestInterface::OperationsTestInterfaceWrappableType(), |
| base::Bind(V8cOperationsTestInterface::CreateWrapper), |
| base::Bind(V8cOperationsTestInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| PromiseInterface::PromiseInterfaceWrappableType(), |
| base::Bind(V8cPromiseInterface::CreateWrapper), |
| base::Bind(V8cPromiseInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| PutForwardsInterface::PutForwardsInterfaceWrappableType(), |
| base::Bind(V8cPutForwardsInterface::CreateWrapper), |
| base::Bind(V8cPutForwardsInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| SequenceUser::SequenceUserWrappableType(), |
| base::Bind(V8cSequenceUser::CreateWrapper), |
| base::Bind(V8cSequenceUser::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| StaticPropertiesInterface::StaticPropertiesInterfaceWrappableType(), |
| base::Bind(V8cStaticPropertiesInterface::CreateWrapper), |
| base::Bind(V8cStaticPropertiesInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| StringifierAnonymousOperationInterface::StringifierAnonymousOperationInterfaceWrappableType(), |
| base::Bind(V8cStringifierAnonymousOperationInterface::CreateWrapper), |
| base::Bind(V8cStringifierAnonymousOperationInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| StringifierAttributeInterface::StringifierAttributeInterfaceWrappableType(), |
| base::Bind(V8cStringifierAttributeInterface::CreateWrapper), |
| base::Bind(V8cStringifierAttributeInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| StringifierOperationInterface::StringifierOperationInterfaceWrappableType(), |
| base::Bind(V8cStringifierOperationInterface::CreateWrapper), |
| base::Bind(V8cStringifierOperationInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| TargetInterface::TargetInterfaceWrappableType(), |
| base::Bind(V8cTargetInterface::CreateWrapper), |
| base::Bind(V8cTargetInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| UnionTypesInterface::UnionTypesInterfaceWrappableType(), |
| base::Bind(V8cUnionTypesInterface::CreateWrapper), |
| base::Bind(V8cUnionTypesInterface::CreateTemplate)); |
| wrapper_factory_->RegisterWrappableType( |
| Window::WindowWrappableType(), |
| base::Bind(DummyFunctor), |
| base::Bind(V8cWindow::CreateTemplate)); |
| |
| } |
| |
| } // namespace v8c |
| |
| template<> |
| void GlobalEnvironment::CreateGlobalObject<Window>( |
| const scoped_refptr<Window>& global_interface, |
| EnvironmentSettings* environment_settings) { |
| base::polymorphic_downcast<v8c::V8cGlobalEnvironment*>(this)->CreateGlobalObject(global_interface, environment_settings); |
| } |
| |
| } // namespace script |
| } // namespace cobalt |
| |
| |