|
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 "JSArrayBufferView.h" |
|
26 |
|
27 #include "ArrayBuffer.h" |
|
28 #include "ArrayBufferView.h" |
|
29 #include "JSArrayBuffer.h" |
|
30 #include <runtime/Error.h> |
|
31 #include <runtime/JSNumberCell.h> |
|
32 #include <wtf/GetPtr.h> |
|
33 |
|
34 using namespace JSC; |
|
35 |
|
36 namespace WebCore { |
|
37 |
|
38 ASSERT_CLASS_FITS_IN_CELL(JSArrayBufferView); |
|
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 JSArrayBufferViewTableValues[5] = |
|
48 { |
|
49 { "buffer", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsArrayBufferViewBuffer), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
50 { "byteOffset", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsArrayBufferViewByteOffset), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
51 { "byteLength", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsArrayBufferViewByteLength), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
52 { "length", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsArrayBufferViewLength), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
53 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
54 }; |
|
55 |
|
56 #undef THUNK_GENERATOR |
|
57 static JSC_CONST_HASHTABLE HashTable JSArrayBufferViewTable = { 8, 7, JSArrayBufferViewTableValues, 0 }; |
|
58 /* Hash table for prototype */ |
|
59 #if ENABLE(JIT) |
|
60 #define THUNK_GENERATOR(generator) , generator |
|
61 #else |
|
62 #define THUNK_GENERATOR(generator) |
|
63 #endif |
|
64 |
|
65 static const HashTableValue JSArrayBufferViewPrototypeTableValues[2] = |
|
66 { |
|
67 { "slice", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsArrayBufferViewPrototypeFunctionSlice), (intptr_t)2 THUNK_GENERATOR(0) }, |
|
68 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
69 }; |
|
70 |
|
71 #undef THUNK_GENERATOR |
|
72 static JSC_CONST_HASHTABLE HashTable JSArrayBufferViewPrototypeTable = { 2, 1, JSArrayBufferViewPrototypeTableValues, 0 }; |
|
73 const ClassInfo JSArrayBufferViewPrototype::s_info = { "ArrayBufferViewPrototype", 0, &JSArrayBufferViewPrototypeTable, 0 }; |
|
74 |
|
75 JSObject* JSArrayBufferViewPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
76 { |
|
77 return getDOMPrototype<JSArrayBufferView>(exec, globalObject); |
|
78 } |
|
79 |
|
80 bool JSArrayBufferViewPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
81 { |
|
82 return getStaticFunctionSlot<JSObject>(exec, &JSArrayBufferViewPrototypeTable, this, propertyName, slot); |
|
83 } |
|
84 |
|
85 bool JSArrayBufferViewPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
86 { |
|
87 return getStaticFunctionDescriptor<JSObject>(exec, &JSArrayBufferViewPrototypeTable, this, propertyName, descriptor); |
|
88 } |
|
89 |
|
90 const ClassInfo JSArrayBufferView::s_info = { "ArrayBufferView", 0, &JSArrayBufferViewTable, 0 }; |
|
91 |
|
92 JSArrayBufferView::JSArrayBufferView(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<ArrayBufferView> impl) |
|
93 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
94 , m_impl(impl) |
|
95 { |
|
96 } |
|
97 |
|
98 JSArrayBufferView::~JSArrayBufferView() |
|
99 { |
|
100 forgetDOMObject(this, impl()); |
|
101 } |
|
102 |
|
103 JSObject* JSArrayBufferView::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
104 { |
|
105 return new (exec) JSArrayBufferViewPrototype(globalObject, JSArrayBufferViewPrototype::createStructure(globalObject->objectPrototype())); |
|
106 } |
|
107 |
|
108 bool JSArrayBufferView::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
109 { |
|
110 return getStaticValueSlot<JSArrayBufferView, Base>(exec, &JSArrayBufferViewTable, this, propertyName, slot); |
|
111 } |
|
112 |
|
113 bool JSArrayBufferView::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
114 { |
|
115 return getStaticValueDescriptor<JSArrayBufferView, Base>(exec, &JSArrayBufferViewTable, this, propertyName, descriptor); |
|
116 } |
|
117 |
|
118 JSValue jsArrayBufferViewBuffer(ExecState* exec, JSValue slotBase, const Identifier&) |
|
119 { |
|
120 JSArrayBufferView* castedThis = static_cast<JSArrayBufferView*>(asObject(slotBase)); |
|
121 UNUSED_PARAM(exec); |
|
122 ArrayBufferView* imp = static_cast<ArrayBufferView*>(castedThis->impl()); |
|
123 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->buffer())); |
|
124 return result; |
|
125 } |
|
126 |
|
127 JSValue jsArrayBufferViewByteOffset(ExecState* exec, JSValue slotBase, const Identifier&) |
|
128 { |
|
129 JSArrayBufferView* castedThis = static_cast<JSArrayBufferView*>(asObject(slotBase)); |
|
130 UNUSED_PARAM(exec); |
|
131 ArrayBufferView* imp = static_cast<ArrayBufferView*>(castedThis->impl()); |
|
132 JSValue result = jsNumber(exec, imp->byteOffset()); |
|
133 return result; |
|
134 } |
|
135 |
|
136 JSValue jsArrayBufferViewByteLength(ExecState* exec, JSValue slotBase, const Identifier&) |
|
137 { |
|
138 JSArrayBufferView* castedThis = static_cast<JSArrayBufferView*>(asObject(slotBase)); |
|
139 UNUSED_PARAM(exec); |
|
140 ArrayBufferView* imp = static_cast<ArrayBufferView*>(castedThis->impl()); |
|
141 JSValue result = jsNumber(exec, imp->byteLength()); |
|
142 return result; |
|
143 } |
|
144 |
|
145 JSValue jsArrayBufferViewLength(ExecState* exec, JSValue slotBase, const Identifier&) |
|
146 { |
|
147 JSArrayBufferView* castedThis = static_cast<JSArrayBufferView*>(asObject(slotBase)); |
|
148 UNUSED_PARAM(exec); |
|
149 ArrayBufferView* imp = static_cast<ArrayBufferView*>(castedThis->impl()); |
|
150 JSValue result = jsNumber(exec, imp->length()); |
|
151 return result; |
|
152 } |
|
153 |
|
154 EncodedJSValue JSC_HOST_CALL jsArrayBufferViewPrototypeFunctionSlice(ExecState* exec) |
|
155 { |
|
156 JSValue thisValue = exec->hostThisValue(); |
|
157 if (!thisValue.inherits(&JSArrayBufferView::s_info)) |
|
158 return throwVMTypeError(exec); |
|
159 JSArrayBufferView* castedThis = static_cast<JSArrayBufferView*>(asObject(thisValue)); |
|
160 return JSValue::encode(castedThis->slice(exec)); |
|
161 } |
|
162 |
|
163 ArrayBufferView* toArrayBufferView(JSC::JSValue value) |
|
164 { |
|
165 return value.inherits(&JSArrayBufferView::s_info) ? static_cast<JSArrayBufferView*>(asObject(value))->impl() : 0; |
|
166 } |
|
167 |
|
168 } |
|
169 |
|
170 #endif // ENABLE(3D_CANVAS) |