|
1 /* |
|
2 This file is part of the WebKit open source project. |
|
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY! |
|
4 |
|
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. |
|
9 |
|
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. |
|
14 |
|
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. |
|
19 */ |
|
20 |
|
21 #include "config.h" |
|
22 |
|
23 #if ENABLE(SHARED_WORKERS) |
|
24 |
|
25 #include "JSSharedWorker.h" |
|
26 |
|
27 #include "JSMessagePort.h" |
|
28 #include "MessagePort.h" |
|
29 #include "SharedWorker.h" |
|
30 #include <wtf/GetPtr.h> |
|
31 |
|
32 using namespace JSC; |
|
33 |
|
34 namespace WebCore { |
|
35 |
|
36 ASSERT_CLASS_FITS_IN_CELL(JSSharedWorker); |
|
37 |
|
38 /* Hash table */ |
|
39 #if ENABLE(JIT) |
|
40 #define THUNK_GENERATOR(generator) , generator |
|
41 #else |
|
42 #define THUNK_GENERATOR(generator) |
|
43 #endif |
|
44 |
|
45 static const HashTableValue JSSharedWorkerTableValues[3] = |
|
46 { |
|
47 { "port", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSharedWorkerPort), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
48 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSharedWorkerConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
49 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
50 }; |
|
51 |
|
52 #undef THUNK_GENERATOR |
|
53 static JSC_CONST_HASHTABLE HashTable JSSharedWorkerTable = { 4, 3, JSSharedWorkerTableValues, 0 }; |
|
54 /* Hash table for constructor */ |
|
55 #if ENABLE(JIT) |
|
56 #define THUNK_GENERATOR(generator) , generator |
|
57 #else |
|
58 #define THUNK_GENERATOR(generator) |
|
59 #endif |
|
60 |
|
61 static const HashTableValue JSSharedWorkerConstructorTableValues[1] = |
|
62 { |
|
63 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
64 }; |
|
65 |
|
66 #undef THUNK_GENERATOR |
|
67 static JSC_CONST_HASHTABLE HashTable JSSharedWorkerConstructorTable = { 1, 0, JSSharedWorkerConstructorTableValues, 0 }; |
|
68 const ClassInfo JSSharedWorkerConstructor::s_info = { "SharedWorkerConstructor", 0, &JSSharedWorkerConstructorTable, 0 }; |
|
69 |
|
70 JSSharedWorkerConstructor::JSSharedWorkerConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
71 : DOMConstructorObject(JSSharedWorkerConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
72 { |
|
73 putDirect(exec->propertyNames().prototype, JSSharedWorkerPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
74 putDirect(exec->propertyNames().length, jsNumber(exec, 2), ReadOnly | DontDelete | DontEnum); |
|
75 } |
|
76 |
|
77 bool JSSharedWorkerConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
78 { |
|
79 return getStaticValueSlot<JSSharedWorkerConstructor, DOMObject>(exec, &JSSharedWorkerConstructorTable, this, propertyName, slot); |
|
80 } |
|
81 |
|
82 bool JSSharedWorkerConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
83 { |
|
84 return getStaticValueDescriptor<JSSharedWorkerConstructor, DOMObject>(exec, &JSSharedWorkerConstructorTable, this, propertyName, descriptor); |
|
85 } |
|
86 |
|
87 ConstructType JSSharedWorkerConstructor::getConstructData(ConstructData& constructData) |
|
88 { |
|
89 constructData.native.function = constructJSSharedWorker; |
|
90 return ConstructTypeHost; |
|
91 } |
|
92 |
|
93 /* Hash table for prototype */ |
|
94 #if ENABLE(JIT) |
|
95 #define THUNK_GENERATOR(generator) , generator |
|
96 #else |
|
97 #define THUNK_GENERATOR(generator) |
|
98 #endif |
|
99 |
|
100 static const HashTableValue JSSharedWorkerPrototypeTableValues[1] = |
|
101 { |
|
102 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
103 }; |
|
104 |
|
105 #undef THUNK_GENERATOR |
|
106 static JSC_CONST_HASHTABLE HashTable JSSharedWorkerPrototypeTable = { 1, 0, JSSharedWorkerPrototypeTableValues, 0 }; |
|
107 const ClassInfo JSSharedWorkerPrototype::s_info = { "SharedWorkerPrototype", 0, &JSSharedWorkerPrototypeTable, 0 }; |
|
108 |
|
109 JSObject* JSSharedWorkerPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
110 { |
|
111 return getDOMPrototype<JSSharedWorker>(exec, globalObject); |
|
112 } |
|
113 |
|
114 const ClassInfo JSSharedWorker::s_info = { "SharedWorker", &JSAbstractWorker::s_info, &JSSharedWorkerTable, 0 }; |
|
115 |
|
116 JSSharedWorker::JSSharedWorker(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<SharedWorker> impl) |
|
117 : JSAbstractWorker(structure, globalObject, impl) |
|
118 { |
|
119 } |
|
120 |
|
121 JSObject* JSSharedWorker::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
122 { |
|
123 return new (exec) JSSharedWorkerPrototype(globalObject, JSSharedWorkerPrototype::createStructure(JSAbstractWorkerPrototype::self(exec, globalObject))); |
|
124 } |
|
125 |
|
126 bool JSSharedWorker::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
127 { |
|
128 return getStaticValueSlot<JSSharedWorker, Base>(exec, &JSSharedWorkerTable, this, propertyName, slot); |
|
129 } |
|
130 |
|
131 bool JSSharedWorker::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
132 { |
|
133 return getStaticValueDescriptor<JSSharedWorker, Base>(exec, &JSSharedWorkerTable, this, propertyName, descriptor); |
|
134 } |
|
135 |
|
136 JSValue jsSharedWorkerPort(ExecState* exec, JSValue slotBase, const Identifier&) |
|
137 { |
|
138 JSSharedWorker* castedThis = static_cast<JSSharedWorker*>(asObject(slotBase)); |
|
139 UNUSED_PARAM(exec); |
|
140 SharedWorker* imp = static_cast<SharedWorker*>(castedThis->impl()); |
|
141 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->port())); |
|
142 return result; |
|
143 } |
|
144 |
|
145 JSValue jsSharedWorkerConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
146 { |
|
147 JSSharedWorker* domObject = static_cast<JSSharedWorker*>(asObject(slotBase)); |
|
148 return JSSharedWorker::getConstructor(exec, domObject->globalObject()); |
|
149 } |
|
150 JSValue JSSharedWorker::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
151 { |
|
152 return getDOMConstructor<JSSharedWorkerConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
153 } |
|
154 |
|
155 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, SharedWorker* object) |
|
156 { |
|
157 return getDOMObjectWrapper<JSSharedWorker>(exec, globalObject, object); |
|
158 } |
|
159 SharedWorker* toSharedWorker(JSC::JSValue value) |
|
160 { |
|
161 return value.inherits(&JSSharedWorker::s_info) ? static_cast<JSSharedWorker*>(asObject(value))->impl() : 0; |
|
162 } |
|
163 |
|
164 } |
|
165 |
|
166 #endif // ENABLE(SHARED_WORKERS) |