|
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 #include "JSFile.h" |
|
23 |
|
24 #include "File.h" |
|
25 #include "KURL.h" |
|
26 #include <runtime/JSNumberCell.h> |
|
27 #include <runtime/JSString.h> |
|
28 #include <wtf/GetPtr.h> |
|
29 |
|
30 using namespace JSC; |
|
31 |
|
32 namespace WebCore { |
|
33 |
|
34 ASSERT_CLASS_FITS_IN_CELL(JSFile); |
|
35 |
|
36 /* Hash table */ |
|
37 #if ENABLE(JIT) |
|
38 #define THUNK_GENERATOR(generator) , generator |
|
39 #else |
|
40 #define THUNK_GENERATOR(generator) |
|
41 #endif |
|
42 |
|
43 static const HashTableValue JSFileTableValues[5] = |
|
44 { |
|
45 { "name", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsFileName), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
46 { "fileName", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsFileFileName), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
47 { "fileSize", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsFileFileSize), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
48 { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsFileConstructor), (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 JSFileTable = { 9, 7, JSFileTableValues, 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 JSFileConstructorTableValues[1] = |
|
62 { |
|
63 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
64 }; |
|
65 |
|
66 #undef THUNK_GENERATOR |
|
67 static JSC_CONST_HASHTABLE HashTable JSFileConstructorTable = { 1, 0, JSFileConstructorTableValues, 0 }; |
|
68 class JSFileConstructor : public DOMConstructorObject { |
|
69 public: |
|
70 JSFileConstructor(JSC::ExecState*, JSDOMGlobalObject*); |
|
71 |
|
72 virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&); |
|
73 virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&); |
|
74 virtual const JSC::ClassInfo* classInfo() const { return &s_info; } |
|
75 static const JSC::ClassInfo s_info; |
|
76 static PassRefPtr<JSC::Structure> createStructure(JSC::JSValue prototype) |
|
77 { |
|
78 return JSC::Structure::create(prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount); |
|
79 } |
|
80 protected: |
|
81 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; |
|
82 }; |
|
83 |
|
84 const ClassInfo JSFileConstructor::s_info = { "FileConstructor", 0, &JSFileConstructorTable, 0 }; |
|
85 |
|
86 JSFileConstructor::JSFileConstructor(ExecState* exec, JSDOMGlobalObject* globalObject) |
|
87 : DOMConstructorObject(JSFileConstructor::createStructure(globalObject->objectPrototype()), globalObject) |
|
88 { |
|
89 putDirect(exec->propertyNames().prototype, JSFilePrototype::self(exec, globalObject), DontDelete | ReadOnly); |
|
90 } |
|
91 |
|
92 bool JSFileConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
93 { |
|
94 return getStaticValueSlot<JSFileConstructor, DOMObject>(exec, &JSFileConstructorTable, this, propertyName, slot); |
|
95 } |
|
96 |
|
97 bool JSFileConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
98 { |
|
99 return getStaticValueDescriptor<JSFileConstructor, DOMObject>(exec, &JSFileConstructorTable, this, propertyName, descriptor); |
|
100 } |
|
101 |
|
102 /* Hash table for prototype */ |
|
103 #if ENABLE(JIT) |
|
104 #define THUNK_GENERATOR(generator) , generator |
|
105 #else |
|
106 #define THUNK_GENERATOR(generator) |
|
107 #endif |
|
108 |
|
109 static const HashTableValue JSFilePrototypeTableValues[1] = |
|
110 { |
|
111 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
112 }; |
|
113 |
|
114 #undef THUNK_GENERATOR |
|
115 static JSC_CONST_HASHTABLE HashTable JSFilePrototypeTable = { 1, 0, JSFilePrototypeTableValues, 0 }; |
|
116 const ClassInfo JSFilePrototype::s_info = { "FilePrototype", 0, &JSFilePrototypeTable, 0 }; |
|
117 |
|
118 JSObject* JSFilePrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
119 { |
|
120 return getDOMPrototype<JSFile>(exec, globalObject); |
|
121 } |
|
122 |
|
123 const ClassInfo JSFile::s_info = { "File", &JSBlob::s_info, &JSFileTable, 0 }; |
|
124 |
|
125 JSFile::JSFile(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<File> impl) |
|
126 : JSBlob(structure, globalObject, impl) |
|
127 { |
|
128 } |
|
129 |
|
130 JSObject* JSFile::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
131 { |
|
132 return new (exec) JSFilePrototype(globalObject, JSFilePrototype::createStructure(JSBlobPrototype::self(exec, globalObject))); |
|
133 } |
|
134 |
|
135 bool JSFile::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
136 { |
|
137 return getStaticValueSlot<JSFile, Base>(exec, &JSFileTable, this, propertyName, slot); |
|
138 } |
|
139 |
|
140 bool JSFile::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
141 { |
|
142 return getStaticValueDescriptor<JSFile, Base>(exec, &JSFileTable, this, propertyName, descriptor); |
|
143 } |
|
144 |
|
145 JSValue jsFileName(ExecState* exec, JSValue slotBase, const Identifier&) |
|
146 { |
|
147 JSFile* castedThis = static_cast<JSFile*>(asObject(slotBase)); |
|
148 UNUSED_PARAM(exec); |
|
149 File* imp = static_cast<File*>(castedThis->impl()); |
|
150 JSValue result = jsString(exec, imp->name()); |
|
151 return result; |
|
152 } |
|
153 |
|
154 JSValue jsFileFileName(ExecState* exec, JSValue slotBase, const Identifier&) |
|
155 { |
|
156 JSFile* castedThis = static_cast<JSFile*>(asObject(slotBase)); |
|
157 UNUSED_PARAM(exec); |
|
158 File* imp = static_cast<File*>(castedThis->impl()); |
|
159 JSValue result = jsString(exec, imp->fileName()); |
|
160 return result; |
|
161 } |
|
162 |
|
163 JSValue jsFileFileSize(ExecState* exec, JSValue slotBase, const Identifier&) |
|
164 { |
|
165 JSFile* castedThis = static_cast<JSFile*>(asObject(slotBase)); |
|
166 UNUSED_PARAM(exec); |
|
167 File* imp = static_cast<File*>(castedThis->impl()); |
|
168 JSValue result = jsNumber(exec, imp->fileSize()); |
|
169 return result; |
|
170 } |
|
171 |
|
172 JSValue jsFileConstructor(ExecState* exec, JSValue slotBase, const Identifier&) |
|
173 { |
|
174 JSFile* domObject = static_cast<JSFile*>(asObject(slotBase)); |
|
175 return JSFile::getConstructor(exec, domObject->globalObject()); |
|
176 } |
|
177 JSValue JSFile::getConstructor(ExecState* exec, JSGlobalObject* globalObject) |
|
178 { |
|
179 return getDOMConstructor<JSFileConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject)); |
|
180 } |
|
181 |
|
182 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, File* object) |
|
183 { |
|
184 return getDOMObjectWrapper<JSFile>(exec, globalObject, object); |
|
185 } |
|
186 File* toFile(JSC::JSValue value) |
|
187 { |
|
188 return value.inherits(&JSFile::s_info) ? static_cast<JSFile*>(asObject(value))->impl() : 0; |
|
189 } |
|
190 |
|
191 } |