|
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(GEOLOCATION) |
|
24 |
|
25 #include "JSGeolocation.h" |
|
26 |
|
27 #include "Geolocation.h" |
|
28 #include <runtime/Error.h> |
|
29 #include <wtf/GetPtr.h> |
|
30 |
|
31 using namespace JSC; |
|
32 |
|
33 namespace WebCore { |
|
34 |
|
35 ASSERT_CLASS_FITS_IN_CELL(JSGeolocation); |
|
36 |
|
37 /* Hash table for prototype */ |
|
38 #if ENABLE(JIT) |
|
39 #define THUNK_GENERATOR(generator) , generator |
|
40 #else |
|
41 #define THUNK_GENERATOR(generator) |
|
42 #endif |
|
43 |
|
44 static const HashTableValue JSGeolocationPrototypeTableValues[4] = |
|
45 { |
|
46 { "getCurrentPosition", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsGeolocationPrototypeFunctionGetCurrentPosition), (intptr_t)3 THUNK_GENERATOR(0) }, |
|
47 { "watchPosition", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsGeolocationPrototypeFunctionWatchPosition), (intptr_t)3 THUNK_GENERATOR(0) }, |
|
48 { "clearWatch", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsGeolocationPrototypeFunctionClearWatch), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
49 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
50 }; |
|
51 |
|
52 #undef THUNK_GENERATOR |
|
53 static JSC_CONST_HASHTABLE HashTable JSGeolocationPrototypeTable = { 9, 7, JSGeolocationPrototypeTableValues, 0 }; |
|
54 const ClassInfo JSGeolocationPrototype::s_info = { "GeolocationPrototype", 0, &JSGeolocationPrototypeTable, 0 }; |
|
55 |
|
56 JSObject* JSGeolocationPrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
57 { |
|
58 return getDOMPrototype<JSGeolocation>(exec, globalObject); |
|
59 } |
|
60 |
|
61 bool JSGeolocationPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
62 { |
|
63 return getStaticFunctionSlot<JSObject>(exec, &JSGeolocationPrototypeTable, this, propertyName, slot); |
|
64 } |
|
65 |
|
66 bool JSGeolocationPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
67 { |
|
68 return getStaticFunctionDescriptor<JSObject>(exec, &JSGeolocationPrototypeTable, this, propertyName, descriptor); |
|
69 } |
|
70 |
|
71 const ClassInfo JSGeolocation::s_info = { "Geolocation", 0, 0, 0 }; |
|
72 |
|
73 JSGeolocation::JSGeolocation(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Geolocation> impl) |
|
74 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
75 , m_impl(impl) |
|
76 { |
|
77 } |
|
78 |
|
79 JSGeolocation::~JSGeolocation() |
|
80 { |
|
81 forgetDOMObject(this, impl()); |
|
82 } |
|
83 |
|
84 JSObject* JSGeolocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
85 { |
|
86 return new (exec) JSGeolocationPrototype(globalObject, JSGeolocationPrototype::createStructure(globalObject->objectPrototype())); |
|
87 } |
|
88 |
|
89 EncodedJSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionGetCurrentPosition(ExecState* exec) |
|
90 { |
|
91 JSValue thisValue = exec->hostThisValue(); |
|
92 if (!thisValue.inherits(&JSGeolocation::s_info)) |
|
93 return throwVMTypeError(exec); |
|
94 JSGeolocation* castedThis = static_cast<JSGeolocation*>(asObject(thisValue)); |
|
95 return JSValue::encode(castedThis->getCurrentPosition(exec)); |
|
96 } |
|
97 |
|
98 EncodedJSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionWatchPosition(ExecState* exec) |
|
99 { |
|
100 JSValue thisValue = exec->hostThisValue(); |
|
101 if (!thisValue.inherits(&JSGeolocation::s_info)) |
|
102 return throwVMTypeError(exec); |
|
103 JSGeolocation* castedThis = static_cast<JSGeolocation*>(asObject(thisValue)); |
|
104 return JSValue::encode(castedThis->watchPosition(exec)); |
|
105 } |
|
106 |
|
107 EncodedJSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionClearWatch(ExecState* exec) |
|
108 { |
|
109 JSValue thisValue = exec->hostThisValue(); |
|
110 if (!thisValue.inherits(&JSGeolocation::s_info)) |
|
111 return throwVMTypeError(exec); |
|
112 JSGeolocation* castedThis = static_cast<JSGeolocation*>(asObject(thisValue)); |
|
113 Geolocation* imp = static_cast<Geolocation*>(castedThis->impl()); |
|
114 int watchId = exec->argument(0).toInt32(exec); |
|
115 |
|
116 imp->clearWatch(watchId); |
|
117 return JSValue::encode(jsUndefined()); |
|
118 } |
|
119 |
|
120 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Geolocation* object) |
|
121 { |
|
122 return getDOMObjectWrapper<JSGeolocation>(exec, globalObject, object); |
|
123 } |
|
124 Geolocation* toGeolocation(JSC::JSValue value) |
|
125 { |
|
126 return value.inherits(&JSGeolocation::s_info) ? static_cast<JSGeolocation*>(asObject(value))->impl() : 0; |
|
127 } |
|
128 |
|
129 } |
|
130 |
|
131 #endif // ENABLE(GEOLOCATION) |