~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/webkit/WebCore/generated/JSGeolocation.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
*/
20
20
 
21
21
#include "config.h"
22
 
 
23
22
#include "JSGeolocation.h"
24
23
 
25
 
#include <wtf/GetPtr.h>
26
 
 
27
24
#include "Geolocation.h"
28
25
#include "Geoposition.h"
29
26
#include "JSGeoposition.h"
30
 
 
31
27
#include <runtime/Error.h>
 
28
#include <wtf/GetPtr.h>
32
29
 
33
30
using namespace JSC;
34
31
 
35
32
namespace WebCore {
36
33
 
37
 
ASSERT_CLASS_FITS_IN_CELL(JSGeolocation)
 
34
ASSERT_CLASS_FITS_IN_CELL(JSGeolocation);
38
35
 
39
36
/* Hash table */
40
37
 
44
41
    { 0, 0, 0, 0 }
45
42
};
46
43
 
47
 
static const HashTable JSGeolocationTable =
 
44
static JSC_CONST_HASHTABLE HashTable JSGeolocationTable =
48
45
#if ENABLE(PERFECT_HASH_SIZE)
49
46
    { 0, JSGeolocationTableValues, 0 };
50
47
#else
61
58
    { 0, 0, 0, 0 }
62
59
};
63
60
 
64
 
static const HashTable JSGeolocationPrototypeTable =
 
61
static JSC_CONST_HASHTABLE HashTable JSGeolocationPrototypeTable =
65
62
#if ENABLE(PERFECT_HASH_SIZE)
66
63
    { 15, JSGeolocationPrototypeTableValues, 0 };
67
64
#else
80
77
    return getStaticFunctionSlot<JSObject>(exec, &JSGeolocationPrototypeTable, this, propertyName, slot);
81
78
}
82
79
 
 
80
bool JSGeolocationPrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
 
81
{
 
82
    return getStaticFunctionDescriptor<JSObject>(exec, &JSGeolocationPrototypeTable, this, propertyName, descriptor);
 
83
}
 
84
 
83
85
const ClassInfo JSGeolocation::s_info = { "Geolocation", 0, &JSGeolocationTable, 0 };
84
86
 
85
 
JSGeolocation::JSGeolocation(PassRefPtr<Structure> structure, PassRefPtr<Geolocation> impl)
86
 
    : DOMObject(structure)
 
87
JSGeolocation::JSGeolocation(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Geolocation> impl)
 
88
    : DOMObjectWithGlobalPointer(structure, globalObject)
87
89
    , m_impl(impl)
88
90
{
89
91
}
90
92
 
91
93
JSGeolocation::~JSGeolocation()
92
94
{
93
 
    forgetDOMObject(*Heap::heap(this)->globalData(), m_impl.get());
94
 
 
 
95
    forgetDOMObject(*Heap::heap(this)->globalData(), impl());
95
96
}
96
97
 
97
98
JSObject* JSGeolocation::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
104
105
    return getStaticValueSlot<JSGeolocation, Base>(exec, &JSGeolocationTable, this, propertyName, slot);
105
106
}
106
107
 
107
 
JSValuePtr jsGeolocationLastPosition(ExecState* exec, const Identifier&, const PropertySlot& slot)
108
 
{
109
 
    Geolocation* imp = static_cast<Geolocation*>(static_cast<JSGeolocation*>(asObject(slot.slotBase()))->impl());
110
 
    return toJS(exec, WTF::getPtr(imp->lastPosition()));
111
 
}
112
 
 
113
 
JSValuePtr jsGeolocationPrototypeFunctionGetCurrentPosition(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
114
 
{
115
 
    if (!thisValue->isObject(&JSGeolocation::s_info))
 
108
bool JSGeolocation::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
 
109
{
 
110
    return getStaticValueDescriptor<JSGeolocation, Base>(exec, &JSGeolocationTable, this, propertyName, descriptor);
 
111
}
 
112
 
 
113
JSValue jsGeolocationLastPosition(ExecState* exec, const Identifier&, const PropertySlot& slot)
 
114
{
 
115
    JSGeolocation* castedThis = static_cast<JSGeolocation*>(asObject(slot.slotBase()));
 
116
    UNUSED_PARAM(exec);
 
117
    Geolocation* imp = static_cast<Geolocation*>(castedThis->impl());
 
118
    return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->lastPosition()));
 
119
}
 
120
 
 
121
JSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionGetCurrentPosition(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
 
122
{
 
123
    UNUSED_PARAM(args);
 
124
    if (!thisValue.inherits(&JSGeolocation::s_info))
116
125
        return throwError(exec, TypeError);
117
126
    JSGeolocation* castedThisObj = static_cast<JSGeolocation*>(asObject(thisValue));
118
127
    return castedThisObj->getCurrentPosition(exec, args);
119
128
}
120
129
 
121
 
JSValuePtr jsGeolocationPrototypeFunctionWatchPosition(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
 
130
JSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionWatchPosition(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
122
131
{
123
 
    if (!thisValue->isObject(&JSGeolocation::s_info))
 
132
    UNUSED_PARAM(args);
 
133
    if (!thisValue.inherits(&JSGeolocation::s_info))
124
134
        return throwError(exec, TypeError);
125
135
    JSGeolocation* castedThisObj = static_cast<JSGeolocation*>(asObject(thisValue));
126
136
    return castedThisObj->watchPosition(exec, args);
127
137
}
128
138
 
129
 
JSValuePtr jsGeolocationPrototypeFunctionClearWatch(ExecState* exec, JSObject*, JSValuePtr thisValue, const ArgList& args)
 
139
JSValue JSC_HOST_CALL jsGeolocationPrototypeFunctionClearWatch(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
130
140
{
131
 
    if (!thisValue->isObject(&JSGeolocation::s_info))
 
141
    UNUSED_PARAM(args);
 
142
    if (!thisValue.inherits(&JSGeolocation::s_info))
132
143
        return throwError(exec, TypeError);
133
144
    JSGeolocation* castedThisObj = static_cast<JSGeolocation*>(asObject(thisValue));
134
145
    Geolocation* imp = static_cast<Geolocation*>(castedThisObj->impl());
135
 
    int watchId = args.at(exec, 0)->toInt32(exec);
 
146
    int watchId = args.at(0).toInt32(exec);
136
147
 
137
148
    imp->clearWatch(watchId);
138
149
    return jsUndefined();
139
150
}
140
151
 
141
 
JSC::JSValuePtr toJS(JSC::ExecState* exec, Geolocation* object)
 
152
JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Geolocation* object)
142
153
{
143
 
    return getDOMObjectWrapper<JSGeolocation>(exec, object);
 
154
    return getDOMObjectWrapper<JSGeolocation>(exec, globalObject, object);
144
155
}
145
 
Geolocation* toGeolocation(JSC::JSValuePtr value)
 
156
Geolocation* toGeolocation(JSC::JSValue value)
146
157
{
147
 
    return value->isObject(&JSGeolocation::s_info) ? static_cast<JSGeolocation*>(asObject(value))->impl() : 0;
 
158
    return value.inherits(&JSGeolocation::s_info) ? static_cast<JSGeolocation*>(asObject(value))->impl() : 0;
148
159
}
149
160
 
150
161
}