OLD | NEW |
| (Empty) |
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/custom/V8Uint8ArrayCustom.h" | |
18 #include "bindings/tests/v8/V8TestInterfaceEmpty.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, V8TestInterfaceEve
ntConstructor::refObject, V8TestInterfaceEventConstructor::derefObject, V8TestIn
terfaceEventConstructor::createPersistentHandle, 0, 0, 0, V8TestInterfaceEventCo
nstructor::installConditionallyEnabledMethods, V8TestInterfaceEventConstructor::
installConditionallyEnabledProperties, &V8Event::wrapperTypeInfo, WrapperTypeInf
o::WrapperTypeObjectPrototype, WrapperTypeInfo::ObjectClassId, WrapperTypeInfo::
Independent, WrapperTypeInfo::WillBeGarbageCollectedObject }; | |
31 | |
32 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac
eEventConstructor.h. | |
33 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in | |
34 // bindings/core/v8/ScriptWrappable.h. | |
35 const WrapperTypeInfo& TestInterfaceEventConstructor::s_wrapperTypeInfo = V8Test
InterfaceEventConstructor::wrapperTypeInfo; | |
36 | |
37 namespace TestInterfaceEventConstructorV8Internal { | |
38 | |
39 template <typename T> void V8_USE(T) { } | |
40 | |
41 static void readonlyStringAttributeAttributeGetter(const v8::PropertyCallbackInf
o<v8::Value>& info) | |
42 { | |
43 v8::Handle<v8::Object> holder = info.Holder(); | |
44 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
45 v8SetReturnValueString(info, impl->readonlyStringAttribute(), info.GetIsolat
e()); | |
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::readonlyStringAttributeAttributeGet
ter(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::toImp
l(holder); | |
59 v8SetReturnValueString(info, impl->initializedByEventConstructorReadonlyStri
ngAttribute(), info.GetIsolate()); | |
60 } | |
61 | |
62 static void initializedByEventConstructorReadonlyStringAttributeAttributeGetterC
allback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
63 { | |
64 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
65 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyStringAttributeAttributeGetter(info); | |
66 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
67 } | |
68 | |
69 static void initializedByEventConstructorReadonlyAnyAttributeAttributeGetter(con
st v8::PropertyCallbackInfo<v8::Value>& info) | |
70 { | |
71 v8::Handle<v8::Object> holder = info.Holder(); | |
72 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
73 v8SetReturnValue(info, impl->initializedByEventConstructorReadonlyAnyAttribu
te().v8Value()); | |
74 } | |
75 | |
76 static void initializedByEventConstructorReadonlyAnyAttributeAttributeGetterCall
back(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
77 { | |
78 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
79 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyAnyAttributeAttributeGetter(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::toImp
l(holder); | |
87 v8SetReturnValueBool(info, impl->initializedByEventConstructorReadonlyBoolea
nAttribute()); | |
88 } | |
89 | |
90 static void initializedByEventConstructorReadonlyBooleanAttributeAttributeGetter
Callback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
91 { | |
92 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
93 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyBooleanAttributeAttributeGetter(info); | |
94 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
95 } | |
96 | |
97 static void initializedByEventConstructorReadonlyLongAttributeAttributeGetter(co
nst v8::PropertyCallbackInfo<v8::Value>& info) | |
98 { | |
99 v8::Handle<v8::Object> holder = info.Holder(); | |
100 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
101 v8SetReturnValueInt(info, impl->initializedByEventConstructorReadonlyLongAtt
ribute()); | |
102 } | |
103 | |
104 static void initializedByEventConstructorReadonlyLongAttributeAttributeGetterCal
lback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) | |
105 { | |
106 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
107 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyLongAttributeAttributeGetter(info); | |
108 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
109 } | |
110 | |
111 static void initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGet
ter(const v8::PropertyCallbackInfo<v8::Value>& info) | |
112 { | |
113 v8::Handle<v8::Object> holder = info.Holder(); | |
114 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
115 RefPtr<Uint8Array> cppValue(impl->initializedByEventConstructorReadonlyUint8
ArrayAttribute()); | |
116 if (cppValue && DOMDataStore::setReturnValueFromWrapper<V8Uint8Array>(info.G
etReturnValue(), 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 initializedByEventConstructorReadonlyUint8ArrayAttributeAttributeGet
terCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& in
fo) | |
126 { | |
127 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
128 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyUint8ArrayAttributeAttributeGetter(info); | |
129 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
130 } | |
131 | |
132 static void initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttr
ibuteGetter(const v8::PropertyCallbackInfo<v8::Value>& info) | |
133 { | |
134 v8::Handle<v8::Object> holder = info.Holder(); | |
135 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
136 RefPtr<TestInterfaceEmpty> cppValue(impl->initializedByEventConstructorReado
nlyTestInterfaceEmptyAttribute()); | |
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(), "initializedByEventConstructorReadonlyTestInterfaceEmptyAttri
bute"), wrapper); | |
142 v8SetReturnValue(info, wrapper); | |
143 } | |
144 } | |
145 | |
146 static void initializedByEventConstructorReadonlyTestInterfaceEmptyAttributeAttr
ibuteGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Va
lue>& info) | |
147 { | |
148 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
149 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyTestInterfaceEmptyAttributeAttributeGetter(info); | |
150 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
151 } | |
152 | |
153 static void initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribut
eAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) | |
154 { | |
155 v8::Handle<v8::Object> holder = info.Holder(); | |
156 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
157 v8SetReturnValue(info, v8Array(impl->initializedByEventConstructorReadonlyTe
stInterfaceEmptyArrayAttribute(), info.Holder(), info.GetIsolate())); | |
158 } | |
159 | |
160 static void initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribut
eAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v
8::Value>& info) | |
161 { | |
162 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
163 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyTestInterfaceEmptyArrayAttributeAttributeGetter(info); | |
164 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
165 } | |
166 | |
167 static void initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttri
buteAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) | |
168 { | |
169 v8::Handle<v8::Object> holder = info.Holder(); | |
170 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
171 RefPtr<TestInterfaceEmpty> cppValue(impl->initializedByEventConstructorReado
nlyNullableTestInterfaceEmptyAttribute()); | |
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(), "initializedByEventConstructorReadonlyNullableTestInterfaceEm
ptyAttribute"), wrapper); | |
177 v8SetReturnValue(info, wrapper); | |
178 } | |
179 } | |
180 | |
181 static void initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttri
buteAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInf
o<v8::Value>& info) | |
182 { | |
183 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
184 TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadon
lyNullableTestInterfaceEmptyAttributeAttributeGetter(info); | |
185 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
186 } | |
187 | |
188 static void deprecatedInitializedByEventConstructorReadonlyStringAttributeAttrib
uteGetter(const v8::PropertyCallbackInfo<v8::Value>& info) | |
189 { | |
190 v8::Handle<v8::Object> holder = info.Holder(); | |
191 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
192 v8SetReturnValueString(info, impl->deprecatedInitializedByEventConstructorRe
adonlyStringAttribute(), info.GetIsolate()); | |
193 } | |
194 | |
195 static void deprecatedInitializedByEventConstructorReadonlyStringAttributeAttrib
uteGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Valu
e>& info) | |
196 { | |
197 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
198 UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), Use
Counter::initializedByEventConstructorReadonlyStringAttribute); | |
199 TestInterfaceEventConstructorV8Internal::deprecatedInitializedByEventConstru
ctorReadonlyStringAttributeAttributeGetter(info); | |
200 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
201 } | |
202 | |
203 static void implementedAsInitializedByEventConstructorReadonlyStringAttributeAtt
ributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) | |
204 { | |
205 v8::Handle<v8::Object> holder = info.Holder(); | |
206 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
207 v8SetReturnValueString(info, impl->implementedAsName(), info.GetIsolate()); | |
208 } | |
209 | |
210 static void implementedAsInitializedByEventConstructorReadonlyStringAttributeAtt
ributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::V
alue>& info) | |
211 { | |
212 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
213 TestInterfaceEventConstructorV8Internal::implementedAsInitializedByEventCons
tructorReadonlyStringAttributeAttributeGetter(info); | |
214 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | |
215 } | |
216 | |
217 static void deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAt
tributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) | |
218 { | |
219 v8::Handle<v8::Object> holder = info.Holder(); | |
220 TestInterfaceEventConstructor* impl = V8TestInterfaceEventConstructor::toImp
l(holder); | |
221 v8SetReturnValueString(info, impl->deprecatedImplementedAsName(), info.GetIs
olate()); | |
222 } | |
223 | |
224 static void deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAt
tributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallback
Info<v8::Value>& info) | |
225 { | |
226 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | |
227 UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), Use
Counter::initializedByEventConstructorReadonlyStringAttribute); | |
228 TestInterfaceEventConstructorV8Internal::deprecatedImplementedAsInitializedB
yEventConstructorReadonlyStringAttributeAttributeGetter(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, "TestInte
rfaceEventConstructor", 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 TONATIVE_VOID(Dictionary, options, Dictionary(info[1], info.GetIsolate()
)); | |
246 if (!initializeTestInterfaceEventConstructor(eventInit, options, excepti
onState, info)) { | |
247 exceptionState.throwIfNeeded(); | |
248 return; | |
249 } | |
250 options.get("initializedByEventConstructorReadonlyAnyAttribute", initial
izedByEventConstructorReadonlyAnyAttribute); | |
251 if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty()) | |
252 V8HiddenValue::setHiddenValue(info.GetIsolate(), info.Holder(), v8At
omicString(info.GetIsolate(), "initializedByEventConstructorReadonlyAnyAttribute
"), initializedByEventConstructorReadonlyAnyAttribute); | |
253 } | |
254 RefPtrWillBeRawPtr<TestInterfaceEventConstructor> event = TestInterfaceEvent
Constructor::create(type, eventInit, exceptionState); | |
255 if (exceptionState.throwIfNeeded()) | |
256 return; | |
257 if (DOMWrapperWorld::current(info.GetIsolate()).isIsolatedWorld()) { | |
258 if (!initializedByEventConstructorReadonlyAnyAttribute.IsEmpty()) | |
259 event->setSerializedInitializedByEventConstructorReadonlyAnyAttribut
e(SerializedScriptValue::createAndSwallowExceptions(initializedByEventConstructo
rReadonlyAnyAttribute, info.GetIsolate())); | |
260 } | |
261 | |
262 v8::Handle<v8::Object> wrapper = info.Holder(); | |
263 V8DOMWrapper::associateObjectWithWrapper<V8TestInterfaceEventConstructor>(ev
ent.release(), &V8TestInterfaceEventConstructor::wrapperTypeInfo, wrapper, info.
GetIsolate()); | |
264 v8SetReturnValue(info, wrapper); | |
265 } | |
266 | |
267 } // namespace TestInterfaceEventConstructorV8Internal | |
268 | |
269 static const V8DOMConfiguration::AttributeConfiguration V8TestInterfaceEventCons
tructorAttributes[] = { | |
270 {"readonlyStringAttribute", TestInterfaceEventConstructorV8Internal::readonl
yStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessContr
ol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigurati
on::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
271 {"initializedByEventConstructorReadonlyStringAttribute", TestInterfaceEventC
onstructorV8Internal::initializedByEventConstructorReadonlyStringAttributeAttrib
uteGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), stat
ic_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScript
s, V8DOMConfiguration::OnInstance}, | |
272 {"initializedByEventConstructorReadonlyAnyAttribute", TestInterfaceEventCons
tructorV8Internal::initializedByEventConstructorReadonlyAnyAttributeAttributeGet
terCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cas
t<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V8D
OMConfiguration::OnInstance}, | |
273 {"initializedByEventConstructorReadonlyBooleanAttribute", TestInterfaceEvent
ConstructorV8Internal::initializedByEventConstructorReadonlyBooleanAttributeAttr
ibuteGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), st
atic_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScri
pts, V8DOMConfiguration::OnInstance}, | |
274 {"initializedByEventConstructorReadonlyLongAttribute", TestInterfaceEventCon
structorV8Internal::initializedByEventConstructorReadonlyLongAttributeAttributeG
etterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_c
ast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToAllScripts, V
8DOMConfiguration::OnInstance}, | |
275 {"initializedByEventConstructorReadonlyUint8ArrayAttribute", TestInterfaceEv
entConstructorV8Internal::initializedByEventConstructorReadonlyUint8ArrayAttribu
teAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAUL
T), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration::ExposedToA
llScripts, V8DOMConfiguration::OnInstance}, | |
276 {"initializedByEventConstructorReadonlyTestInterfaceEmptyAttribute", TestInt
erfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyTestInter
faceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessCon
trol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigura
tion::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
277 {"initializedByEventConstructorReadonlyTestInterfaceEmptyArrayAttribute", Te
stInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyTest
InterfaceEmptyArrayAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8:
:AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DO
MConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
278 {"initializedByEventConstructorReadonlyNullableTestInterfaceEmptyAttribute",
TestInterfaceEventConstructorV8Internal::initializedByEventConstructorReadonlyN
ullableTestInterfaceEmptyAttributeAttributeGetterCallback, 0, 0, 0, 0, static_ca
st<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)
, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
279 {"deprecatedInitializedByEventConstructorReadonlyStringAttribute", TestInter
faceEventConstructorV8Internal::deprecatedInitializedByEventConstructorReadonlyS
tringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl
>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfiguration
::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
280 {"implementedAsInitializedByEventConstructorReadonlyStringAttribute", TestIn
terfaceEventConstructorV8Internal::implementedAsInitializedByEventConstructorRea
donlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessC
ontrol>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), V8DOMConfigu
ration::ExposedToAllScripts, V8DOMConfiguration::OnInstance}, | |
281 {"deprecatedImplementedAsInitializedByEventConstructorReadonlyStringAttribut
e", TestInterfaceEventConstructorV8Internal::deprecatedImplementedAsInitializedB
yEventConstructorReadonlyStringAttributeAttributeGetterCallback, 0, 0, 0, 0, sta
tic_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() ? Str
ing("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", eve
ntInit.initializedByEventConstructorReadonlyStringAttribute)) | |
291 return false; | |
292 if (!DictionaryHelper::convert(options, conversionContext.setConversionType(
"boolean", false), "initializedByEventConstructorReadonlyBooleanAttribute", even
tInit.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), "initializedByEventConstructorReadonlyTestInterfac
eEmptyAttribute", eventInit.initializedByEventConstructorReadonlyTestInterfaceEm
ptyAttribute)) | |
299 return false; | |
300 if (!DictionaryHelper::convert(options, conversionContext.setConversionType(
"TestInterfaceEmpty[]", false), "initializedByEventConstructorReadonlyTestInterf
aceEmptyArrayAttribute", eventInit.initializedByEventConstructorReadonlyTestInte
rfaceEmptyArrayAttribute)) | |
301 return false; | |
302 if (!DictionaryHelper::convert(options, conversionContext.setConversionType(
"TestInterfaceEmpty", true), "initializedByEventConstructorReadonlyNullableTestI
nterfaceEmptyAttribute", eventInit.initializedByEventConstructorReadonlyNullable
TestInterfaceEmptyAttribute)) | |
303 return false; | |
304 if (DictionaryHelper::convert(options, conversionContext.setConversionType("
DOMString", false), "deprecatedInitializedByEventConstructorReadonlyStringAttrib
ute", eventInit.deprecatedInitializedByEventConstructorReadonlyStringAttribute))
{ | |
305 if (options.hasProperty("deprecatedInitializedByEventConstructorReadonly
StringAttribute")) | |
306 UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate
()), UseCounter::initializedByEventConstructorReadonlyStringAttribute); | |
307 } else { | |
308 return false; | |
309 } | |
310 if (!DictionaryHelper::convert(options, conversionContext.setConversionType(
"DOMString", false), "implementedAsInitializedByEventConstructorReadonlyStringAt
tribute", eventInit.implementedAsName)) | |
311 return false; | |
312 if (DictionaryHelper::convert(options, conversionContext.setConversionType("
DOMString", false), "deprecatedImplementedAsInitializedByEventConstructorReadonl
yStringAttribute", eventInit.deprecatedImplementedAsName)) { | |
313 if (options.hasProperty("deprecatedImplementedAsInitializedByEventConstr
uctorReadonlyStringAttribute")) | |
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::FunctionCall
backInfo<v8::Value>& info) | |
322 { | |
323 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "DOMConstructor"); | |
324 if (!info.IsConstructCall()) { | |
325 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallab
leAsFunction("TestInterfaceEventConstructor"), info.GetIsolate()); | |
326 return; | |
327 } | |
328 | |
329 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis
tingObject) { | |
330 v8SetReturnValue(info, info.Holder()); | |
331 return; | |
332 } | |
333 | |
334 TestInterfaceEventConstructorV8Internal::constructor(info); | |
335 } | |
336 | |
337 static void installV8TestInterfaceEventConstructorTemplate(v8::Handle<v8::Functi
onTemplate> functionTemplate, v8::Isolate* isolate) | |
338 { | |
339 functionTemplate->ReadOnlyPrototype(); | |
340 | |
341 v8::Local<v8::Signature> defaultSignature; | |
342 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceEventConstructor", V8Event::domTemplate(isolate), V8TestInter
faceEventConstructor::internalFieldCount, | |
343 V8TestInterfaceEventConstructorAttributes, WTF_ARRAY_LENGTH(V8TestInterf
aceEventConstructorAttributes), | |
344 0, 0, | |
345 0, 0, | |
346 isolate); | |
347 functionTemplate->SetCallHandler(V8TestInterfaceEventConstructor::constructo
rCallback); | |
348 functionTemplate->SetLength(1); | |
349 v8::Local<v8::ObjectTemplate> instanceTemplate ALLOW_UNUSED = functionTempla
te->InstanceTemplate(); | |
350 v8::Local<v8::ObjectTemplate> prototypeTemplate ALLOW_UNUSED = functionTempl
ate->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<WrapperTypeI
nfo*>(&wrapperTypeInfo), installV8TestInterfaceEventConstructorTemplate); | |
359 } | |
360 | |
361 bool V8TestInterfaceEventConstructor::hasInstance(v8::Handle<v8::Value> v8Value,
v8::Isolate* isolate) | |
362 { | |
363 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
364 } | |
365 | |
366 v8::Handle<v8::Object> V8TestInterfaceEventConstructor::findInstanceInPrototypeC
hain(v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) | |
367 { | |
368 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
369 } | |
370 | |
371 TestInterfaceEventConstructor* V8TestInterfaceEventConstructor::toImplWithTypeCh
eck(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* internalPoi
nter) | |
378 { | |
379 #if !ENABLE(OILPAN) | |
380 internalPointer->toImpl<TestInterfaceEventConstructor>()->ref(); | |
381 #endif | |
382 } | |
383 | |
384 void V8TestInterfaceEventConstructor::derefObject(ScriptWrappableBase* internalP
ointer) | |
385 { | |
386 #if !ENABLE(OILPAN) | |
387 internalPointer->toImpl<TestInterfaceEventConstructor>()->deref(); | |
388 #endif | |
389 } | |
390 | |
391 WrapperPersistentNode* V8TestInterfaceEventConstructor::createPersistentHandle(S
criptWrappableBase* internalPointer) | |
392 { | |
393 #if ENABLE(OILPAN) | |
394 return WrapperPersistent<TestInterfaceEventConstructor>::create(internalPoin
ter->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::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) | |
403 { | |
404 return toV8(impl, creationContext, isolate); | |
405 } | |
406 | |
407 } // namespace blink | |
OLD | NEW |