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 "V8TestInterfaceNotScriptWrappable.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 "bindings/core/v8/V8TestInterfaceNotScriptWrappable.h"
15 #include "core/dom/ContextFeatures.h"
16 #include "core/dom/Document.h"
17 #include "platform/RuntimeEnabledFeatures.h"
18 #include "platform/TraceEvent.h"
19 #include "wtf/GetPtr.h"
20 #include "wtf/RefPtr.h"
24 const WrapperTypeInfo V8TestInterfaceNotScriptWrappable::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceNotScriptWrappable::domTemplate, V8TestInterfaceNotScriptWrappable::refObject, V8TestInterfaceNotScriptWrappable::derefObject, V8TestInterfaceNotScriptWrappable::createPersistentHandle, 0, 0, 0, V8TestInterfaceNotScriptWrappable::installConditionallyEnabledMethods, V8TestInterfaceNotScriptWrappable::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject };
26 namespace TestInterfaceNotScriptWrappableV8Internal {
28 template <typename T> void V8_USE(T) { }
30 static void attr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
32 v8::Handle<v8::Object> holder = info.Holder();
33 TestInterfaceNotScriptWrappable* impl = V8TestInterfaceNotScriptWrappable::toImpl(holder);
34 v8SetReturnValueFast(info, WTF::getPtr(impl->attr1()), impl);
37 static void attr1AttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
39 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
40 TestInterfaceNotScriptWrappableV8Internal::attr1AttributeGetter(info);
41 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
44 static void attr1AttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
46 v8::Handle<v8::Object> holder = info.Holder();
47 TestInterfaceNotScriptWrappable* impl = V8TestInterfaceNotScriptWrappable::toImpl(holder);
48 TestInterfaceNotScriptWrappable* cppValue = V8TestInterfaceNotScriptWrappable::toImplWithTypeCheck(info.GetIsolate(), v8Value);
49 impl->setAttr1(WTF::getPtr(cppValue));
52 static void attr1AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
54 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
55 TestInterfaceNotScriptWrappableV8Internal::attr1AttributeSetter(v8Value, info);
56 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
59 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
61 if (UNLIKELY(info.Length() < 1)) {
62 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("func", "TestInterfaceNotScriptWrappable", 1, info.Length(), info.GetIsolate()), info.GetIsolate());
65 TestInterfaceNotScriptWrappable* impl = V8TestInterfaceNotScriptWrappable::toImpl(info.Holder());
66 TestInterfaceNotScriptWrappable* arg;
68 arg = V8TestInterfaceNotScriptWrappable::toImplWithTypeCheck(info.GetIsolate(), info[0]);
73 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
75 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
76 TestInterfaceNotScriptWrappableV8Internal::funcMethod(info);
77 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
80 } // namespace TestInterfaceNotScriptWrappableV8Internal
82 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceNotScriptWrappableAttributes[] = {
83 {"attr1", TestInterfaceNotScriptWrappableV8Internal::attr1AttributeGetterCallback, TestInterfaceNotScriptWrappableV8Internal::attr1AttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
86 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceNotScriptWrappableMethods[] = {
87 {"func", TestInterfaceNotScriptWrappableV8Internal::funcMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
90 static void installV8TestInterfaceNotScriptWrappableTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
92 functionTemplate->ReadOnlyPrototype();
94 v8::Local<v8::Signature> defaultSignature;
95 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceNotScriptWrappable", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceNotScriptWrappable::internalFieldCount,
96 V8TestInterfaceNotScriptWrappableAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceNotScriptWrappableAttributes),
98 V8TestInterfaceNotScriptWrappableMethods, WTF_ARRAY_LENGTH(V8TestInterfaceNotScriptWrappableMethods),
100 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
101 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
103 // Custom toString template
104 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
107 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNotScriptWrappable::domTemplate(v8::Isolate* isolate)
109 return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterfaceNotScriptWrappableTemplate);
112 bool V8TestInterfaceNotScriptWrappable::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
114 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
117 v8::Handle<v8::Object> V8TestInterfaceNotScriptWrappable::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
119 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
122 TestInterfaceNotScriptWrappable* V8TestInterfaceNotScriptWrappable::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
124 return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceNotScriptWrappable>() : 0;
127 v8::Handle<v8::Object> wrap(TestInterfaceNotScriptWrappable* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
130 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNotScriptWrappable>(impl, isolate));
131 return V8TestInterfaceNotScriptWrappable::createWrapper(impl, creationContext, isolate);
134 v8::Handle<v8::Object> V8TestInterfaceNotScriptWrappable::createWrapper(PassRefPtr<TestInterfaceNotScriptWrappable> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
137 ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNotScriptWrappable>(impl.get(), isolate));
139 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, impl->toScriptWrappableBase(), isolate);
140 if (UNLIKELY(wrapper.IsEmpty()))
143 installConditionallyEnabledProperties(wrapper, isolate);
144 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNotScriptWrappable>(impl, &wrapperTypeInfo, wrapper, isolate);
149 void V8TestInterfaceNotScriptWrappable::refObject(ScriptWrappableBase* internalPointer)
151 internalPointer->toImpl<TestInterfaceNotScriptWrappable>()->ref();
154 void V8TestInterfaceNotScriptWrappable::derefObject(ScriptWrappableBase* internalPointer)
156 internalPointer->toImpl<TestInterfaceNotScriptWrappable>()->deref();
159 WrapperPersistentNode* V8TestInterfaceNotScriptWrappable::createPersistentHandle(ScriptWrappableBase* internalPointer)
161 ASSERT_NOT_REACHED();
166 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNotScriptWrappable* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
168 return toV8(impl, creationContext, isolate);