blob: f50864ad26e8e9a059205ba7828447fa8c46ad77 [file] [log] [blame]
// Copyright 2018 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_date.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_date.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/entry_scope.h"
#include "cobalt/script/v8c/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_property_enumerator.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::InterfaceWithDate;
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::V8cInterfaceWithDate;
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::EntryScope;
using cobalt::script::v8c::EscapableEntryScope;
using cobalt::script::v8c::FromJSValue;
using cobalt::script::v8c::kConversionFlagClamped;
using cobalt::script::v8c::kConversionFlagNullable;
using cobalt::script::v8c::kConversionFlagObjectOnly;
using cobalt::script::v8c::kConversionFlagRestricted;
using cobalt::script::v8c::kConversionFlagTreatNullAsEmptyString;
using cobalt::script::v8c::kConversionFlagTreatUndefinedAsEmptyString;
using cobalt::script::v8c::kNoConversionFlags;
using cobalt::script::v8c::NewInternalString;
using cobalt::script::v8c::ToJSValue;
using cobalt::script::v8c::TypeTraits;
using cobalt::script::v8c::V8cExceptionState;
using cobalt::script::v8c::V8cGlobalEnvironment;
using cobalt::script::v8c::V8cPropertyEnumerator;
using cobalt::script::v8c::WrapperFactory;
using cobalt::script::v8c::WrapperPrivate;
} // namespace
namespace cobalt {
namespace bindings {
namespace testing {
namespace {
const int kInterfaceUniqueId = 53;
void windowPropertyAttributeGetter(
v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Object> object = info.This();
V8cGlobalEnvironment* global_environment = V8cGlobalEnvironment::GetFromIsolate(isolate);
WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
if (!wrapper_factory->DoesObjectImplementInterface(
object, base::GetTypeId<Window>())) {
V8cExceptionState exception(isolate);
exception.SetSimpleException(script::kDoesNotImplementInterface);
return;
}
V8cExceptionState exception_state{isolate};
v8::Local<v8::Value> result_value;
WrapperPrivate* wrapper_private =
WrapperPrivate::GetFromWrapperObject(object);
if (!wrapper_private) {
NOTIMPLEMENTED();
return;
}
Window* impl =
wrapper_private->wrappable<Window>().get();
if (!exception_state.is_exception_set()) {
ToJSValue(isolate,
impl->window_property(),
&result_value);
}
if (!exception_state.is_exception_set()) {
info.GetReturnValue().Set(result_value);
}
}
void windowPropertyAttributeSetter(
v8::Local<v8::String> property,
v8::Local<v8::Value> v8_value,
const v8::PropertyCallbackInfo<void>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Object> object = info.This();
V8cGlobalEnvironment* global_environment = V8cGlobalEnvironment::GetFromIsolate(isolate);
WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
if (!wrapper_factory->DoesObjectImplementInterface(
object, base::GetTypeId<Window>())) {
V8cExceptionState exception(isolate);
exception.SetSimpleException(script::kDoesNotImplementInterface);
return;
}
V8cExceptionState exception_state{isolate};
v8::Local<v8::Value> result_value;
WrapperPrivate* wrapper_private =
WrapperPrivate::GetFromWrapperObject(object);
if (!wrapper_private) {
NOTIMPLEMENTED();
return;
}
Window* impl =
wrapper_private->wrappable<Window>().get();
TypeTraits<std::string >::ConversionType value;
FromJSValue(isolate, v8_value, kNoConversionFlags, &exception_state,
&value);
if (exception_state.is_exception_set()) {
return;
}
impl->set_window_property(value);
result_value = v8::Undefined(isolate);
return;
}
void windowAttributeGetter(
v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Object> object = info.This();
V8cGlobalEnvironment* global_environment = V8cGlobalEnvironment::GetFromIsolate(isolate);
WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
if (!wrapper_factory->DoesObjectImplementInterface(
object, base::GetTypeId<Window>())) {
V8cExceptionState exception(isolate);
exception.SetSimpleException(script::kDoesNotImplementInterface);
return;
}
V8cExceptionState exception_state{isolate};
v8::Local<v8::Value> result_value;
WrapperPrivate* wrapper_private =
WrapperPrivate::GetFromWrapperObject(object);
if (!wrapper_private) {
NOTIMPLEMENTED();
return;
}
Window* impl =
wrapper_private->wrappable<Window>().get();
if (!exception_state.is_exception_set()) {
ToJSValue(isolate,
impl->window(),
&result_value);
}
if (!exception_state.is_exception_set()) {
info.GetReturnValue().Set(result_value);
}
}
void onEventAttributeGetter(
v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Object> object = info.This();
V8cGlobalEnvironment* global_environment = V8cGlobalEnvironment::GetFromIsolate(isolate);
WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
if (!wrapper_factory->DoesObjectImplementInterface(
object, base::GetTypeId<Window>())) {
V8cExceptionState exception(isolate);
exception.SetSimpleException(script::kDoesNotImplementInterface);
return;
}
V8cExceptionState exception_state{isolate};
v8::Local<v8::Value> result_value;
WrapperPrivate* wrapper_private =
WrapperPrivate::GetFromWrapperObject(object);
if (!wrapper_private) {
NOTIMPLEMENTED();
return;
}
Window* impl =
wrapper_private->wrappable<Window>().get();
if (!exception_state.is_exception_set()) {
ToJSValue(isolate,
impl->on_event(),
&result_value);
}
if (!exception_state.is_exception_set()) {
info.GetReturnValue().Set(result_value);
}
}
void onEventAttributeSetter(
v8::Local<v8::String> property,
v8::Local<v8::Value> v8_value,
const v8::PropertyCallbackInfo<void>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Object> object = info.This();
V8cGlobalEnvironment* global_environment = V8cGlobalEnvironment::GetFromIsolate(isolate);
WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
if (!wrapper_factory->DoesObjectImplementInterface(
object, base::GetTypeId<Window>())) {
V8cExceptionState exception(isolate);
exception.SetSimpleException(script::kDoesNotImplementInterface);
return;
}
V8cExceptionState exception_state{isolate};
v8::Local<v8::Value> result_value;
WrapperPrivate* wrapper_private =
WrapperPrivate::GetFromWrapperObject(object);
if (!wrapper_private) {
NOTIMPLEMENTED();
return;
}
Window* impl =
wrapper_private->wrappable<Window>().get();
TypeTraits<::cobalt::script::CallbackInterfaceTraits<SingleOperationInterface > >::ConversionType value;
FromJSValue(isolate, v8_value, (kConversionFlagNullable), &exception_state,
&value);
if (exception_state.is_exception_set()) {
return;
}
impl->set_on_event(value);
result_value = v8::Undefined(isolate);
return;
}
void getStackTraceMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Object> object = info.This();
V8cGlobalEnvironment* global_environment = V8cGlobalEnvironment::GetFromIsolate(isolate);
WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
if (!wrapper_factory->DoesObjectImplementInterface(
object, base::GetTypeId<Window>())) {
V8cExceptionState exception(isolate);
exception.SetSimpleException(script::kDoesNotImplementInterface);
return;
}
V8cExceptionState exception_state{isolate};
v8::Local<v8::Value> result_value;
WrapperPrivate* wrapper_private =
WrapperPrivate::GetFromWrapperObject(object);
if (!wrapper_private) {
NOTIMPLEMENTED();
return;
}
Window* impl =
wrapper_private->wrappable<Window>().get();
V8cGlobalEnvironment* callwith_global_environment = V8cGlobalEnvironment::GetFromIsolate(isolate);
if (!exception_state.is_exception_set()) {
ToJSValue(isolate,
impl->GetStackTrace(callwith_global_environment->GetStackTrace()),
&result_value);
}
if (!exception_state.is_exception_set()) {
info.GetReturnValue().Set(result_value);
}
}
void setTimeoutMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Object> object = info.This();
V8cGlobalEnvironment* global_environment = V8cGlobalEnvironment::GetFromIsolate(isolate);
WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
if (!wrapper_factory->DoesObjectImplementInterface(
object, base::GetTypeId<Window>())) {
V8cExceptionState exception(isolate);
exception.SetSimpleException(script::kDoesNotImplementInterface);
return;
}
V8cExceptionState exception_state{isolate};
v8::Local<v8::Value> result_value;
WrapperPrivate* wrapper_private =
WrapperPrivate::GetFromWrapperObject(object);
if (!wrapper_private) {
NOTIMPLEMENTED();
return;
}
Window* impl =
wrapper_private->wrappable<Window>().get();
const size_t kMinArguments = 1;
if (info.Length() < kMinArguments) {
exception_state.SetSimpleException(script::kInvalidNumberOfArguments);
return;
}
// Non-optional arguments
TypeTraits<Window::TimerCallback >::ConversionType handler;
// Optional arguments
TypeTraits<int32_t >::ConversionType timeout;
DCHECK_LT(0, info.Length());
v8::Local<v8::Value> non_optional_value0 = info[0];
FromJSValue(isolate,
non_optional_value0,
kNoConversionFlags,
&exception_state, &handler);
if (exception_state.is_exception_set()) {
return;
}
size_t num_set_arguments = 1;
if (info.Length() > 1) {
v8::Local<v8::Value> optional_value0 = info[1];
FromJSValue(isolate,
optional_value0,
kNoConversionFlags,
&exception_state,
&timeout);
if (exception_state.is_exception_set()) {
return;
}
++num_set_arguments;
}
switch (num_set_arguments) {
case 1:
{
if (!exception_state.is_exception_set()) {
ToJSValue(isolate,
impl->SetTimeout(handler),
&result_value);
}
if (!exception_state.is_exception_set()) {
info.GetReturnValue().Set(result_value);
}
}
break;
case 2:
{
if (!exception_state.is_exception_set()) {
ToJSValue(isolate,
impl->SetTimeout(handler, timeout),
&result_value);
}
if (!exception_state.is_exception_set()) {
info.GetReturnValue().Set(result_value);
}
}
break;
default:
NOTREACHED();
return;
}
}
void windowOperationMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::Local<v8::Object> object = info.This();
V8cGlobalEnvironment* global_environment = V8cGlobalEnvironment::GetFromIsolate(isolate);
WrapperFactory* wrapper_factory = global_environment->wrapper_factory();
if (!wrapper_factory->DoesObjectImplementInterface(
object, base::GetTypeId<Window>())) {
V8cExceptionState exception(isolate);
exception.SetSimpleException(script::kDoesNotImplementInterface);
return;
}
V8cExceptionState exception_state{isolate};
v8::Local<v8::Value> result_value;
WrapperPrivate* wrapper_private =
WrapperPrivate::GetFromWrapperObject(object);
if (!wrapper_private) {
NOTIMPLEMENTED();
return;
}
Window* impl =
wrapper_private->wrappable<Window>().get();
impl->WindowOperation();
result_value = v8::Undefined(isolate);
}
void InitializeTemplate(v8::Isolate* isolate) {
// https://heycam.github.io/webidl/#interface-object
// 3.6.1. Interface object
//
// The interface object for a given interface is a built-in function object.
// It has properties that correspond to the constants and static operations
// defined on that interface, as described in sections 3.6.6 Constants and
// 3.6.8 Operations.
//
// If the interface is declared with a [Constructor] extended attribute,
// then the interface object can be called as a constructor to create an
// object that implements that interface. Calling that interface as a
// function will throw an exception.
//
// Interface objects whose interfaces are not declared with a [Constructor]
// extended attribute will throw when called, both as a function and as a
// constructor.
//
// An interface object for a non-callback interface has an associated object
// called the interface prototype object. This object has properties that
// correspond to the regular attributes and regular operations defined on
// the interface, and is described in more detail in 3.6.3 Interface
// prototype object.
v8::Local<v8::FunctionTemplate> function_template =
v8::FunctionTemplate::New(
isolate,
nullptr,
v8::Local<v8::Value>(),
v8::Local<v8::Signature>(),
0);
function_template->SetClassName(NewInternalString(isolate, "Window"));
function_template->ReadOnlyPrototype();
v8::Local<v8::ObjectTemplate> prototype_template = function_template->PrototypeTemplate();
v8::Local<v8::ObjectTemplate> instance_template = function_template->InstanceTemplate();
instance_template->SetInternalFieldCount(WrapperPrivate::kInternalFieldCount);
V8cGlobalEnvironment* global_environment = V8cGlobalEnvironment::GetFromIsolate(isolate);
global_environment->AddInterfaceData(kInterfaceUniqueId, function_template);
{
// An interface can be defined to inherit from another interface. If the
// identifier of the interface is followed by a U+003A COLON (":") character
// and an identifier, then that identifier identifies the inherited
// interface. An object that implements an interface that inherits from
// another also implements that inherited interface. The object therefore
// will also have members that correspond to the interface members from the
// inherited interface.
v8::Local<v8::FunctionTemplate> parent_template = V8cGlobalInterfaceParent::GetTemplate(isolate);
function_template->Inherit(parent_template);
}
// https://heycam.github.io/webidl/#es-constants
// 3.6.6. Constants
//
// For each exposed constant defined on an interface A, there must be a
// corresponding property. The property has the following characteristics:
// https://heycam.github.io/webidl/#es-attributes
// 3.6.7. Attributes
//
// For each exposed attribute of the interface there must exist a
// corresponding property. The characteristics of this property are as
// follows:
{
// The name of the property is the identifier of the attribute.
v8::Local<v8::String> name = NewInternalString(
isolate,
"windowProperty");
// The property has attributes { [[Get]]: G, [[Set]]: S, [[Enumerable]]:
// true, [[Configurable]]: configurable }, where: configurable is false if
// the attribute was declared with the [Unforgeable] extended attribute and
// true otherwise;
bool configurable = true;
v8::PropertyAttribute attributes = static_cast<v8::PropertyAttribute>(
configurable ? v8::None : v8::DontDelete);
// G is the attribute getter created given the attribute, the interface, and
// the relevant Realm of the object that is the location of the property;
// and
//
// S is the attribute setter created given the attribute, the interface, and
// the relevant Realm of the object that is the location of the property.
// The location of the property is determined as follows:
// Otherwise, if the attribute is unforgeable on the interface or if the
// interface was declared with the [Global] extended attribute, then the
// property exists on every object that implements the interface.
instance_template->SetAccessor(
name,
windowPropertyAttributeGetter,
windowPropertyAttributeSetter,
v8::Local<v8::Value>(),
v8::DEFAULT,
attributes);
}
{
// The name of the property is the identifier of the attribute.
v8::Local<v8::String> name = NewInternalString(
isolate,
"window");
// The property has attributes { [[Get]]: G, [[Set]]: S, [[Enumerable]]:
// true, [[Configurable]]: configurable }, where: configurable is false if
// the attribute was declared with the [Unforgeable] extended attribute and
// true otherwise;
bool configurable = true;
v8::PropertyAttribute attributes = static_cast<v8::PropertyAttribute>(
configurable ? v8::None : v8::DontDelete);
// G is the attribute getter created given the attribute, the interface, and
// the relevant Realm of the object that is the location of the property;
// and
//
// S is the attribute setter created given the attribute, the interface, and
// the relevant Realm of the object that is the location of the property.
// The location of the property is determined as follows:
// Otherwise, if the attribute is unforgeable on the interface or if the
// interface was declared with the [Global] extended attribute, then the
// property exists on every object that implements the interface.
instance_template->SetAccessor(
name,
windowAttributeGetter,
0,
v8::Local<v8::Value>(),
v8::DEFAULT,
attributes);
}
{
// The name of the property is the identifier of the attribute.
v8::Local<v8::String> name = NewInternalString(
isolate,
"onEvent");
// The property has attributes { [[Get]]: G, [[Set]]: S, [[Enumerable]]:
// true, [[Configurable]]: configurable }, where: configurable is false if
// the attribute was declared with the [Unforgeable] extended attribute and
// true otherwise;
bool configurable = true;
v8::PropertyAttribute attributes = static_cast<v8::PropertyAttribute>(
configurable ? v8::None : v8::DontDelete);
// G is the attribute getter created given the attribute, the interface, and
// the relevant Realm of the object that is the location of the property;
// and
//
// S is the attribute setter created given the attribute, the interface, and
// the relevant Realm of the object that is the location of the property.
// The location of the property is determined as follows:
// Otherwise, if the attribute is unforgeable on the interface or if the
// interface was declared with the [Global] extended attribute, then the
// property exists on every object that implements the interface.
instance_template->SetAccessor(
name,
onEventAttributeGetter,
onEventAttributeSetter,
v8::Local<v8::Value>(),
v8::DEFAULT,
attributes);
}
// https://heycam.github.io/webidl/#es-operations
// 3.6.8. Operations
//
// For each unique identifier of an exposed operation defined on the
// interface, there must exist a corresponding property, unless the effective
// overload set for that identifier and operation and with an argument count
// of 0 has no entries.
//
// The characteristics of this property are as follows:
{
// The name of the property is the identifier.
v8::Local<v8::String> name = NewInternalString(
isolate,
"getStackTrace");
// The property has attributes { [[Writable]]: B, [[Enumerable]]: true,
// [[Configurable]]: B }, where B is false if the operation is unforgeable
// on the interface, and true otherwise.
bool B = true;
v8::PropertyAttribute attributes = static_cast<v8::PropertyAttribute>(
B ? v8::None : (v8::ReadOnly | v8::DontDelete));
// The location of the property is determined as follows:
// Otherwise, if the operation is unforgeable on the interface or if the
// interface was declared with the [Global] extended attribute, then the
// property exists on every object that implements the interface.
v8::Local<v8::FunctionTemplate> method_template =
v8::FunctionTemplate::New(isolate, getStackTraceMethod);
method_template->RemovePrototype();
method_template->SetLength(0);
instance_template->Set(
NewInternalString(isolate, "getStackTrace"),
method_template);
// The value of the property is the result of creating an operation function
// given the operation, the interface, and the relevant Realm of the object
// that is the location of the property.
// Note: that is, even if an includes statement was used to make an
// operation available on the interface, we pass in the interface which
// includes the interface mixin, and not the interface mixin on which the
// operation was originally declared.
}
{
// The name of the property is the identifier.
v8::Local<v8::String> name = NewInternalString(
isolate,
"setTimeout");
// The property has attributes { [[Writable]]: B, [[Enumerable]]: true,
// [[Configurable]]: B }, where B is false if the operation is unforgeable
// on the interface, and true otherwise.
bool B = true;
v8::PropertyAttribute attributes = static_cast<v8::PropertyAttribute>(
B ? v8::None : (v8::ReadOnly | v8::DontDelete));
// The location of the property is determined as follows:
// Otherwise, if the operation is unforgeable on the interface or if the
// interface was declared with the [Global] extended attribute, then the
// property exists on every object that implements the interface.
v8::Local<v8::FunctionTemplate> method_template =
v8::FunctionTemplate::New(isolate, setTimeoutMethod);
method_template->RemovePrototype();
method_template->SetLength(1);
instance_template->Set(
NewInternalString(isolate, "setTimeout"),
method_template);
// The value of the property is the result of creating an operation function
// given the operation, the interface, and the relevant Realm of the object
// that is the location of the property.
// Note: that is, even if an includes statement was used to make an
// operation available on the interface, we pass in the interface which
// includes the interface mixin, and not the interface mixin on which the
// operation was originally declared.
}
{
// The name of the property is the identifier.
v8::Local<v8::String> name = NewInternalString(
isolate,
"windowOperation");
// The property has attributes { [[Writable]]: B, [[Enumerable]]: true,
// [[Configurable]]: B }, where B is false if the operation is unforgeable
// on the interface, and true otherwise.
bool B = true;
v8::PropertyAttribute attributes = static_cast<v8::PropertyAttribute>(
B ? v8::None : (v8::ReadOnly | v8::DontDelete));
// The location of the property is determined as follows:
// Otherwise, if the operation is unforgeable on the interface or if the
// interface was declared with the [Global] extended attribute, then the
// property exists on every object that implements the interface.
v8::Local<v8::FunctionTemplate> method_template =
v8::FunctionTemplate::New(isolate, windowOperationMethod);
method_template->RemovePrototype();
method_template->SetLength(0);
instance_template->Set(
NewInternalString(isolate, "windowOperation"),
method_template);
// The value of the property is the result of creating an operation function
// given the operation, the interface, and the relevant Realm of the object
// that is the location of the property.
// Note: that is, even if an includes statement was used to make an
// operation available on the interface, we pass in the interface which
// includes the interface mixin, and not the interface mixin on which the
// operation was originally declared.
}
// https://heycam.github.io/webidl/#es-stringifier
// 3.6.8.2. Stringifiers
prototype_template->Set(
v8::Symbol::GetToStringTag(isolate),
NewInternalString(isolate, "Window"),
static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum));
}
} // namespace
// The global interface is special. Just give them the global object proxy.
v8::Local<v8::Object> V8cWindow::CreateWrapper(
v8::Isolate* isolate, const scoped_refptr<Wrappable>&) {
return isolate->GetCurrentContext()->Global();
}
v8::Local<v8::FunctionTemplate> V8cWindow::GetTemplate(v8::Isolate* isolate) {
V8cGlobalEnvironment* global_environment = V8cGlobalEnvironment::GetFromIsolate(isolate);
if (!global_environment->HasInterfaceData(kInterfaceUniqueId)) {
InitializeTemplate(isolate);
}
return global_environment->GetInterfaceData(kInterfaceUniqueId);
}
} // 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) {
TRACE_EVENT0("cobalt::script", "V8cGlobalEnvironment::CreateGlobalObject()");
// Intentionally not an |EntryScope|, since the context doesn't exist yet.
v8::Isolate::Scope isolate_scope(isolate_);
v8::HandleScope handle_scope(isolate_);
v8::Local<v8::ObjectTemplate> global_object_template = V8cWindow::GetTemplate(isolate_)->InstanceTemplate();
v8::Local<v8::Context> context =
v8::Context::New(isolate_, nullptr, global_object_template);
context_.Reset(isolate_, context);
v8::Context::Scope context_scope(context);
DCHECK(!environment_settings_);
DCHECK(environment_settings);
environment_settings_ = environment_settings;
EvaluateAutomatics();
v8::Local<v8::Object> global_object = context->Global();
new WrapperPrivate(isolate_, global_interface, global_object);
auto actual_global_object = global_object->GetPrototype()->ToObject();
new WrapperPrivate(isolate_, global_interface, actual_global_object);
wrapper_factory_->RegisterWrappableType(
AnonymousIndexedGetterInterface::AnonymousIndexedGetterInterfaceWrappableType(),
base::Bind(V8cAnonymousIndexedGetterInterface::CreateWrapper),
base::Bind(V8cAnonymousIndexedGetterInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
AnonymousNamedGetterInterface::AnonymousNamedGetterInterfaceWrappableType(),
base::Bind(V8cAnonymousNamedGetterInterface::CreateWrapper),
base::Bind(V8cAnonymousNamedGetterInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
AnonymousNamedIndexedGetterInterface::AnonymousNamedIndexedGetterInterfaceWrappableType(),
base::Bind(V8cAnonymousNamedIndexedGetterInterface::CreateWrapper),
base::Bind(V8cAnonymousNamedIndexedGetterInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
ArbitraryInterface::ArbitraryInterfaceWrappableType(),
base::Bind(V8cArbitraryInterface::CreateWrapper),
base::Bind(V8cArbitraryInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
BaseInterface::BaseInterfaceWrappableType(),
base::Bind(V8cBaseInterface::CreateWrapper),
base::Bind(V8cBaseInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
BooleanTypeTestInterface::BooleanTypeTestInterfaceWrappableType(),
base::Bind(V8cBooleanTypeTestInterface::CreateWrapper),
base::Bind(V8cBooleanTypeTestInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
CallbackFunctionInterface::CallbackFunctionInterfaceWrappableType(),
base::Bind(V8cCallbackFunctionInterface::CreateWrapper),
base::Bind(V8cCallbackFunctionInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
CallbackInterfaceInterface::CallbackInterfaceInterfaceWrappableType(),
base::Bind(V8cCallbackInterfaceInterface::CreateWrapper),
base::Bind(V8cCallbackInterfaceInterface::GetTemplate));
#if defined(ENABLE_CONDITIONAL_INTERFACE)
wrapper_factory_->RegisterWrappableType(
ConditionalInterface::ConditionalInterfaceWrappableType(),
base::Bind(V8cConditionalInterface::CreateWrapper),
base::Bind(V8cConditionalInterface::GetTemplate));
#endif // defined(ENABLE_CONDITIONAL_INTERFACE)
wrapper_factory_->RegisterWrappableType(
ConstantsInterface::ConstantsInterfaceWrappableType(),
base::Bind(V8cConstantsInterface::CreateWrapper),
base::Bind(V8cConstantsInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
ConstructorInterface::ConstructorInterfaceWrappableType(),
base::Bind(V8cConstructorInterface::CreateWrapper),
base::Bind(V8cConstructorInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
ConstructorWithArgumentsInterface::ConstructorWithArgumentsInterfaceWrappableType(),
base::Bind(V8cConstructorWithArgumentsInterface::CreateWrapper),
base::Bind(V8cConstructorWithArgumentsInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
DOMStringTestInterface::DOMStringTestInterfaceWrappableType(),
base::Bind(V8cDOMStringTestInterface::CreateWrapper),
base::Bind(V8cDOMStringTestInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
DerivedGetterSetterInterface::DerivedGetterSetterInterfaceWrappableType(),
base::Bind(V8cDerivedGetterSetterInterface::CreateWrapper),
base::Bind(V8cDerivedGetterSetterInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
DerivedInterface::DerivedInterfaceWrappableType(),
base::Bind(V8cDerivedInterface::CreateWrapper),
base::Bind(V8cDerivedInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
DictionaryInterface::DictionaryInterfaceWrappableType(),
base::Bind(V8cDictionaryInterface::CreateWrapper),
base::Bind(V8cDictionaryInterface::GetTemplate));
#if defined(NO_ENABLE_CONDITIONAL_INTERFACE)
wrapper_factory_->RegisterWrappableType(
DisabledInterface::DisabledInterfaceWrappableType(),
base::Bind(V8cDisabledInterface::CreateWrapper),
base::Bind(V8cDisabledInterface::GetTemplate));
#endif // defined(NO_ENABLE_CONDITIONAL_INTERFACE)
wrapper_factory_->RegisterWrappableType(
EnumerationInterface::EnumerationInterfaceWrappableType(),
base::Bind(V8cEnumerationInterface::CreateWrapper),
base::Bind(V8cEnumerationInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
ExceptionObjectInterface::ExceptionObjectInterfaceWrappableType(),
base::Bind(V8cExceptionObjectInterface::CreateWrapper),
base::Bind(V8cExceptionObjectInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
ExceptionsInterface::ExceptionsInterfaceWrappableType(),
base::Bind(V8cExceptionsInterface::CreateWrapper),
base::Bind(V8cExceptionsInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
ExtendedIDLAttributesInterface::ExtendedIDLAttributesInterfaceWrappableType(),
base::Bind(V8cExtendedIDLAttributesInterface::CreateWrapper),
base::Bind(V8cExtendedIDLAttributesInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
GarbageCollectionTestInterface::GarbageCollectionTestInterfaceWrappableType(),
base::Bind(V8cGarbageCollectionTestInterface::CreateWrapper),
base::Bind(V8cGarbageCollectionTestInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
GlobalInterfaceParent::GlobalInterfaceParentWrappableType(),
base::Bind(V8cGlobalInterfaceParent::CreateWrapper),
base::Bind(V8cGlobalInterfaceParent::GetTemplate));
wrapper_factory_->RegisterWrappableType(
ImplementedInterface::ImplementedInterfaceWrappableType(),
base::Bind(V8cImplementedInterface::CreateWrapper),
base::Bind(V8cImplementedInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
IndexedGetterInterface::IndexedGetterInterfaceWrappableType(),
base::Bind(V8cIndexedGetterInterface::CreateWrapper),
base::Bind(V8cIndexedGetterInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
InterfaceWithAny::InterfaceWithAnyWrappableType(),
base::Bind(V8cInterfaceWithAny::CreateWrapper),
base::Bind(V8cInterfaceWithAny::GetTemplate));
wrapper_factory_->RegisterWrappableType(
InterfaceWithAnyDictionary::InterfaceWithAnyDictionaryWrappableType(),
base::Bind(V8cInterfaceWithAnyDictionary::CreateWrapper),
base::Bind(V8cInterfaceWithAnyDictionary::GetTemplate));
wrapper_factory_->RegisterWrappableType(
InterfaceWithDate::InterfaceWithDateWrappableType(),
base::Bind(V8cInterfaceWithDate::CreateWrapper),
base::Bind(V8cInterfaceWithDate::GetTemplate));
wrapper_factory_->RegisterWrappableType(
InterfaceWithUnsupportedProperties::InterfaceWithUnsupportedPropertiesWrappableType(),
base::Bind(V8cInterfaceWithUnsupportedProperties::CreateWrapper),
base::Bind(V8cInterfaceWithUnsupportedProperties::GetTemplate));
wrapper_factory_->RegisterWrappableType(
NamedConstructorInterface::NamedConstructorInterfaceWrappableType(),
base::Bind(V8cNamedConstructorInterface::CreateWrapper),
base::Bind(V8cNamedConstructorInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
NamedGetterInterface::NamedGetterInterfaceWrappableType(),
base::Bind(V8cNamedGetterInterface::CreateWrapper),
base::Bind(V8cNamedGetterInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
NamedIndexedGetterInterface::NamedIndexedGetterInterfaceWrappableType(),
base::Bind(V8cNamedIndexedGetterInterface::CreateWrapper),
base::Bind(V8cNamedIndexedGetterInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
NestedPutForwardsInterface::NestedPutForwardsInterfaceWrappableType(),
base::Bind(V8cNestedPutForwardsInterface::CreateWrapper),
base::Bind(V8cNestedPutForwardsInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
NoConstructorInterface::NoConstructorInterfaceWrappableType(),
base::Bind(V8cNoConstructorInterface::CreateWrapper),
base::Bind(V8cNoConstructorInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
NoInterfaceObjectInterface::NoInterfaceObjectInterfaceWrappableType(),
base::Bind(V8cNoInterfaceObjectInterface::CreateWrapper),
base::Bind(V8cNoInterfaceObjectInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
NullableTypesTestInterface::NullableTypesTestInterfaceWrappableType(),
base::Bind(V8cNullableTypesTestInterface::CreateWrapper),
base::Bind(V8cNullableTypesTestInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
NumericTypesTestInterface::NumericTypesTestInterfaceWrappableType(),
base::Bind(V8cNumericTypesTestInterface::CreateWrapper),
base::Bind(V8cNumericTypesTestInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
ObjectTypeBindingsInterface::ObjectTypeBindingsInterfaceWrappableType(),
base::Bind(V8cObjectTypeBindingsInterface::CreateWrapper),
base::Bind(V8cObjectTypeBindingsInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
OperationsTestInterface::OperationsTestInterfaceWrappableType(),
base::Bind(V8cOperationsTestInterface::CreateWrapper),
base::Bind(V8cOperationsTestInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
PromiseInterface::PromiseInterfaceWrappableType(),
base::Bind(V8cPromiseInterface::CreateWrapper),
base::Bind(V8cPromiseInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
PutForwardsInterface::PutForwardsInterfaceWrappableType(),
base::Bind(V8cPutForwardsInterface::CreateWrapper),
base::Bind(V8cPutForwardsInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
SequenceUser::SequenceUserWrappableType(),
base::Bind(V8cSequenceUser::CreateWrapper),
base::Bind(V8cSequenceUser::GetTemplate));
wrapper_factory_->RegisterWrappableType(
StaticPropertiesInterface::StaticPropertiesInterfaceWrappableType(),
base::Bind(V8cStaticPropertiesInterface::CreateWrapper),
base::Bind(V8cStaticPropertiesInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
StringifierAnonymousOperationInterface::StringifierAnonymousOperationInterfaceWrappableType(),
base::Bind(V8cStringifierAnonymousOperationInterface::CreateWrapper),
base::Bind(V8cStringifierAnonymousOperationInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
StringifierAttributeInterface::StringifierAttributeInterfaceWrappableType(),
base::Bind(V8cStringifierAttributeInterface::CreateWrapper),
base::Bind(V8cStringifierAttributeInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
StringifierOperationInterface::StringifierOperationInterfaceWrappableType(),
base::Bind(V8cStringifierOperationInterface::CreateWrapper),
base::Bind(V8cStringifierOperationInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
TargetInterface::TargetInterfaceWrappableType(),
base::Bind(V8cTargetInterface::CreateWrapper),
base::Bind(V8cTargetInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
UnionTypesInterface::UnionTypesInterfaceWrappableType(),
base::Bind(V8cUnionTypesInterface::CreateWrapper),
base::Bind(V8cUnionTypesInterface::GetTemplate));
wrapper_factory_->RegisterWrappableType(
Window::WindowWrappableType(),
base::Bind(V8cWindow::CreateWrapper),
base::Bind(V8cWindow::GetTemplate));
}
} // 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