WebCore/generated/JSGeoposition.cpp
changeset 0 4f2f89ce4247
equal deleted inserted replaced
-1:000000000000 0:4f2f89ce4247
       
     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 "JSGeoposition.h"
       
    26 
       
    27 #include "Coordinates.h"
       
    28 #include "Geoposition.h"
       
    29 #include "JSCoordinates.h"
       
    30 #include <runtime/JSNumberCell.h>
       
    31 #include <wtf/GetPtr.h>
       
    32 
       
    33 using namespace JSC;
       
    34 
       
    35 namespace WebCore {
       
    36 
       
    37 ASSERT_CLASS_FITS_IN_CELL(JSGeoposition);
       
    38 
       
    39 /* Hash table */
       
    40 #if ENABLE(JIT)
       
    41 #define THUNK_GENERATOR(generator) , generator
       
    42 #else
       
    43 #define THUNK_GENERATOR(generator)
       
    44 #endif
       
    45 
       
    46 static const HashTableValue JSGeopositionTableValues[3] =
       
    47 {
       
    48     { "coords", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsGeopositionCoords), (intptr_t)0 THUNK_GENERATOR(0) },
       
    49     { "timestamp", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsGeopositionTimestamp), (intptr_t)0 THUNK_GENERATOR(0) },
       
    50     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    51 };
       
    52 
       
    53 #undef THUNK_GENERATOR
       
    54 static JSC_CONST_HASHTABLE HashTable JSGeopositionTable = { 4, 3, JSGeopositionTableValues, 0 };
       
    55 /* Hash table for prototype */
       
    56 #if ENABLE(JIT)
       
    57 #define THUNK_GENERATOR(generator) , generator
       
    58 #else
       
    59 #define THUNK_GENERATOR(generator)
       
    60 #endif
       
    61 
       
    62 static const HashTableValue JSGeopositionPrototypeTableValues[1] =
       
    63 {
       
    64     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
       
    65 };
       
    66 
       
    67 #undef THUNK_GENERATOR
       
    68 static JSC_CONST_HASHTABLE HashTable JSGeopositionPrototypeTable = { 1, 0, JSGeopositionPrototypeTableValues, 0 };
       
    69 const ClassInfo JSGeopositionPrototype::s_info = { "GeopositionPrototype", 0, &JSGeopositionPrototypeTable, 0 };
       
    70 
       
    71 JSObject* JSGeopositionPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
       
    72 {
       
    73     return getDOMPrototype<JSGeoposition>(exec, globalObject);
       
    74 }
       
    75 
       
    76 const ClassInfo JSGeoposition::s_info = { "Geoposition", 0, &JSGeopositionTable, 0 };
       
    77 
       
    78 JSGeoposition::JSGeoposition(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Geoposition> impl)
       
    79     : DOMObjectWithGlobalPointer(structure, globalObject)
       
    80     , m_impl(impl)
       
    81 {
       
    82 }
       
    83 
       
    84 JSGeoposition::~JSGeoposition()
       
    85 {
       
    86     forgetDOMObject(this, impl());
       
    87 }
       
    88 
       
    89 JSObject* JSGeoposition::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
       
    90 {
       
    91     return new (exec) JSGeopositionPrototype(globalObject, JSGeopositionPrototype::createStructure(globalObject->objectPrototype()));
       
    92 }
       
    93 
       
    94 bool JSGeoposition::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
       
    95 {
       
    96     return getStaticValueSlot<JSGeoposition, Base>(exec, &JSGeopositionTable, this, propertyName, slot);
       
    97 }
       
    98 
       
    99 bool JSGeoposition::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
       
   100 {
       
   101     return getStaticValueDescriptor<JSGeoposition, Base>(exec, &JSGeopositionTable, this, propertyName, descriptor);
       
   102 }
       
   103 
       
   104 JSValue jsGeopositionCoords(ExecState* exec, JSValue slotBase, const Identifier&)
       
   105 {
       
   106     JSGeoposition* castedThis = static_cast<JSGeoposition*>(asObject(slotBase));
       
   107     UNUSED_PARAM(exec);
       
   108     Geoposition* imp = static_cast<Geoposition*>(castedThis->impl());
       
   109     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->coords()));
       
   110     return result;
       
   111 }
       
   112 
       
   113 JSValue jsGeopositionTimestamp(ExecState* exec, JSValue slotBase, const Identifier&)
       
   114 {
       
   115     JSGeoposition* castedThis = static_cast<JSGeoposition*>(asObject(slotBase));
       
   116     UNUSED_PARAM(exec);
       
   117     Geoposition* imp = static_cast<Geoposition*>(castedThis->impl());
       
   118     JSValue result = jsNumber(exec, imp->timestamp());
       
   119     return result;
       
   120 }
       
   121 
       
   122 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Geoposition* object)
       
   123 {
       
   124     return getDOMObjectWrapper<JSGeoposition>(exec, globalObject, object);
       
   125 }
       
   126 Geoposition* toGeoposition(JSC::JSValue value)
       
   127 {
       
   128     return value.inherits(&JSGeoposition::s_info) ? static_cast<JSGeoposition*>(asObject(value))->impl() : 0;
       
   129 }
       
   130 
       
   131 }
       
   132 
       
   133 #endif // ENABLE(GEOLOCATION)