a596435723c2a63cdfac5154857a0432f7926df4
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / core / 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/CustomElementProcessingStack.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 const WrapperTypeInfo V8SVGTestInterface::wrapperTypeInfo = { gin::kEmbedderBlink, V8SVGTestInterface::domTemplate, V8SVGTestInterface::refObject, V8SVGTestInterface::derefObject, V8SVGTestInterface::trace, 0, 0, 0, V8SVGTestInterface::installConditionallyEnabledMethods, V8SVGTestInterface::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Dependent, WrapperTypeInfo::RefCountedObject };
26
27 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in SVGTestInterface.h.
28 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
29 // bindings/core/v8/ScriptWrappable.h.
30 const WrapperTypeInfo& SVGTestInterface::s_wrapperTypeInfo = V8SVGTestInterface::wrapperTypeInfo;
31
32 namespace SVGTestInterfaceV8Internal {
33
34 static void typeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
35 {
36     v8::Handle<v8::Object> holder = info.Holder();
37     SVGTestInterface* impl = V8SVGTestInterface::toImpl(holder);
38     v8SetReturnValueString(info, impl->fastGetAttribute(SVGNames::typeAttr), info.GetIsolate());
39 }
40
41 static void typeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
42 {
43     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
44     SVGTestInterfaceV8Internal::typeAttributeGetter(info);
45     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
46 }
47
48 static void typeAttributeSetter(v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
49 {
50     v8::Handle<v8::Object> holder = info.Holder();
51     SVGTestInterface* impl = V8SVGTestInterface::toImpl(holder);
52     TOSTRING_VOID(V8StringResource<>, cppValue, v8Value);
53     CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
54     impl->setAttribute(SVGNames::typeAttr, cppValue);
55 }
56
57 static void typeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
58 {
59     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter");
60     CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
61     SVGTestInterfaceV8Internal::typeAttributeSetter(v8Value, info);
62     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
63 }
64
65 } // namespace SVGTestInterfaceV8Internal
66
67 static const V8DOMConfiguration::AttributeConfiguration V8SVGTestInterfaceAttributes[] = {
68     {"type", SVGTestInterfaceV8Internal::typeAttributeGetterCallback, SVGTestInterfaceV8Internal::typeAttributeSetterCallback, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
69 };
70
71 static void installV8SVGTestInterfaceTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
72 {
73     functionTemplate->ReadOnlyPrototype();
74
75     v8::Local<v8::Signature> defaultSignature;
76     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "SVGTestInterface", v8::Local<v8::FunctionTemplate>(), V8SVGTestInterface::internalFieldCount,
77         V8SVGTestInterfaceAttributes, WTF_ARRAY_LENGTH(V8SVGTestInterfaceAttributes),
78         0, 0,
79         0, 0,
80         isolate);
81     v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
82     ALLOW_UNUSED_LOCAL(instanceTemplate);
83     v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
84     ALLOW_UNUSED_LOCAL(prototypeTemplate);
85
86     // Custom toString template
87     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
88 }
89
90 v8::Handle<v8::FunctionTemplate> V8SVGTestInterface::domTemplate(v8::Isolate* isolate)
91 {
92     return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8SVGTestInterfaceTemplate);
93 }
94
95 bool V8SVGTestInterface::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
96 {
97     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
98 }
99
100 v8::Handle<v8::Object> V8SVGTestInterface::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
101 {
102     return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
103 }
104
105 SVGTestInterface* V8SVGTestInterface::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
106 {
107     return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<SVGTestInterface>() : 0;
108 }
109
110 void V8SVGTestInterface::refObject(ScriptWrappableBase* scriptWrappableBase)
111 {
112     scriptWrappableBase->toImpl<SVGTestInterface>()->ref();
113 }
114
115 void V8SVGTestInterface::derefObject(ScriptWrappableBase* scriptWrappableBase)
116 {
117     scriptWrappableBase->toImpl<SVGTestInterface>()->deref();
118 }
119
120 template<>
121 v8::Handle<v8::Value> toV8NoInline(SVGTestInterface* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
122 {
123     return toV8(impl, creationContext, isolate);
124 }
125
126 } // namespace blink