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.
22 #include "JSMessageChannel.h"
24 #include "ExceptionCode.h"
25 #include "JSDOMBinding.h"
26 #include "JSMessagePort.h"
27 #include "MessageChannel.h"
28 #include "MessagePort.h"
29 #include <runtime/Error.h>
30 #include <wtf/GetPtr.h>
36 ASSERT_CLASS_FITS_IN_CELL(JSMessageChannel);
40 #define THUNK_GENERATOR(generator) , generator
42 #define THUNK_GENERATOR(generator)
45 #define INTRINSIC(intrinsic) , intrinsic
47 #define INTRINSIC(intrinsic)
50 static const HashTableValue JSMessageChannelTableValues[] =
52 { "port1", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMessageChannelPort1), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
53 { "port2", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMessageChannelPort2), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
54 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsMessageChannelConstructor), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
58 #undef THUNK_GENERATOR
59 static const HashTable JSMessageChannelTable = { 8, 7, JSMessageChannelTableValues, 0 };
60 /* Hash table for constructor */
62 #define THUNK_GENERATOR(generator) , generator
64 #define THUNK_GENERATOR(generator)
67 #define INTRINSIC(intrinsic) , intrinsic
69 #define INTRINSIC(intrinsic)
72 static const HashTableValue JSMessageChannelConstructorTableValues[] =
74 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
77 #undef THUNK_GENERATOR
78 static const HashTable JSMessageChannelConstructorTable = { 1, 0, JSMessageChannelConstructorTableValues, 0 };
79 const ClassInfo JSMessageChannelConstructor::s_info = { "MessageChannelConstructor", &DOMConstructorObject::s_info, &JSMessageChannelConstructorTable, 0, CREATE_METHOD_TABLE(JSMessageChannelConstructor) };
81 JSMessageChannelConstructor::JSMessageChannelConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
82 : DOMConstructorObject(structure, globalObject)
86 void JSMessageChannelConstructor::finishCreation(ExecState* exec, JSDOMGlobalObject* globalObject)
88 Base::finishCreation(exec->globalData());
89 ASSERT(inherits(&s_info));
90 putDirect(exec->globalData(), exec->propertyNames().prototype, JSMessageChannelPrototype::self(exec, globalObject), DontDelete | ReadOnly);
93 bool JSMessageChannelConstructor::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
95 return getStaticValueSlot<JSMessageChannelConstructor, JSDOMWrapper>(exec, &JSMessageChannelConstructorTable, static_cast<JSMessageChannelConstructor*>(cell), propertyName, slot);
98 bool JSMessageChannelConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
100 return getStaticValueDescriptor<JSMessageChannelConstructor, JSDOMWrapper>(exec, &JSMessageChannelConstructorTable, static_cast<JSMessageChannelConstructor*>(object), propertyName, descriptor);
103 EncodedJSValue JSC_HOST_CALL JSMessageChannelConstructor::constructJSMessageChannel(ExecState* exec)
105 JSMessageChannelConstructor* jsConstructor = static_cast<JSMessageChannelConstructor*>(exec->callee());
106 ScriptExecutionContext* context = jsConstructor->scriptExecutionContext();
108 return throwVMError(exec, createReferenceError(exec, "MessageChannel constructor associated document is unavailable"));
109 RefPtr<MessageChannel> object = MessageChannel::create(context);
110 return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), object.get())));
113 ConstructType JSMessageChannelConstructor::getConstructData(JSCell*, ConstructData& constructData)
115 constructData.native.function = constructJSMessageChannel;
116 return ConstructTypeHost;
119 /* Hash table for prototype */
121 #define THUNK_GENERATOR(generator) , generator
123 #define THUNK_GENERATOR(generator)
126 #define INTRINSIC(intrinsic) , intrinsic
128 #define INTRINSIC(intrinsic)
131 static const HashTableValue JSMessageChannelPrototypeTableValues[] =
133 { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
136 #undef THUNK_GENERATOR
137 static const HashTable JSMessageChannelPrototypeTable = { 1, 0, JSMessageChannelPrototypeTableValues, 0 };
138 static const HashTable* getJSMessageChannelPrototypeTable(ExecState* exec)
140 return getHashTableForGlobalData(exec->globalData(), &JSMessageChannelPrototypeTable);
143 const ClassInfo JSMessageChannelPrototype::s_info = { "MessageChannelPrototype", &JSC::JSNonFinalObject::s_info, 0, getJSMessageChannelPrototypeTable, CREATE_METHOD_TABLE(JSMessageChannelPrototype) };
145 JSObject* JSMessageChannelPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
147 return getDOMPrototype<JSMessageChannel>(exec, globalObject);
150 static const HashTable* getJSMessageChannelTable(ExecState* exec)
152 return getHashTableForGlobalData(exec->globalData(), &JSMessageChannelTable);
155 const ClassInfo JSMessageChannel::s_info = { "MessageChannel", &JSDOMWrapper::s_info, 0, getJSMessageChannelTable , CREATE_METHOD_TABLE(JSMessageChannel) };
157 JSMessageChannel::JSMessageChannel(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<MessageChannel> impl)
158 : JSDOMWrapper(structure, globalObject)
159 , m_impl(impl.leakRef())
163 void JSMessageChannel::finishCreation(JSGlobalData& globalData)
165 Base::finishCreation(globalData);
166 ASSERT(inherits(&s_info));
169 JSObject* JSMessageChannel::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
171 return JSMessageChannelPrototype::create(exec->globalData(), globalObject, JSMessageChannelPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
174 bool JSMessageChannel::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
176 JSMessageChannel* thisObject = jsCast<JSMessageChannel*>(cell);
177 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
178 return getStaticValueSlot<JSMessageChannel, Base>(exec, getJSMessageChannelTable(exec), thisObject, propertyName, slot);
181 bool JSMessageChannel::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
183 JSMessageChannel* thisObject = jsCast<JSMessageChannel*>(object);
184 ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
185 return getStaticValueDescriptor<JSMessageChannel, Base>(exec, getJSMessageChannelTable(exec), thisObject, propertyName, descriptor);
188 JSValue jsMessageChannelPort1(ExecState* exec, JSValue slotBase, const Identifier&)
190 JSMessageChannel* castedThis = static_cast<JSMessageChannel*>(asObject(slotBase));
192 MessageChannel* imp = static_cast<MessageChannel*>(castedThis->impl());
193 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->port1()));
198 JSValue jsMessageChannelPort2(ExecState* exec, JSValue slotBase, const Identifier&)
200 JSMessageChannel* castedThis = static_cast<JSMessageChannel*>(asObject(slotBase));
202 MessageChannel* imp = static_cast<MessageChannel*>(castedThis->impl());
203 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->port2()));
208 JSValue jsMessageChannelConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
210 JSMessageChannel* domObject = static_cast<JSMessageChannel*>(asObject(slotBase));
211 return JSMessageChannel::getConstructor(exec, domObject->globalObject());
214 JSValue JSMessageChannel::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
216 return getDOMConstructor<JSMessageChannelConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
219 static inline bool isObservable(JSMessageChannel* jsMessageChannel)
221 if (jsMessageChannel->hasCustomProperties())
226 bool JSMessageChannelOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
228 JSMessageChannel* jsMessageChannel = static_cast<JSMessageChannel*>(handle.get().asCell());
229 if (!isObservable(jsMessageChannel))
231 UNUSED_PARAM(visitor);
235 void JSMessageChannelOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
237 JSMessageChannel* jsMessageChannel = static_cast<JSMessageChannel*>(handle.get().asCell());
238 DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
239 uncacheWrapper(world, jsMessageChannel->impl(), jsMessageChannel);
240 jsMessageChannel->releaseImpl();
243 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, MessageChannel* impl)
245 return wrap<JSMessageChannel>(exec, globalObject, impl);
248 MessageChannel* toMessageChannel(JSC::JSValue value)
250 return value.inherits(&JSMessageChannel::s_info) ? static_cast<JSMessageChannel*>(asObject(value))->impl() : 0;