2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
23 #if ENABLE(Condition1) || ENABLE(Condition2)
25 #include "JSTestSerializedScriptValueInterface.h"
27 #include "ExceptionCode.h"
29 #include "JSDOMBinding.h"
30 #include "SerializedScriptValue.h"
31 #include "TestSerializedScriptValueInterface.h"
32 #include <runtime/Error.h>
33 #include <wtf/GetPtr.h>
39 ASSERT_CLASS_FITS_IN_CELL(JSTestSerializedScriptValueInterface);
42 static const HashTableValue JSTestSerializedScriptValueInterfaceTableValues[] =
44 { "value", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceValue), (intptr_t)setJSTestSerializedScriptValueInterfaceValue, NoIntrinsic },
45 { "readonlyValue", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceReadonlyValue), (intptr_t)0, NoIntrinsic },
46 { "cachedValue", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceCachedValue), (intptr_t)setJSTestSerializedScriptValueInterfaceCachedValue, NoIntrinsic },
47 { "cachedReadonlyValue", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceCachedReadonlyValue), (intptr_t)0, NoIntrinsic },
48 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestSerializedScriptValueInterfaceConstructor), (intptr_t)0, NoIntrinsic },
49 { 0, 0, 0, 0, NoIntrinsic }
52 static const HashTable JSTestSerializedScriptValueInterfaceTable = { 17, 15, JSTestSerializedScriptValueInterfaceTableValues, 0 };
53 /* Hash table for constructor */
55 static const HashTableValue JSTestSerializedScriptValueInterfaceConstructorTableValues[] =
57 { 0, 0, 0, 0, NoIntrinsic }
60 static const HashTable JSTestSerializedScriptValueInterfaceConstructorTable = { 1, 0, JSTestSerializedScriptValueInterfaceConstructorTableValues, 0 };
61 const ClassInfo JSTestSerializedScriptValueInterfaceConstructor::s_info = { "TestSerializedScriptValueInterfaceConstructor", &Base::s_info, &JSTestSerializedScriptValueInterfaceConstructorTable, 0, CREATE_METHOD_TABLE(JSTestSerializedScriptValueInterfaceConstructor) };
63 JSTestSerializedScriptValueInterfaceConstructor::JSTestSerializedScriptValueInterfaceConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
64 : DOMConstructorObject(structure, globalObject)
68 void JSTestSerializedScriptValueInterfaceConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
70 Base::finishCreation(exec->globalData());
71 ASSERT(inherits(&s_info));
72 putDirect(exec->globalData(), exec->propertyNames().prototype, JSTestSerializedScriptValueInterfacePrototype::self(exec, globalObject), DontDelete | ReadOnly);
73 putDirect(exec->globalData(), exec->propertyNames().length, jsNumber(3), ReadOnly | DontDelete | DontEnum);
76 bool JSTestSerializedScriptValueInterfaceConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
78 return getStaticValueSlot<JSTestSerializedScriptValueInterfaceConstructor, JSDOMWrapper>(exec, &JSTestSerializedScriptValueInterfaceConstructorTable, static_cast<JSTestSerializedScriptValueInterfaceConstructor*>(cell), propertyName, slot);
81 bool JSTestSerializedScriptValueInterfaceConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
83 return getStaticValueDescriptor<JSTestSerializedScriptValueInterfaceConstructor, JSDOMWrapper>(exec, &JSTestSerializedScriptValueInterfaceConstructorTable, static_cast<JSTestSerializedScriptValueInterfaceConstructor*>(object), propertyName, descriptor);
86 EncodedJSValue JSC_HOST_CALL JSTestSerializedScriptValueInterfaceConstructor::constructJSTestSerializedScriptValueInterface(ExecState* exec)
88 JSTestSerializedScriptValueInterfaceConstructor* castedThis = static_cast<JSTestSerializedScriptValueInterfaceConstructor*>(exec->callee());
89 if (exec->argumentCount() < 2)
90 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
91 const String& hello(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toString(exec)->value(exec)));
92 if (exec->hadException())
93 return JSValue::encode(jsUndefined());
94 RefPtr<SerializedScriptValue> data(SerializedScriptValue::create(exec, MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined)));
95 if (exec->hadException())
96 return JSValue::encode(jsUndefined());
97 Array* transferList(toArray(MAYBE_MISSING_PARAMETER(exec, 2, DefaultIsUndefined)));
98 if (exec->hadException())
99 return JSValue::encode(jsUndefined());
100 RefPtr<TestSerializedScriptValueInterface> object = TestSerializedScriptValueInterface::create(hello, data, transferList);
101 return JSValue::encode(asObject(toJS(exec, castedThis->globalObject(), object.get())));
104 ConstructType JSTestSerializedScriptValueInterfaceConstructor::getConstructData(JSCell*, ConstructData& constructData)
106 constructData.native.function = constructJSTestSerializedScriptValueInterface;
107 return ConstructTypeHost;
110 /* Hash table for prototype */
112 static const HashTableValue JSTestSerializedScriptValueInterfacePrototypeTableValues[] =
114 { "acceptTransferList", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestSerializedScriptValueInterfacePrototypeFunctionAcceptTransferList), (intptr_t)2, NoIntrinsic },
115 { "multiTransferList", DontDelete | JSC::Function, (intptr_t)static_cast<NativeFunction>(jsTestSerializedScriptValueInterfacePrototypeFunctionMultiTransferList), (intptr_t)4, NoIntrinsic },
116 { 0, 0, 0, 0, NoIntrinsic }
119 static const HashTable JSTestSerializedScriptValueInterfacePrototypeTable = { 5, 3, JSTestSerializedScriptValueInterfacePrototypeTableValues, 0 };
120 const ClassInfo JSTestSerializedScriptValueInterfacePrototype::s_info = { "TestSerializedScriptValueInterfacePrototype", &Base::s_info, &JSTestSerializedScriptValueInterfacePrototypeTable, 0, CREATE_METHOD_TABLE(JSTestSerializedScriptValueInterfacePrototype) };
122 JSObject* JSTestSerializedScriptValueInterfacePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
124 return getDOMPrototype<JSTestSerializedScriptValueInterface>(exec, globalObject);
127 bool JSTestSerializedScriptValueInterfacePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
129 JSTestSerializedScriptValueInterfacePrototype* thisObject = jsCast<JSTestSerializedScriptValueInterfacePrototype*>(cell);
130 return getStaticFunctionSlot<JSObject>(exec, &JSTestSerializedScriptValueInterfacePrototypeTable, thisObject, propertyName, slot);
133 bool JSTestSerializedScriptValueInterfacePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
135 JSTestSerializedScriptValueInterfacePrototype* thisObject = jsCast<JSTestSerializedScriptValueInterfacePrototype*>(object);
136 return getStaticFunctionDescriptor<JSObject>(exec, &JSTestSerializedScriptValueInterfacePrototypeTable, thisObject, propertyName, descriptor);
139 const ClassInfo JSTestSerializedScriptValueInterface::s_info = { "TestSerializedScriptValueInterface", &Base::s_info, &JSTestSerializedScriptValueInterfaceTable, 0 , CREATE_METHOD_TABLE(JSTestSerializedScriptValueInterface) };
141 JSTestSerializedScriptValueInterface::JSTestSerializedScriptValueInterface(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestSerializedScriptValueInterface> impl)
142 : JSDOMWrapper(structure, globalObject)
143 , m_impl(impl.leakRef())
147 void JSTestSerializedScriptValueInterface::finishCreation(JSGlobalData& globalData)
149 Base::finishCreation(globalData);
150 ASSERT(inherits(&s_info));
153 JSObject* JSTestSerializedScriptValueInterface::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
155 return JSTestSerializedScriptValueInterfacePrototype::create(exec->globalData(), globalObject, JSTestSerializedScriptValueInterfacePrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
158 void JSTestSerializedScriptValueInterface::destroy(JSC::JSCell* cell)
160 JSTestSerializedScriptValueInterface* thisObject = jsCast<JSTestSerializedScriptValueInterface*>(cell);
161 thisObject->JSTestSerializedScriptValueInterface::~JSTestSerializedScriptValueInterface();
164 JSTestSerializedScriptValueInterface::~JSTestSerializedScriptValueInterface()
166 releaseImplIfNotNull();
169 bool JSTestSerializedScriptValueInterface::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
171 JSTestSerializedScriptValueInterface* thisObject = jsCast<JSTestSerializedScriptValueInterface*>(cell);
172 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
173 return getStaticValueSlot<JSTestSerializedScriptValueInterface, Base>(exec, &JSTestSerializedScriptValueInterfaceTable, thisObject, propertyName, slot);
176 bool JSTestSerializedScriptValueInterface::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
178 JSTestSerializedScriptValueInterface* thisObject = jsCast<JSTestSerializedScriptValueInterface*>(object);
179 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
180 return getStaticValueDescriptor<JSTestSerializedScriptValueInterface, Base>(exec, &JSTestSerializedScriptValueInterfaceTable, thisObject, propertyName, descriptor);
183 JSValue jsTestSerializedScriptValueInterfaceValue(ExecState* exec, JSValue slotBase, const Identifier&)
185 JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(asObject(slotBase));
187 TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl());
188 JSValue result = impl->value() ? impl->value()->deserialize(exec, castedThis->globalObject(), 0) : jsNull();
193 JSValue jsTestSerializedScriptValueInterfaceReadonlyValue(ExecState* exec, JSValue slotBase, const Identifier&)
195 JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(asObject(slotBase));
197 TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl());
198 JSValue result = impl->readonlyValue() ? impl->readonlyValue()->deserialize(exec, castedThis->globalObject(), 0) : jsNull();
203 JSValue jsTestSerializedScriptValueInterfaceCachedValue(ExecState* exec, JSValue slotBase, const Identifier&)
205 JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(asObject(slotBase));
207 if (JSValue cachedValue = castedThis->m_cachedValue.get())
209 TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl());
210 JSValue result = impl->cachedValue() ? impl->cachedValue()->deserialize(exec, castedThis->globalObject(), 0) : jsNull();
211 castedThis->m_cachedValue.set(exec->globalData(), castedThis, result);
216 JSValue jsTestSerializedScriptValueInterfaceCachedReadonlyValue(ExecState* exec, JSValue slotBase, const Identifier&)
218 JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(asObject(slotBase));
220 if (JSValue cachedValue = castedThis->m_cachedReadonlyValue.get())
222 TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl());
223 JSValue result = impl->cachedReadonlyValue() ? impl->cachedReadonlyValue()->deserialize(exec, castedThis->globalObject(), 0) : jsNull();
224 castedThis->m_cachedReadonlyValue.set(exec->globalData(), castedThis, result);
229 JSValue jsTestSerializedScriptValueInterfaceConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
231 JSTestSerializedScriptValueInterface* domObject = static_cast<JSTestSerializedScriptValueInterface*>(asObject(slotBase));
232 return JSTestSerializedScriptValueInterface::getConstructor(exec, domObject->globalObject());
235 void JSTestSerializedScriptValueInterface::put(JSCell* cell, ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
237 JSTestSerializedScriptValueInterface* thisObject = jsCast<JSTestSerializedScriptValueInterface*>(cell);
238 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
239 lookupPut<JSTestSerializedScriptValueInterface, Base>(exec, propertyName, value, &JSTestSerializedScriptValueInterfaceTable, thisObject, slot);
242 void setJSTestSerializedScriptValueInterfaceValue(ExecState* exec, JSObject* thisObject, JSValue value)
244 JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(thisObject);
245 TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl());
246 impl->setValue(SerializedScriptValue::create(exec, value));
250 void setJSTestSerializedScriptValueInterfaceCachedValue(ExecState* exec, JSObject* thisObject, JSValue value)
252 JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(thisObject);
253 TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl());
254 impl->setCachedValue(SerializedScriptValue::create(exec, value));
258 JSValue JSTestSerializedScriptValueInterface::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
260 return getDOMConstructor<JSTestSerializedScriptValueInterfaceConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
263 EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionAcceptTransferList(ExecState* exec)
265 JSValue thisValue = exec->hostThisValue();
266 if (!thisValue.inherits(&JSTestSerializedScriptValueInterface::s_info))
267 return throwVMTypeError(exec);
268 JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(asObject(thisValue));
269 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestSerializedScriptValueInterface::s_info);
270 TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl());
271 if (exec->argumentCount() < 1)
272 return throwVMError(exec, createTypeError(exec, "Not enough arguments"));
273 RefPtr<SerializedScriptValue> data(SerializedScriptValue::create(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
274 if (exec->hadException())
275 return JSValue::encode(jsUndefined());
277 size_t argsCount = exec->argumentCount();
278 if (argsCount <= 1) {
279 impl->acceptTransferList(data);
280 return JSValue::encode(jsUndefined());
283 Array* transferList(toArray(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined)));
284 if (exec->hadException())
285 return JSValue::encode(jsUndefined());
286 impl->acceptTransferList(data, transferList);
287 return JSValue::encode(jsUndefined());
290 EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionMultiTransferList(ExecState* exec)
292 JSValue thisValue = exec->hostThisValue();
293 if (!thisValue.inherits(&JSTestSerializedScriptValueInterface::s_info))
294 return throwVMTypeError(exec);
295 JSTestSerializedScriptValueInterface* castedThis = static_cast<JSTestSerializedScriptValueInterface*>(asObject(thisValue));
296 ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestSerializedScriptValueInterface::s_info);
297 TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl());
299 size_t argsCount = exec->argumentCount();
300 if (argsCount <= 0) {
301 impl->multiTransferList();
302 return JSValue::encode(jsUndefined());
305 RefPtr<SerializedScriptValue> first(SerializedScriptValue::create(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined)));
306 if (exec->hadException())
307 return JSValue::encode(jsUndefined());
308 if (argsCount <= 1) {
309 impl->multiTransferList(first);
310 return JSValue::encode(jsUndefined());
313 Array* tx(toArray(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined)));
314 if (exec->hadException())
315 return JSValue::encode(jsUndefined());
316 if (argsCount <= 2) {
317 impl->multiTransferList(first, tx);
318 return JSValue::encode(jsUndefined());
321 RefPtr<SerializedScriptValue> second(SerializedScriptValue::create(exec, MAYBE_MISSING_PARAMETER(exec, 2, DefaultIsUndefined)));
322 if (exec->hadException())
323 return JSValue::encode(jsUndefined());
324 if (argsCount <= 3) {
325 impl->multiTransferList(first, tx, second);
326 return JSValue::encode(jsUndefined());
329 Array* txx(toArray(MAYBE_MISSING_PARAMETER(exec, 3, DefaultIsUndefined)));
330 if (exec->hadException())
331 return JSValue::encode(jsUndefined());
332 impl->multiTransferList(first, tx, second, txx);
333 return JSValue::encode(jsUndefined());
336 void JSTestSerializedScriptValueInterface::visitChildren(JSCell* cell, SlotVisitor& visitor)
338 JSTestSerializedScriptValueInterface* thisObject = jsCast<JSTestSerializedScriptValueInterface*>(cell);
339 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
340 COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
341 ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
342 Base::visitChildren(thisObject, visitor);
343 if (thisObject->m_cachedValue)
344 visitor.append(&thisObject->m_cachedValue);
345 if (thisObject->m_cachedReadonlyValue)
346 visitor.append(&thisObject->m_cachedReadonlyValue);
349 static inline bool isObservable(JSTestSerializedScriptValueInterface* jsTestSerializedScriptValueInterface)
351 if (jsTestSerializedScriptValueInterface->hasCustomProperties())
356 bool JSTestSerializedScriptValueInterfaceOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
358 JSTestSerializedScriptValueInterface* jsTestSerializedScriptValueInterface = static_cast<JSTestSerializedScriptValueInterface*>(handle.get().asCell());
359 if (!isObservable(jsTestSerializedScriptValueInterface))
361 UNUSED_PARAM(visitor);
365 void JSTestSerializedScriptValueInterfaceOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
367 JSTestSerializedScriptValueInterface* jsTestSerializedScriptValueInterface = static_cast<JSTestSerializedScriptValueInterface*>(handle.get().asCell());
368 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
369 uncacheWrapper(world, jsTestSerializedScriptValueInterface->impl(), jsTestSerializedScriptValueInterface);
370 jsTestSerializedScriptValueInterface->releaseImpl();
373 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestSerializedScriptValueInterface* impl)
375 return wrap<JSTestSerializedScriptValueInterface>(exec, globalObject, impl);
378 TestSerializedScriptValueInterface* toTestSerializedScriptValueInterface(JSC::JSValue value)
380 return value.inherits(&JSTestSerializedScriptValueInterface::s_info) ? static_cast<JSTestSerializedScriptValueInterface*>(asObject(value))->impl() : 0;
385 #endif // ENABLE(Condition1) || ENABLE(Condition2)