Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / tests / results / core / V8TestInterfaceEventConstructor.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 "V8TestInterfaceEventConstructor.h"
9
10 #include "bindings/core/v8/Dictionary.h"
11 #include "bindings/core/v8/ExceptionState.h"
12 #include "bindings/core/v8/ScriptValue.h"
13 #include "bindings/core/v8/SerializedScriptValue.h"
14 #include "bindings/core/v8/V8DOMConfiguration.h"
15 #include "bindings/core/v8/V8HiddenValue.h"
16 #include "bindings/core/v8/V8ObjectConstructor.h"
17 #include "bindings/core/v8/V8TestInterfaceEmpty.h"
18 #include "bindings/core/v8/custom/V8Uint8ArrayCustom.h"
19 #include "core/dom/ContextFeatures.h"
20 #include "core/dom/Document.h"
21 #include "core/frame/LocalDOMWindow.h"
22 #include "core/frame/UseCounter.h"
23 #include "platform/RuntimeEnabledFeatures.h"
24 #include "platform/TraceEvent.h"
25 #include "wtf/GetPtr.h"
26 #include "wtf/RefPtr.h"
27
28 namespace blink {
29
30 const WrapperTypeInfo V8TestInterfaceEventConstructor::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterfaceEventConstructor::domTemplate, V8TestInterfaceEventConstructor::refObject, V8TestInterfaceEventConstructor::derefObject, V8TestInterfaceEventConstructor::createPersistentHandle, 0, 0, 0, V8TestInterfaceEventConstructor::installConditionallyEnabledMethods, V8TestInterfaceEventConstructor::installConditionallyEnabledProperties, &V8Event::wrapperTypeInfo, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::WillBeGarbageCollectedObject };
31
32 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfaceEventConstructor.h.
33 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
34 // bindings/core/v8/ScriptWrappable.h.
35 const WrapperTypeInfo& TestInterfaceEventConstructor::s_wrapperTypeInfo = V8TestInterfaceEventConstructor::wrapperTypeInfo;
36
37 namespace TestInterfaceEventConstructorV8Internal {
38
39 template <typename T> void V8_USE(T) { }
40
41 static void readonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
42 {
43     v8::Handle<v8::Object> holder = info.Holder();
44     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
45     v8SetReturnValueString(info, impl->readonlyStringAttribute(), info.GetIsolate());
46 }
47
48 static void readonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
49 {
50     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
51     TestInterfaceEventConstructorV8Internal::readonlyStringAttributeAttributeGetter(info);
52     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
53 }
54
55 static void initializedByEventConstructorReadonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
56 {
57     v8::Handle<v8::Object> holder = info.Holder();
58     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
59     v8SetReturnValueString(info, impl->initializedByEventConstructorReadonlyStringAttribute(), info.GetIsolate());
60 }
61
62 static void initializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
63 {
64     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
65     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyStringAttributeAttributeGetter(info);
66     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
67 }
68
69 static void initializedByEventConstructorReadonlyAnyAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
70 {
71     v8::Handle<v8::Object> holder = info.Holder();
72     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
73     v8SetReturnValue(info, impl->initializedByEventConstructorReadonlyAnyAttribute().v8Value());
74 }
75
76 static void initializedByEventConstructorReadonlyAnyAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
77 {
78     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
79     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyAnyAttributeAttributeGetter(info);
80     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
81 }
82
83 static void initializedByEventConstructorReadonlyBooleanAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
84 {
85     v8::Handle<v8::Object> holder = info.Holder();
86     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
87     v8SetReturnValueBool(info, impl->initializedByEventConstructorReadonlyBooleanAttribute());
88 }
89
90 static void initializedByEventConstructorReadonlyBooleanAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
91 {
92     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
93     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyBooleanAttributeAttributeGetter(info);
94     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
95 }
96
97 static void initializedByEventConstructorReadonlyLongAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
98 {
99     v8::Handle<v8::Object> holder = info.Holder();
100     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
101     v8SetReturnValueInt(info, impl->initializedByEventConstructorReadonlyLongAttribute());
102 }
103
104 static void initializedByEventConstructorReadonlyLongAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
105 {
106     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
107     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyLongAttributeAttributeGetter(info);
108     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
109 }
110
111 static void initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
112 {
113     v8::Handle<v8::Object> holder = info.Holder();
114     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
115     RefPtr<Uint8Array> cppValue(impl->initializedByEventConstructorReadonlyUint8ArrayAttribute());
116     if (cppValue && DOMDataStore::setReturnValueFromWrapper<V8Uint8Array>(info.GetReturnValue(), cppValue.get()))
117         return;
118     v8::Handle<v8::Value> wrapper = toV8(cppValue.get(), holder, info.GetIsolate());
119     if (!wrapper.IsEmpty()) {
120         V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(info.GetIsolate(), "initializedByEventConstructorReadonlyUint8ArrayAttribute"), wrapper);
121         v8SetReturnValue(info, wrapper);
122     }
123 }
124
125 static void initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
126 {
127     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
128     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGetter(info);
129     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
130 }
131
132 static void initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
133 {
134     v8::Handle<v8::Object> holder = info.Holder();
135     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
136     RefPtr<TestInterfaceEmpty> cppValue(impl->initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute());
137     if (cppValue && DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceEmpty>(info.GetReturnValue(), cppValue.get()))
138         return;
139     v8::Handle<v8::Value> wrapper = toV8(cppValue.get(), holder, info.GetIsolate());
140     if (!wrapper.IsEmpty()) {
141         V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(info.GetIsolate(), "initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute"), wrapper);
142         v8SetReturnValue(info, wrapper);
143     }
144 }
145
146 static void initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
147 {
148     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
149     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttributeGetter(info);
150     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
151 }
152
153 static void initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
154 {
155     v8::Handle<v8::Object> holder = info.Holder();
156     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
157     v8SetReturnValue(info, v8Array(impl->initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute(), info.Holder(), info.GetIsolate()));
158 }
159
160 static void initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
161 {
162     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
163     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttributeAttributeGetter(info);
164     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
165 }
166
167 static void initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
168 {
169     v8::Handle<v8::Object> holder = info.Holder();
170     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
171     RefPtr<TestInterfaceEmpty> cppValue(impl->initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute());
172     if (cppValue && DOMDataStore::setReturnValueFromWrapper<V8TestInterfaceEmpty>(info.GetReturnValue(), cppValue.get()))
173         return;
174     v8::Handle<v8::Value> wrapper = toV8(cppValue.get(), holder, info.GetIsolate());
175     if (!wrapper.IsEmpty()) {
176         V8HiddenValue::setHiddenValue(info.GetIsolate(), holder, v8AtomicString(info.GetIsolate(), "initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute"), wrapper);
177         v8SetReturnValue(info, wrapper);
178     }
179 }
180
181 static void initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
182 {
183     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
184     TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttributeAttributeGetter(info);
185     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
186 }
187
188 static void deprecatedInitializedByEventConstructorReadonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
189 {
190     v8::Handle<v8::Object> holder = info.Holder();
191     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
192     v8SetReturnValueString(info, impl->deprecatedInitializedByEventConstructorReadonlyStringAttribute(), info.GetIsolate());
193 }
194
195 static void deprecatedInitializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
196 {
197     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
198     UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), UseCounter::initializedByEventConstructorReadonlyStringAttribute);
199     TestInterfaceEventConstructorV8Internal::deprecatedInitializedByEventConstructorReadonlyStringAttributeAttributeGetter(info);
200     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
201 }
202
203 static void implementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
204 {
205     v8::Handle<v8::Object> holder = info.Holder();
206     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
207     v8SetReturnValueString(info, impl->implementedAsName(), info.GetIsolate());
208 }
209
210 static void implementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
211 {
212     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
213     TestInterfaceEventConstructorV8Internal::implementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetter(info);
214     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
215 }
216
217 static void deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info)
218 {
219     v8::Handle<v8::Object> holder = info.Holder();
220     TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImpl(holder);
221     v8SetReturnValueString(info, impl->deprecatedImplementedAsName(), info.GetIsolate());
222 }
223
224 static void deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
225 {
226     TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
227     UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), UseCounter::initializedByEventConstructorReadonlyStringAttribute);
228     TestInterfaceEventConstructorV8Internal::deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetter(info);
229     TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
230 }
231
232 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
233 {
234     ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInterfaceEventConstructor", info.Holder(), info.GetIsolate());
235     if (info.Length() < 1) {
236         exceptionState.throwTypeError("An event name must be provided.");
237         exceptionState.throwIfNeeded();
238         return;
239     }
240
241     TOSTRING_VOID(V8StringResource<>, type, info[0]);
242     v8::Local<v8::Value> initializedByEventConstructorReadonlyAnyAttribute;
243     TestInterfaceEventConstructorInit eventInit;
244     if (info.Length() >= 2) {
245         Dictionary options(info[1], info.GetIsolate());
246         if (!initializeTestInterfaceEventConstructor(eventInit, options, exceptionState, info)) {
247             exceptionState.throwIfNeeded();
248             return;
249         }
250         options.get("initializedByEventConstructorReadonlyAnyAttribute", initializedByEventConstructorReadonlyAnyAttribute);
251         if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty())
252             V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), v8AtomicString(info.GetIsolate(), "initializedByEventConstructorReadonlyAnyAttribute"), initializedByEventConstructorReadonlyAnyAttribute);
253     }
254     RefPtrWillBeRawPtr<TestInterfaceEventConstructor> event = TestInterfaceEventConstructor::create(type, eventInit, exceptionState);
255     if (exceptionState.throwIfNeeded())
256         return;
257     if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld()) {
258         if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty())
259             event->setSerializedInitializedByEventConstructorReadonlyAnyAttribute(SerializedScriptValue::createAndSwallowExceptions(initializedByEventConstructorReadonlyAnyAttribute, info.GetIsolate()));
260     }
261
262     v8::Handle<v8::Object> wrapper = info.Holder();
263     event->associateWithWrapper(&V8TestInterfaceEventConstructor::wrapperTypeInfo, wrapper, info.GetIsolate());
264     v8SetReturnValue(info, wrapper);
265 }
266
267 } // namespace TestInterfaceEventConstructorV8Internal
268
269 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceEventConstructorAttributes[] = {
270     {"readonlyStringAttribute", TestInterfaceEventConstructorV8Internal::readonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
271     {"initializedByEventConstructorReadonlyStringAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
272     {"initializedByEventConstructorReadonlyAnyAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyAnyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
273     {"initializedByEventConstructorReadonlyBooleanAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyBooleanAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
274     {"initializedByEventConstructorReadonlyLongAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyLongAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
275     {"initializedByEventConstructorReadonlyUint8ArrayAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
276     {"initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
277     {"initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
278     {"initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute", TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
279     {"deprecatedInitializedByEventConstructorReadonlyStringAttribute", TestInterfaceEventConstructorV8Internal::deprecatedInitializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
280     {"implementedAsInitializedByEventConstructorReadonlyStringAttribute", TestInterfaceEventConstructorV8Internal::implementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
281     {"deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribute", TestInterfaceEventConstructorV8Internal::deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance},
282 };
283
284 bool initializeTestInterfaceEventConstructor(TestInterfaceEventConstructorInit& eventInit, const Dictionary& options, ExceptionState& exceptionState, const v8::FunctionCallbackInfo<v8::Value>& info, const String& forEventName)
285 {
286     Dictionary::ConversionContext conversionContext(forEventName.isEmpty() ? String("TestInterfaceEventConstructor") : forEventName, "", exceptionState);
287     if (!initializeEvent(eventInit, options, exceptionState, info, forEventName.isEmpty() ? String("TestInterfaceEventConstructor") : forEventName))
288         return false;
289
290     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("DOMString", false), "initializedByEventConstructorReadonlyStringAttribute", eventInit.initializedByEventConstructorReadonlyStringAttribute))
291         return false;
292     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("boolean", false), "initializedByEventConstructorReadonlyBooleanAttribute", eventInit.initializedByEventConstructorReadonlyBooleanAttribute))
293         return false;
294     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("long", false), "initializedByEventConstructorReadonlyLongAttribute", eventInit.initializedByEventConstructorReadonlyLongAttribute))
295         return false;
296     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("Uint8Array", false), "initializedByEventConstructorReadonlyUint8ArrayAttribute", eventInit.initializedByEventConstructorReadonlyUint8ArrayAttribute))
297         return false;
298     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("TestInterfaceEmpty", false), "initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute", eventInit.initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute))
299         return false;
300     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("TestInterfaceEmpty[]", false), "initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute", eventInit.initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute))
301         return false;
302     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("TestInterfaceEmpty", true), "initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute", eventInit.initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute))
303         return false;
304     if (DictionaryHelper::convert(options, conversionContext.setConversionType("DOMString", false), "deprecatedInitializedByEventConstructorReadonlyStringAttribute", eventInit.deprecatedInitializedByEventConstructorReadonlyStringAttribute)) {
305         if (options.hasProperty("deprecatedInitializedByEventConstructorReadonlyStringAttribute"))
306             UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), UseCounter::initializedByEventConstructorReadonlyStringAttribute);
307     } else {
308         return false;
309     }
310     if (!DictionaryHelper::convert(options, conversionContext.setConversionType("DOMString", false), "implementedAsInitializedByEventConstructorReadonlyStringAttribute", eventInit.implementedAsName))
311         return false;
312     if (DictionaryHelper::convert(options, conversionContext.setConversionType("DOMString", false), "deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribute", eventInit.deprecatedImplementedAsName)) {
313         if (options.hasProperty("deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribute"))
314             UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), UseCounter::initializedByEventConstructorReadonlyStringAttribute);
315     } else {
316         return false;
317     }
318     return true;
319 }
320
321 void V8TestInterfaceEventConstructor::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
322 {
323     TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor");
324     if (!info.IsConstructCall()) {
325         V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("TestInterfaceEventConstructor"), info.GetIsolate());
326         return;
327     }
328
329     if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExistingObject) {
330         v8SetReturnValue(info, info.Holder());
331         return;
332     }
333
334     TestInterfaceEventConstructorV8Internal::constructor(info);
335 }
336
337 static void installV8TestInterfaceEventConstructorTemplate(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
338 {
339     functionTemplate->ReadOnlyPrototype();
340
341     v8::Local<v8::Signature> defaultSignature;
342     defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTemplate, "TestInterfaceEventConstructor", V8Event::domTemplate(isolate), V8TestInterfaceEventConstructor::internalFieldCount,
343         V8TestInterfaceEventConstructorAttributes, WTF_ARRAY_LENGTH(V8TestInterfaceEventConstructorAttributes),
344         0, 0,
345         0, 0,
346         isolate);
347     functionTemplate->SetCallHandler(V8TestInterfaceEventConstructor::constructorCallback);
348     functionTemplate->SetLength(1);
349     v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTemplate->InstanceTemplate();
350     v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTemplate->PrototypeTemplate();
351
352     // Custom toString template
353     functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
354 }
355
356 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEventConstructor::domTemplate(v8::Isolate* isolate)
357 {
358     return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), installV8TestInterfaceEventConstructorTemplate);
359 }
360
361 bool V8TestInterfaceEventConstructor::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
362 {
363     return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Value);
364 }
365
366 v8::Handle<v8::Object> V8TestInterfaceEventConstructor::findInstanceInPrototypeChain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate)
367 {
368     return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrapperTypeInfo, v8Value);
369 }
370
371 TestInterfaceEventConstructor* V8TestInterfaceEventConstructor::toImplWithTypeCheck(v8::Isolate* isolate, v8::Handle<v8::Value> value)
372 {
373     return hasInstance(value, isolate) ? blink::toScriptWrappableBase(v8::Handle<v8::Object>::Cast(value))->toImpl<TestInterfaceEventConstructor>() : 0;
374 }
375
376
377 void V8TestInterfaceEventConstructor::refObject(ScriptWrappableBase* internalPointer)
378 {
379 #if !ENABLE(OILPAN)
380     internalPointer->toImpl<TestInterfaceEventConstructor>()->ref();
381 #endif
382 }
383
384 void V8TestInterfaceEventConstructor::derefObject(ScriptWrappableBase* internalPointer)
385 {
386 #if !ENABLE(OILPAN)
387     internalPointer->toImpl<TestInterfaceEventConstructor>()->deref();
388 #endif
389 }
390
391 WrapperPersistentNode* V8TestInterfaceEventConstructor::createPersistentHandle(ScriptWrappableBase* internalPointer)
392 {
393 #if ENABLE(OILPAN)
394     return WrapperPersistent<TestInterfaceEventConstructor>::create(internalPointer->toImpl<TestInterfaceEventConstructor>());
395 #else
396     ASSERT_NOT_REACHED();
397     return 0;
398 #endif
399 }
400
401 template<>
402 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
403 {
404     return toV8(impl, creationContext, isolate);
405 }
406
407 } // namespace blink