1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
8 #include "V8TestInterfaceNamedConstructor2.h"
10 #include "bindings/core/v8/ExceptionState.h"
11 #include "bindings/core/v8/V8DOMConfiguration.h"
12 #include "bindings/core/v8/V8HiddenValue.h"
13 #include "bindings/core/v8/V8ObjectConstructor.h"
14 #include "core/dom/ContextFeatures.h"
15 #include "core/dom/Document.h"
16 #include "core/frame/LocalDOMWindow.h"
17 #include "platform/RuntimeEnabledFeatures.h"
18 #include "platform/TraceEvent.h"
19 #include "wtf/GetPtr.h"
20 #include "wtf/RefPtr.h"
24 const WrapperTypeInfo V8TestInterfaceNamedConstructor2::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceNamedConstructor2::domTemplate, V8TestInterfaceNamedConstructor2::refObject, V8TestInterfaceNamedConstructor2::derefObject, V8TestInterfaceNamedConstructor2::createPersistentHandle, 0, 0, 0, V8TestInterfaceNamedConstructor2::installConditionallyEnabledMethods, V8TestInterfaceNamedConstructor2::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject };
26 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfaceNamedConstructor2.h.
27 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
28 // bindings/core/v8/ScriptWrappable.h.
29 const WrapperTypeInfo& TestInterfaceNamedConstructor2::s_wrapperTypeInfo = V8TestInterfaceNamedConstructor2::wrapperTypeInfo;
31 namespace TestInterfaceNamedConstructor2V8Internal {
33 template <typename T> void V8_USE(T) { }
35 } // namespace TestInterfaceNamedConstructor2V8Internal
37 const WrapperTypeInfo V8TestInterfaceNamedConstructor2Constructor::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceNamedConstructor2Constructor::domTemplate, V8TestInterfaceNamedConstructor2::refObject, V8TestInterfaceNamedConstructor2::derefObject, V8TestInterfaceNamedConstructor2::createPersistentHandle, 0, 0, 0, V8TestInterfaceNamedConstructor2::installConditionallyEnabledMethods, V8TestInterfaceNamedConstructor2::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject };
39 static void V8TestInterfaceNamedConstructor2ConstructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
41 if (!info.IsConstructCall()) {
42 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Audio"), info.GetIsolate());
46 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) {
47 v8SetReturnValue(info, info.Holder());
50 if (UNLIKELY(info.Length() < 1)) {
51 V8ThrowException::throwException(createMinimumArityTypeErrorForConstructor("TestInterfaceNamedConstructor2", 1, info.Length(), info.GetIsolate()), info.GetIsolate());
54 V8StringResource<> stringArg;
56 TOSTRING_VOID_INTERNAL(stringArg, info[0]);
58 RefPtr<TestInterfaceNamedConstructor2> impl = TestInterfaceNamedConstructor2::createForJSConstructor(stringArg);
59 v8::Handle<v8::Object> wrapper = info.Holder();
60 impl->associateWithWrapper(&V8TestInterfaceNamedConstructor2Constructor::wrapperTypeInfo, wrapper, info.GetIsolate());
61 v8SetReturnValue(info, wrapper);
64 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNamedConstructor2Constructor::domTemplate(v8::Isolate* isolate)
66 static int domTemplateKey; // This address is used for a key to look up the dom template.
67 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
68 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTemplateKey);
69 if (!result.IsEmpty())
72 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate");
73 result = v8::FunctionTemplate::New(isolate, V8TestInterfaceNamedConstructor2ConstructorCallback);
74 v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
75 instanceTemplate->SetInternalFieldCount(V8TestInterfaceNamedConstructor2::internalFieldCount);
76 result->SetClassName(v8AtomicString(isolate, "TestInterfaceNamedConstructor2"));
77 result->Inherit(V8TestInterfaceNamedConstructor2::domTemplate(isolate));
78 data->setDOMTemplate(&domTemplateKey, result);
82 static void installV8TestInterfaceNamedConstructor2Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
84 functionTemplate->ReadOnlyPrototype();
86 v8::Local<v8::Signature> defaultSignature;
87 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceNamedConstructor2", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceNamedConstructor2::internalFieldCount,
92 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
93 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
95 // Custom toString template
96 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
99 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNamedConstructor2::domTemplate(v8::Isolate* isolate)
101 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterfaceNamedConstructor2Template);
104 bool V8TestInterfaceNamedConstructor2::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
106 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
109 v8::Handle<v8::Object> V8TestInterfaceNamedConstructor2::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
111 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
114 TestInterfaceNamedConstructor2* V8TestInterfaceNamedConstructor2::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
116 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceNamedConstructor2>() : 0;
120 void V8TestInterfaceNamedConstructor2::refObject(ScriptWrappableBase* internalPointer)
122 internalPointer->toImpl<TestInterfaceNamedConstructor2>()->ref();
125 void V8TestInterfaceNamedConstructor2::derefObject(ScriptWrappableBase* internalPointer)
127 internalPointer->toImpl<TestInterfaceNamedConstructor2>()->deref();
130 WrapperPersistentNode* V8TestInterfaceNamedConstructor2::createPersistentHandle(ScriptWrappableBase* internalPointer)
132 ASSERT_NOT_REACHED();
137 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNamedConstructor2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
139 return toV8(impl, creationContext, isolate);