Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / core / V8TestInterfaceNotScriptWrappable.cpp
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.
4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6
7 #include "config.h"
8 #include "V8TestInterfaceNotScriptWrappable.h"
9
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"
21
22 namespace blink {
23
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 };
25
26 namespace TestInterfaceNotScriptWrappableV8Internal {
27
28 template <typename T> void V8_USE(T) { }
29
30 static void attr1AttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
31 {
32     v8::Handle<v8::Object> holder = info.Holder();
33     TestInterfaceNotScriptWrappable* impl = V8TestInterfaceNotScriptWrappable::toImpl(holder);
34     v8SetReturnValueFast(info, WTF::getPtr(impl->attr1()), impl);
35 }
36
37 static void attr1AttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
38 {
39     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
40     TestInterfaceNotScriptWrappableV8Internal::attr1AttributeGetter(info);
41     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
42 }
43
44 static void attr1AttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
45 {
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));
50 }
51
52 static void attr1AttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
53 {
54     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
55     TestInterfaceNotScriptWrappableV8Internal::attr1AttributeSetter(v8Value, info);
56     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
57 }
58
59 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
60 {
61     if (UNLIKELY(info.Length() < 1)) {
62         V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("func", "TestInterfaceNotScriptWrappable", 1, info.Length(), info.GetIsolate()), info.GetIsolate());
63         return;
64     }
65     TestInterfaceNotScriptWrappable* impl = V8TestInterfaceNotScriptWrappable::toImpl(info.Holder());
66     TestInterfaceNotScriptWrappable* arg;
67     {
68         arg = V8TestInterfaceNotScriptWrappable::toImplWithTypeCheck(info.GetIsolate(), info[0]);
69     }
70     impl->func(arg);
71 }
72
73 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
74 {
75     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
76     TestInterfaceNotScriptWrappableV8Internal::funcMethod(info);
77     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
78 }
79
80 } // namespace TestInterfaceNotScriptWrappableV8Internal
81
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},
84 };
85
86 static const V8DOMConfiguration::MethodConfiguration V8TestInterfaceNotScriptWrappableMethods[] = {
87     {"func", TestInterfaceNotScriptWrappableV8Internal::funcMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
88 };
89
90 static void installV8TestInterfaceNotScriptWrappableTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
91 {
92     functionTemplate->ReadOnlyPrototype();
93
94     v8::Local<v8::Signature> defaultSignature;
95     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceNotScriptWrappable", v8::Local<v8::FunctionTemplate>(), V8TestInterfaceNotScriptWrappable::internalFieldCount,
96         V8TestInterfaceNotScriptWrappableAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceNotScriptWrappableAttributes),
97         0, 0,
98         V8TestInterfaceNotScriptWrappableMethods, WTF_ARRAY_LENGTH(V8TestInterfaceNotScriptWrappableMethods),
99         isolate);
100     v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
101     v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
102
103     // Custom toString template
104     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
105 }
106
107 v8::Handle<v8::FunctionTemplate> V8TestInterfaceNotScriptWrappable::domTemplate(v8::Isolate* isolate)
108 {
109     return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterfaceNotScriptWrappableTemplate);
110 }
111
112 bool V8TestInterfaceNotScriptWrappable::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
113 {
114     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
115 }
116
117 v8::Handle<v8::Object> V8TestInterfaceNotScriptWrappable::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
118 {
119     return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
120 }
121
122 TestInterfaceNotScriptWrappable* V8TestInterfaceNotScriptWrappable::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
123 {
124     return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceNotScriptWrappable>() : 0;
125 }
126
127 v8::Handle<v8::Object> wrap(TestInterfaceNotScriptWrappable* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
128 {
129     ASSERT(impl);
130     ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNotScriptWrappable>(impl, isolate));
131     return V8TestInterfaceNotScriptWrappable::createWrapper(impl, creationContext, isolate);
132 }
133
134 v8::Handle<v8::Object> V8TestInterfaceNotScriptWrappable::createWrapper(PassRefPtr<TestInterfaceNotScriptWrappable> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
135 {
136     ASSERT(impl);
137     ASSERT(!DOMDataStore::containsWrapper<V8TestInterfaceNotScriptWrappable>(impl.get(), isolate));
138
139     v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, impl->toScriptWrappableBase(), isolate);
140     if (UNLIKELY(wrapper.IsEmpty()))
141         return wrapper;
142
143     installConditionallyEnabledProperties(wrapper, isolate);
144     V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceNotScriptWrappable>(impl, &wrapperTypeInfo, wrapper, isolate);
145     return wrapper;
146 }
147
148
149 void V8TestInterfaceNotScriptWrappable::refObject(ScriptWrappableBase* internalPointer)
150 {
151     internalPointer->toImpl<TestInterfaceNotScriptWrappable>()->ref();
152 }
153
154 void V8TestInterfaceNotScriptWrappable::derefObject(ScriptWrappableBase* internalPointer)
155 {
156     internalPointer->toImpl<TestInterfaceNotScriptWrappable>()->deref();
157 }
158
159 WrapperPersistentNode* V8TestInterfaceNotScriptWrappable::createPersistentHandle(ScriptWrappableBase* internalPointer)
160 {
161     ASSERT_NOT_REACHED();
162     return 0;
163 }
164
165 template<>
166 v8::Handle<v8::Value> toV8NoInline(TestInterfaceNotScriptWrappable* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
167 {
168     return toV8(impl, creationContext, isolate);
169 }
170
171 } // namespace blink