Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / V8SVGTestInterface.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 "V8SVGTestInterface.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 "core/SVGNames.h"
15 #include "core/dom/ContextFeatures.h"
16 #include "core/dom/Document.h"
17 #include "core/dom/custom/CustomElementCallbackDispatcher.h"
18 #include "platform/RuntimeEnabledFeatures.h"
19 #include "platform/TraceEvent.h"
20 #include "wtf/GetPtr.h"
21 #include "wtf/RefPtr.h"
22
23 namespace blink {
24
25 static void initializeScriptWrappableForInterface(SVGTestInterface* object)
26 {
27     if (ScriptWrappable::wrapperCanBeStoredInObject(object))
28         ScriptWrappable::fromObject(object)->setTypeInfo(&V8SVGTestInterface::wrapperTypeInfo);
29     else
30         ASSERT_NOT_REACHED();
31 }
32
33 } // namespace blink
34
35 void webCoreInitializeScriptWrappableForInterface(blink::SVGTestInterface* object)
36 {
37     blink::initializeScriptWrappableForInterface(object);
38 }
39
40 namespace blink {
41 const WrapperTypeInfo V8SVGTestInterface::wrapperTypeInfo = { gin::kEmbedderBlink, V8SVGTestInterface::domTemplate, V8SVGTestInterface::derefObject, 0, 0, 0, V8SVGTestInterface::installConditionallyEnabledMethods, 0, WrapperTypeObjectPrototype, RefCountedObject };
42
43 namespace SVGTestInterfaceV8Internal {
44
45 template <typename T> void V8_USE(T) { }
46
47 static void typeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
48 {
49     v8::Handle<v8::Object> holder = info.Holder();
50     SVGTestInterface* impl = V8SVGTestInterface::toNative(holder);
51     v8SetReturnValueString(info, impl->fastGetAttribute(SVGNames::typeAttr), info.GetIsolate());
52 }
53
54 static void typeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
55 {
56     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
57     SVGTestInterfaceV8Internal::typeAttributeGetter(info);
58     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
59 }
60
61 static void typeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
62 {
63     v8::Handle<v8::Object> holder = info.Holder();
64     SVGTestInterface* impl = V8SVGTestInterface::toNative(holder);
65     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
66     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
67     impl->setAttribute(SVGNames::typeAttr, cppValue);
68 }
69
70 static void typeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
71 {
72     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
73     CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
74     SVGTestInterfaceV8Internal::typeAttributeSetter(v8Value, info);
75     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
76 }
77
78 } // namespace SVGTestInterfaceV8Internal
79
80 static const V8DOMConfiguration::AttributeConfiguration V8SVGTestInterfaceAttributes[] = {
81     {"type", SVGTestInterfaceV8Internal::typeAttributeGetterCallback, SVGTestInterfaceV8Internal::typeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
82 };
83
84 static void installV8SVGTestInterfaceTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
85 {
86     functionTemplate->ReadOnlyPrototype();
87
88     v8::Local<v8::Signature> defaultSignature;
89     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "SVGTestInterface", v8::Local<v8::FunctionTemplate>(), V8SVGTestInterface::internalFieldCount,
90         V8SVGTestInterfaceAttributes, WTF_ARRAY_LENGTH(V8SVGTestInterfaceAttributes),
91         0, 0,
92         0, 0,
93         isolate);
94     v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
95     v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
96
97     // Custom toString template
98     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
99 }
100
101 v8::Handle<v8::FunctionTemplate> V8SVGTestInterface::domTemplate(v8::Isolate* isolate)
102 {
103     return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8SVGTestInterfaceTemplate);
104 }
105
106 bool V8SVGTestInterface::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
107 {
108     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
109 }
110
111 v8::Handle<v8::Object> V8SVGTestInterface::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
112 {
113     return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
114 }
115
116 SVGTestInterface* V8SVGTestInterface::toNativeWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
117 {
118     return hasInstance(value, isolate) ? fromInternalPointer(blink::toInternalPointer(v8::Handle<v8::Object>::Cast(value))) : 0;
119 }
120
121 v8::Handle<v8::Object> wrap(SVGTestInterface* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
122 {
123     ASSERT(impl);
124     ASSERT(!DOMDataStore::containsWrapper<V8SVGTestInterface>(impl, isolate));
125     return V8SVGTestInterface::createWrapper(impl, creationContext, isolate);
126 }
127
128 v8::Handle<v8::Object> V8SVGTestInterface::createWrapper(PassRefPtr<SVGTestInterface> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
129 {
130     ASSERT(impl);
131     ASSERT(!DOMDataStore::containsWrapper<V8SVGTestInterface>(impl.get(), isolate));
132     if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
133         const WrapperTypeInfo* actualInfo = ScriptWrappable::fromObject(impl.get())->typeInfo();
134         // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapperTypeInfo. These will both have
135         // the same object de-ref functions, though, so use that as the basis of the check.
136         RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
137     }
138
139     v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
140     if (UNLIKELY(wrapper.IsEmpty()))
141         return wrapper;
142
143     installConditionallyEnabledProperties(wrapper, isolate);
144     V8DOMWrapper::associateObjectWithWrapper<V8SVGTestInterface>(impl, &wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Dependent);
145     return wrapper;
146 }
147
148 void V8SVGTestInterface::derefObject(ScriptWrappableBase* internalPointer)
149 {
150     fromInternalPointer(internalPointer)->deref();
151 }
152
153 template<>
154 v8::Handle<v8::Value> toV8NoInline(SVGTestInterface* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
155 {
156     return toV8(impl, creationContext, isolate);
157 }
158
159 } // namespace blink