|
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 "JSSharedWorkerContext.h" |
|
26 |
|
27 #include "EventListener.h" |
|
28 #include "JSEventListener.h" |
|
29 #include "KURL.h" |
|
30 #include "SharedWorkerContext.h" |
|
31 #include <runtime/JSString.h> |
|
32 #include <wtf/GetPtr.h> |
|
33 |
|
34 using namespace JSC; |
|
35 |
|
36 namespace WebCore { |
|
37 |
|
38 ASSERT_CLASS_FITS_IN_CELL(JSSharedWorkerContext); |
|
39 |
|
40 /* Hash table */ |
|
41 #if ENABLE(JIT) |
|
42 #define THUNK_GENERATOR(generator) , generator |
|
43 #else |
|
44 #define THUNK_GENERATOR(generator) |
|
45 #endif |
|
46 |
|
47 static const HashTableValue JSSharedWorkerContextTableValues[3] = |
|
48 { |
|
49 { "name", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSharedWorkerContextName), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
50 { "onconnect", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsSharedWorkerContextOnconnect), (intptr_t)setJSSharedWorkerContextOnconnect THUNK_GENERATOR(0) }, |
|
51 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
52 }; |
|
53 |
|
54 #undef THUNK_GENERATOR |
|
55 static JSC_CONST_HASHTABLE HashTable JSSharedWorkerContextTable = { 4, 3, JSSharedWorkerContextTableValues, 0 }; |
|
56 /* Hash table for prototype */ |
|
57 #if ENABLE(JIT) |
|
58 #define THUNK_GENERATOR(generator) , generator |
|
59 #else |
|
60 #define THUNK_GENERATOR(generator) |
|
61 #endif |
|
62 |
|
63 static const HashTableValue JSSharedWorkerContextPrototypeTableValues[1] = |
|
64 { |
|
65 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
66 }; |
|
67 |
|
68 #undef THUNK_GENERATOR |
|
69 static JSC_CONST_HASHTABLE HashTable JSSharedWorkerContextPrototypeTable = { 1, 0, JSSharedWorkerContextPrototypeTableValues, 0 }; |
|
70 static const HashTable* getJSSharedWorkerContextPrototypeTable(ExecState* exec) |
|
71 { |
|
72 return getHashTableForGlobalData(exec->globalData(), &JSSharedWorkerContextPrototypeTable); |
|
73 } |
|
74 const ClassInfo JSSharedWorkerContextPrototype::s_info = { "SharedWorkerContextPrototype", 0, 0, getJSSharedWorkerContextPrototypeTable }; |
|
75 |
|
76 void* JSSharedWorkerContextPrototype::operator new(size_t size, JSGlobalData* globalData) |
|
77 { |
|
78 return globalData->heap.allocate(size); |
|
79 } |
|
80 |
|
81 static const HashTable* getJSSharedWorkerContextTable(ExecState* exec) |
|
82 { |
|
83 return getHashTableForGlobalData(exec->globalData(), &JSSharedWorkerContextTable); |
|
84 } |
|
85 const ClassInfo JSSharedWorkerContext::s_info = { "SharedWorkerContext", &JSWorkerContext::s_info, 0, getJSSharedWorkerContextTable }; |
|
86 |
|
87 JSSharedWorkerContext::JSSharedWorkerContext(NonNullPassRefPtr<Structure> structure, PassRefPtr<SharedWorkerContext> impl) |
|
88 : JSWorkerContext(structure, impl) |
|
89 { |
|
90 } |
|
91 |
|
92 bool JSSharedWorkerContext::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
93 { |
|
94 return getStaticValueSlot<JSSharedWorkerContext, Base>(exec, getJSSharedWorkerContextTable(exec), this, propertyName, slot); |
|
95 } |
|
96 |
|
97 bool JSSharedWorkerContext::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
98 { |
|
99 return getStaticValueDescriptor<JSSharedWorkerContext, Base>(exec, getJSSharedWorkerContextTable(exec), this, propertyName, descriptor); |
|
100 } |
|
101 |
|
102 JSValue jsSharedWorkerContextName(ExecState* exec, JSValue slotBase, const Identifier&) |
|
103 { |
|
104 JSSharedWorkerContext* castedThis = static_cast<JSSharedWorkerContext*>(asObject(slotBase)); |
|
105 UNUSED_PARAM(exec); |
|
106 SharedWorkerContext* imp = static_cast<SharedWorkerContext*>(castedThis->impl()); |
|
107 JSValue result = jsString(exec, imp->name()); |
|
108 return result; |
|
109 } |
|
110 |
|
111 JSValue jsSharedWorkerContextOnconnect(ExecState* exec, JSValue slotBase, const Identifier&) |
|
112 { |
|
113 JSSharedWorkerContext* castedThis = static_cast<JSSharedWorkerContext*>(asObject(slotBase)); |
|
114 UNUSED_PARAM(exec); |
|
115 SharedWorkerContext* imp = static_cast<SharedWorkerContext*>(castedThis->impl()); |
|
116 if (EventListener* listener = imp->onconnect()) { |
|
117 if (const JSEventListener* jsListener = JSEventListener::cast(listener)) { |
|
118 if (JSObject* jsFunction = jsListener->jsFunction(imp)) |
|
119 return jsFunction; |
|
120 } |
|
121 } |
|
122 return jsNull(); |
|
123 } |
|
124 |
|
125 void JSSharedWorkerContext::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) |
|
126 { |
|
127 lookupPut<JSSharedWorkerContext, Base>(exec, propertyName, value, getJSSharedWorkerContextTable(exec), this, slot); |
|
128 } |
|
129 |
|
130 void setJSSharedWorkerContextOnconnect(ExecState* exec, JSObject* thisObject, JSValue value) |
|
131 { |
|
132 UNUSED_PARAM(exec); |
|
133 SharedWorkerContext* imp = static_cast<SharedWorkerContext*>(static_cast<JSSharedWorkerContext*>(thisObject)->impl()); |
|
134 imp->setOnconnect(createJSAttributeEventListener(exec, value, thisObject)); |
|
135 } |
|
136 |
|
137 SharedWorkerContext* toSharedWorkerContext(JSC::JSValue value) |
|
138 { |
|
139 return value.inherits(&JSSharedWorkerContext::s_info) ? static_cast<JSSharedWorkerContext*>(asObject(value))->impl() : 0; |
|
140 } |
|
141 |
|
142 } |
|
143 |
|
144 #endif // ENABLE(SHARED_WORKERS) |