|
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(3D_CANVAS) |
|
24 |
|
25 #include "JSArrayBuffer.h" |
|
26 |
|
27 #include "ArrayBuffer.h" |
|
28 #include <runtime/JSNumberCell.h> |
|
29 #include <wtf/GetPtr.h> |
|
30 |
|
31 using namespace JSC; |
|
32 |
|
33 namespace WebCore { |
|
34 |
|
35 ASSERT_CLASS_FITS_IN_CELL(JSArrayBuffer); |
|
36 |
|
37 /* Hash table */ |
|
38 #if ENABLE(JIT) |
|
39 #define THUNK_GENERATOR(generator) , generator |
|
40 #else |
|
41 #define THUNK_GENERATOR(generator) |
|
42 #endif |
|
43 |
|
44 static const HashTableValue JSArrayBufferTableValues[3] = |
|
45 { |
|
46 { "byteLength", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsArrayBufferByteLength), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
47 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsArrayBufferConstructor), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
48 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
49 }; |
|
50 |
|
51 #undef THUNK_GENERATOR |
|
52 static JSC_CONST_HASHTABLE HashTable JSArrayBufferTable = { 5, 3, JSArrayBufferTableValues, 0 }; |
|
53 /* Hash table for constructor */ |
|
54 #if ENABLE(JIT) |
|
55 #define THUNK_GENERATOR(generator) , generator |
|
56 #else |
|
57 #define THUNK_GENERATOR(generator) |
|
58 #endif |
|
59 |
|
60 static const HashTableValue JSArrayBufferConstructorTableValues[1] = |
|
61 { |
|
62 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
63 }; |
|
64 |
|
65 #undef THUNK_GENERATOR |
|
66 static JSC_CONST_HASHTABLE HashTable JSArrayBufferConstructorTable = { 1, 0, JSArrayBufferConstructorTableValues, 0 }; |
|
67 const ClassInfo JSArrayBufferConstructor::s_info = { "ArrayBufferConstructor", 0, &JSArrayBufferConstructorTable, 0 }; |
|
68 |
|
69 JSArrayBufferConstructor::JSArrayBufferConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
70 : DOMConstructorObject(JSArrayBufferConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
71 { |
|
72 putDirect(exec->propertyNames().prototype, JSArrayBufferPrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
73 } |
|
74 |
|
75 bool JSArrayBufferConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
76 { |
|
77 return getStaticValueSlot<JSArrayBufferConstructor, DOMObject>(exec, &JSArrayBufferConstructorTable, this, propertyName, slot); |
|
78 } |
|
79 |
|
80 bool JSArrayBufferConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
81 { |
|
82 return getStaticValueDescriptor<JSArrayBufferConstructor, DOMObject>(exec, &JSArrayBufferConstructorTable, this, propertyName, descriptor); |
|
83 } |
|
84 |
|
85 ConstructType JSArrayBufferConstructor::getConstructData(ConstructData& constructData) |
|
86 { |
|
87 constructData.native.function = constructJSArrayBuffer; |
|
88 return ConstructTypeHost; |
|
89 } |
|
90 |
|
91 /* Hash table for prototype */ |
|
92 #if ENABLE(JIT) |
|
93 #define THUNK_GENERATOR(generator) , generator |
|
94 #else |
|
95 #define THUNK_GENERATOR(generator) |
|
96 #endif |
|
97 |
|
98 static const HashTableValue JSArrayBufferPrototypeTableValues[1] = |
|
99 { |
|
100 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
101 }; |
|
102 |
|
103 #undef THUNK_GENERATOR |
|
104 static JSC_CONST_HASHTABLE HashTable JSArrayBufferPrototypeTable = { 1, 0, JSArrayBufferPrototypeTableValues, 0 }; |
|
105 const ClassInfo JSArrayBufferPrototype::s_info = { "ArrayBufferPrototype", 0, &JSArrayBufferPrototypeTable, 0 }; |
|
106 |
|
107 JSObject* JSArrayBufferPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
108 { |
|
109 return getDOMPrototype<JSArrayBuffer>(exec, globalObject); |
|
110 } |
|
111 |
|
112 const ClassInfo JSArrayBuffer::s_info = { "ArrayBuffer", 0, &JSArrayBufferTable, 0 }; |
|
113 |
|
114 JSArrayBuffer::JSArrayBuffer(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<ArrayBuffer> impl) |
|
115 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
116 , m_impl(impl) |
|
117 { |
|
118 } |
|
119 |
|
120 JSArrayBuffer::~JSArrayBuffer() |
|
121 { |
|
122 forgetDOMObject(this, impl()); |
|
123 } |
|
124 |
|
125 JSObject* JSArrayBuffer::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
126 { |
|
127 return new (exec) JSArrayBufferPrototype(globalObject, JSArrayBufferPrototype::createStructure(globalObject->objectPrototype())); |
|
128 } |
|
129 |
|
130 bool JSArrayBuffer::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
131 { |
|
132 return getStaticValueSlot<JSArrayBuffer, Base>(exec, &JSArrayBufferTable, this, propertyName, slot); |
|
133 } |
|
134 |
|
135 bool JSArrayBuffer::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
136 { |
|
137 return getStaticValueDescriptor<JSArrayBuffer, Base>(exec, &JSArrayBufferTable, this, propertyName, descriptor); |
|
138 } |
|
139 |
|
140 JSValue jsArrayBufferByteLength(ExecState* exec, JSValue slotBase, const Identifier&) |
|
141 { |
|
142 JSArrayBuffer* castedThis = static_cast<JSArrayBuffer*>(asObject(slotBase)); |
|
143 UNUSED_PARAM(exec); |
|
144 ArrayBuffer* imp = static_cast<ArrayBuffer*>(castedThis->impl()); |
|
145 JSValue result = jsNumber(exec, imp->byteLength()); |
|
146 return result; |
|
147 } |
|
148 |
|
149 JSValue jsArrayBufferConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
150 { |
|
151 JSArrayBuffer* domObject = static_cast<JSArrayBuffer*>(asObject(slotBase)); |
|
152 return JSArrayBuffer::getConstructor(exec, domObject->globalObject()); |
|
153 } |
|
154 JSValue JSArrayBuffer::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
155 { |
|
156 return getDOMConstructor<JSArrayBufferConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
157 } |
|
158 |
|
159 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, ArrayBuffer* object) |
|
160 { |
|
161 return getDOMObjectWrapper<JSArrayBuffer>(exec, globalObject, object); |
|
162 } |
|
163 ArrayBuffer* toArrayBuffer(JSC::JSValue value) |
|
164 { |
|
165 return value.inherits(&JSArrayBuffer::s_info) ? static_cast<JSArrayBuffer*>(asObject(value))->impl() : 0; |
|
166 } |
|
167 |
|
168 } |
|
169 |
|
170 #endif // ENABLE(3D_CANVAS) |