| Index: Source/bindings/tests/results/V8TestInterfaceConstructor3.cpp
|
| diff --git a/Source/bindings/tests/results/V8TestInterfacePython2.cpp b/Source/bindings/tests/results/V8TestInterfaceConstructor3.cpp
|
| similarity index 60%
|
| copy from Source/bindings/tests/results/V8TestInterfacePython2.cpp
|
| copy to Source/bindings/tests/results/V8TestInterfaceConstructor3.cpp
|
| index db791d8678c3d284bc6c3ee1354c9ce206b08825..26b2909f537e6beb6419d5ee3c52eab9c0d78f9e 100644
|
| --- a/Source/bindings/tests/results/V8TestInterfacePython2.cpp
|
| +++ b/Source/bindings/tests/results/V8TestInterfaceConstructor3.cpp
|
| @@ -31,23 +31,22 @@
|
| // This file has been auto-generated by code_generator_v8.pm. DO NOT MODIFY!
|
|
|
| #include "config.h"
|
| -#include "V8TestInterfacePython2.h"
|
| +#include "V8TestInterfaceConstructor3.h"
|
|
|
| #include "RuntimeEnabledFeatures.h"
|
| -#include "V8Interface1.h"
|
| -#include "V8Interface2.h"
|
| #include "bindings/v8/ExceptionState.h"
|
| #include "bindings/v8/V8DOMConfiguration.h"
|
| +#include "bindings/v8/V8ObjectConstructor.h"
|
| #include "core/dom/ContextFeatures.h"
|
| #include "core/dom/Document.h"
|
| #include "platform/TraceEvent.h"
|
|
|
| namespace WebCore {
|
|
|
| -static void initializeScriptWrappableForInterface(TestInterfacePython2* object)
|
| +static void initializeScriptWrappableForInterface(TestInterfaceConstructor3* object)
|
| {
|
| if (ScriptWrappable::wrapperCanBeStoredInObject(object))
|
| - ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfacePython2::wrapperTypeInfo);
|
| + ScriptWrappable::setTypeInfoInObject(object, &V8TestInterfaceConstructor3::wrapperTypeInfo);
|
| else
|
| ASSERT_NOT_REACHED();
|
| }
|
| @@ -58,30 +57,62 @@ static void initializeScriptWrappableForInterface(TestInterfacePython2* object)
|
| // the local declaration does not pick up the surrounding namespace. Therefore, we provide this function
|
| // in the global namespace.
|
| // (More info on the MSVC bug here: http://connect.microsoft.com/VisualStudio/feedback/details/664619/the-namespace-of-local-function-declarations-in-c)
|
| -void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfacePython2* object)
|
| +void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterfaceConstructor3* object)
|
| {
|
| WebCore::initializeScriptWrappableForInterface(object);
|
| }
|
|
|
| namespace WebCore {
|
| -const WrapperTypeInfo V8TestInterfacePython2::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfacePython2::domTemplate, V8TestInterfacePython2::derefObject, 0, 0, V8TestInterfacePython2::visitDOMWrapper, V8TestInterfacePython2::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype };
|
| +const WrapperTypeInfo V8TestInterfaceConstructor3::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceConstructor3::domTemplate, V8TestInterfaceConstructor3::derefObject, 0, 0, 0, V8TestInterfaceConstructor3::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype };
|
|
|
| -namespace TestInterfacePython2V8Internal {
|
| +namespace TestInterfaceConstructor3V8Internal {
|
|
|
| template <typename T> void V8_USE(T) { }
|
|
|
| -} // namespace TestInterfacePython2V8Internal
|
| +static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| +{
|
| + if (UNLIKELY(info.Length() < 1)) {
|
| + throwTypeError(ExceptionMessages::failedToExecute("Constructor", "TestInterfaceConstructor3", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate());
|
| + return;
|
| + }
|
| + V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]);
|
| + RefPtr<TestInterfaceConstructor3> impl = TestInterfaceConstructor3::create(stringArg);
|
| + v8::Handle<v8::Object> wrapper = info.Holder();
|
| +
|
| + V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor3>(impl.release(), &V8TestInterfaceConstructor3::wrapperTypeInfo, wrapper, info.GetIsolate(), WrapperConfiguration::Dependent);
|
| + v8SetReturnValue(info, wrapper);
|
| +}
|
| +
|
| +} // namespace TestInterfaceConstructor3V8Internal
|
|
|
| -static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfacePython2Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| +void V8TestInterfaceConstructor3::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
|
| +{
|
| + TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
|
| + if (!info.IsConstructCall()) {
|
| + throwTypeError(ExceptionMessages::failedToConstruct("TestInterfaceConstructor3", "Please use the 'new' operator, this DOM object constructor cannot be called as a function."), info.GetIsolate());
|
| + return;
|
| + }
|
| +
|
| + if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
|
| + v8SetReturnValue(info, info.Holder());
|
| + return;
|
| + }
|
| +
|
| + TestInterfaceConstructor3V8Internal::constructor(info);
|
| +}
|
| +
|
| +static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceConstructor3Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| {
|
| functionTemplate->ReadOnlyPrototype();
|
|
|
| v8::Local<v8::Signature> defaultSignature;
|
| - defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfacePython2", v8::Local<v8::FunctionTemplate>(), V8TestInterfacePython2::internalFieldCount,
|
| + defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceConstructor3", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceConstructor3::internalFieldCount,
|
| 0, 0,
|
| 0, 0,
|
| 0, 0,
|
| isolate, currentWorldType);
|
| + functionTemplate->SetCallHandler(V8TestInterfaceConstructor3::constructorCallback);
|
| + functionTemplate->SetLength(1);
|
| v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTemplate->InstanceTemplate();
|
| v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTemplate->PrototypeTemplate();
|
|
|
| @@ -90,7 +121,7 @@ static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfacePython2Template(
|
| return functionTemplate;
|
| }
|
|
|
| -v8::Handle<v8::FunctionTemplate> V8TestInterfacePython2::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| +v8::Handle<v8::FunctionTemplate> V8TestInterfaceConstructor3::domTemplate(v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| {
|
| V8PerIsolateData* data = V8PerIsolateData::from(isolate);
|
| V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWorldType).find(&wrapperTypeInfo);
|
| @@ -100,38 +131,27 @@ v8::Handle<v8::FunctionTemplate> V8TestInterfacePython2::domTemplate(v8::Isolate
|
| TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
|
| v8::EscapableHandleScope handleScope(isolate);
|
| v8::Local<v8::FunctionTemplate> templ =
|
| - ConfigureV8TestInterfacePython2Template(data->rawDOMTemplate(&wrapperTypeInfo, currentWorldType), isolate, currentWorldType);
|
| + ConfigureV8TestInterfaceConstructor3Template(data->rawDOMTemplate(&wrapperTypeInfo, currentWorldType), isolate, currentWorldType);
|
| data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTemplate>(isolate, templ));
|
| return handleScope.Escape(templ);
|
| }
|
|
|
| -bool V8TestInterfacePython2::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| +bool V8TestInterfaceConstructor3::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate, WrapperWorldType currentWorldType)
|
| {
|
| return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValue, currentWorldType);
|
| }
|
|
|
| -bool V8TestInterfacePython2::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
|
| +bool V8TestInterfaceConstructor3::hasInstanceInAnyWorld(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate)
|
| {
|
| return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValue, MainWorld)
|
| || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValue, IsolatedWorld)
|
| || V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValue, WorkerWorld);
|
| }
|
|
|
| -v8::Handle<v8::Object> wrap(TestInterfacePython2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| -{
|
| - ASSERT(impl);
|
| - if (impl->isInterface1())
|
| - return wrap(toInterface1(impl), creationContext, isolate);
|
| - if (impl->isInterface2())
|
| - return wrap(toInterface2(impl), creationContext, isolate);
|
| - v8::Handle<v8::Object> wrapper = V8TestInterfacePython2::createWrapper(impl, creationContext, isolate);
|
| - return wrapper;
|
| -}
|
| -
|
| -v8::Handle<v8::Object> V8TestInterfacePython2::createWrapper(PassRefPtr<TestInterfacePython2> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| +v8::Handle<v8::Object> V8TestInterfaceConstructor3::createWrapper(PassRefPtr<TestInterfaceConstructor3> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| {
|
| ASSERT(impl);
|
| - ASSERT(!DOMDataStore::containsWrapper<V8TestInterfacePython2>(impl.get(), isolate));
|
| + ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceConstructor3>(impl.get(), isolate));
|
| if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
|
| const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl.get());
|
| // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
|
| @@ -144,17 +164,17 @@ v8::Handle<v8::Object> V8TestInterfacePython2::createWrapper(PassRefPtr<TestInte
|
| return wrapper;
|
|
|
| installPerContextEnabledProperties(wrapper, impl.get(), isolate);
|
| - V8DOMWrapper::associateObjectWithWrapper<V8TestInterfacePython2>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
|
| + V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceConstructor3>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent);
|
| return wrapper;
|
| }
|
|
|
| -void V8TestInterfacePython2::derefObject(void* object)
|
| +void V8TestInterfaceConstructor3::derefObject(void* object)
|
| {
|
| fromInternalPointer(object)->deref();
|
| }
|
|
|
| template<>
|
| -v8::Handle<v8::Value> toV8NoInline(TestInterfacePython2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| +v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor3* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| {
|
| return toV8(impl, creationContext, isolate);
|
| }
|
|
|