Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / core / V8TestInterfaceEventTarget.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 "V8TestInterfaceEventTarget.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/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"
21
22 namespace blink {
23
24 const WrapperTypeInfo V8TestInterfaceEventTarget::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceEventTarget::domTemplate, V8TestInterfaceEventTarget::refObject, V8TestInterfaceEventTarget::derefObject, V8TestInterfaceEventTarget::trace, 0, V8TestInterfaceEventTarget::toEventTarget, 0, V8TestInterfaceEventTarget::installConditionallyEnabledMethods, V8TestInterfaceEventTarget::installConditionallyEnabledProperties, &V8EventTarget::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::WillBeGarbageCollectedObject };
25
26 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfaceEventTarget.h.
27 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
28 // bindings/core/v8/ScriptWrappable.h.
29 const WrapperTypeInfo& TestInterfaceEventTarget::s_wrapperTypeInfo = V8TestInterfaceEventTarget::wrapperTypeInfo;
30
31 namespace TestInterfaceEventTargetV8Internal {
32
33 } // namespace TestInterfaceEventTargetV8Internal
34
35 const WrapperTypeInfo V8TestInterfaceEventTargetConstructor::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceEventTargetConstructor::domTemplate, V8TestInterfaceEventTarget::refObject, V8TestInterfaceEventTarget::derefObject, V8TestInterfaceEventTarget::trace, 0, V8TestInterfaceEventTarget::toEventTarget, 0, V8TestInterfaceEventTarget::installConditionallyEnabledMethods, V8TestInterfaceEventTarget::installConditionallyEnabledProperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::WillBeGarbageCollectedObject };
36
37 static void V8TestInterfaceEventTargetConstructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
38 {
39     if (!info.IsConstructCall()) {
40         V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::constructorNotCallableAsFunction("Name"));
41         return;
42     }
43
44     if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) {
45         v8SetReturnValue(info, info.Holder());
46         return;
47     }
48     Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));
49     RefPtrWillBeRawPtr<TestInterfaceEventTarget> impl = TestInterfaceEventTarget::createForJSConstructor(document);
50     v8::Handle<v8::Object> wrapper = info.Holder();
51     impl->associateWithWrapper(&V8TestInterfaceEventTargetConstructor::wrapperTypeInfo, wrapper, info.GetIsolate());
52     v8SetReturnValue(info, wrapper);
53 }
54
55 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEventTargetConstructor::domTemplate(v8::Isolate* isolate)
56 {
57     static int domTemplateKey; // This address is used for a key to look up the dom template.
58     V8PerIsolateData* data = V8PerIsolateData::from(isolate);
59     v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(&domTemplateKey);
60     if (!result.IsEmpty())
61         return result;
62
63     TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate");
64     result = v8::FunctionTemplate::New(isolate, V8TestInterfaceEventTargetConstructorCallback);
65     v8::Local<v8::ObjectTemplate> instanceTemplate = result->InstanceTemplate();
66     instanceTemplate->SetInternalFieldCount(V8TestInterfaceEventTarget::internalFieldCount);
67     result->SetClassName(v8AtomicString(isolate, "TestInterfaceEventTarget"));
68     result->Inherit(V8TestInterfaceEventTarget::domTemplate(isolate));
69     data->setDOMTemplate(&domTemplateKey, result);
70     return result;
71 }
72
73 static void installV8TestInterfaceEventTargetTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
74 {
75     functionTemplate->ReadOnlyPrototype();
76
77     v8::Local<v8::Signature> defaultSignature;
78     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceEventTarget", V8EventTarget::domTemplate(isolate), V8TestInterfaceEventTarget::internalFieldCount,
79         0, 0,
80         0, 0,
81         0, 0,
82         isolate);
83     v8::Local<v8::ObjectTemplate> instanceTemplate = functionTemplate->InstanceTemplate();
84     ALLOW_UNUSED_LOCAL(instanceTemplate);
85     v8::Local<v8::ObjectTemplate> prototypeTemplate = functionTemplate->PrototypeTemplate();
86     ALLOW_UNUSED_LOCAL(prototypeTemplate);
87
88     // Custom toString template
89     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
90 }
91
92 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEventTarget::domTemplate(v8::Isolate* isolate)
93 {
94     return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterfaceEventTargetTemplate);
95 }
96
97 bool V8TestInterfaceEventTarget::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
98 {
99     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
100 }
101
102 v8::Handle<v8::Object> V8TestInterfaceEventTarget::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
103 {
104     return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
105 }
106
107 TestInterfaceEventTarget* V8TestInterfaceEventTarget::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
108 {
109     return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceEventTarget>() : 0;
110 }
111
112 EventTarget* V8TestInterfaceEventTarget::toEventTarget(v8::Handle<v8::Object> object)
113 {
114     return toImpl(object);
115 }
116
117 void V8TestInterfaceEventTarget::refObject(ScriptWrappableBase* scriptWrappableBase)
118 {
119 #if !ENABLE(OILPAN)
120     scriptWrappableBase->toImpl<TestInterfaceEventTarget>()->ref();
121 #endif
122 }
123
124 void V8TestInterfaceEventTarget::derefObject(ScriptWrappableBase* scriptWrappableBase)
125 {
126 #if !ENABLE(OILPAN)
127     scriptWrappableBase->toImpl<TestInterfaceEventTarget>()->deref();
128 #endif
129 }
130
131 template<>
132 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventTarget* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
133 {
134     return toV8(impl, creationContext, isolate);
135 }
136
137 } // namespace blink