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(WEB_TIMING)
24 
25 #include "JSPerformance.h"
26 
27 #include "JSMemoryInfo.h"
28 #include "JSPerformanceNavigation.h"
29 #include "JSPerformanceTiming.h"
30 #include "MemoryInfo.h"
31 #include "Performance.h"
32 #include "PerformanceNavigation.h"
33 #include "PerformanceTiming.h"
34 #include <wtf/GetPtr.h>
35 
36 using namespace JSC;
37 
38 namespace WebCore {
39 
40 ASSERT_CLASS_FITS_IN_CELL(JSPerformance);
41 
42 /* Hash table */
43 #if ENABLE(JIT)
44 #define THUNK_GENERATOR(generator) , generator
45 #else
46 #define THUNK_GENERATOR(generator)
47 #endif
48 
49 static const HashTableValue JSPerformanceTableValues[4] =
50 {
51     { "navigation", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceNavigation), (intptr_t)0 THUNK_GENERATOR(0) },
52     { "timing", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceTiming), (intptr_t)0 THUNK_GENERATOR(0) },
53     { "memory", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceMemory), (intptr_t)0 THUNK_GENERATOR(0) },
54     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
55 };
56 
57 #undef THUNK_GENERATOR
58 static JSC_CONST_HASHTABLE HashTable JSPerformanceTable = { 8, 7, JSPerformanceTableValues, 0 };
59 /* Hash table for prototype */
60 #if ENABLE(JIT)
61 #define THUNK_GENERATOR(generator) , generator
62 #else
63 #define THUNK_GENERATOR(generator)
64 #endif
65 
66 static const HashTableValue JSPerformancePrototypeTableValues[1] =
67 {
68     { 0, 0, 0, 0 THUNK_GENERATOR(0) }
69 };
70 
71 #undef THUNK_GENERATOR
72 static JSC_CONST_HASHTABLE HashTable JSPerformancePrototypeTable = { 1, 0, JSPerformancePrototypeTableValues, 0 };
73 const ClassInfo JSPerformancePrototype::s_info = { "PerformancePrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSPerformancePrototypeTable, 0 };
74 
self(ExecState * exec,JSGlobalObject * globalObject)75 JSObject* JSPerformancePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
76 {
77     return getDOMPrototype<JSPerformance>(exec, globalObject);
78 }
79 
80 const ClassInfo JSPerformance::s_info = { "Performance", &JSDOMWrapper::s_info, &JSPerformanceTable, 0 };
81 
JSPerformance(Structure * structure,JSDOMGlobalObject * globalObject,PassRefPtr<Performance> impl)82 JSPerformance::JSPerformance(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<Performance> impl)
83     : JSDOMWrapper(structure, globalObject)
84     , m_impl(impl)
85 {
86     ASSERT(inherits(&s_info));
87 }
88 
createPrototype(ExecState * exec,JSGlobalObject * globalObject)89 JSObject* JSPerformance::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
90 {
91     return new (exec) JSPerformancePrototype(exec->globalData(), globalObject, JSPerformancePrototype::createStructure(globalObject->globalData(), globalObject->objectPrototype()));
92 }
93 
getOwnPropertySlot(ExecState * exec,const Identifier & propertyName,PropertySlot & slot)94 bool JSPerformance::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
95 {
96     return getStaticValueSlot<JSPerformance, Base>(exec, &JSPerformanceTable, this, propertyName, slot);
97 }
98 
getOwnPropertyDescriptor(ExecState * exec,const Identifier & propertyName,PropertyDescriptor & descriptor)99 bool JSPerformance::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
100 {
101     return getStaticValueDescriptor<JSPerformance, Base>(exec, &JSPerformanceTable, this, propertyName, descriptor);
102 }
103 
jsPerformanceNavigation(ExecState * exec,JSValue slotBase,const Identifier &)104 JSValue jsPerformanceNavigation(ExecState* exec, JSValue slotBase, const Identifier&)
105 {
106     JSPerformance* castedThis = static_cast<JSPerformance*>(asObject(slotBase));
107     UNUSED_PARAM(exec);
108     Performance* imp = static_cast<Performance*>(castedThis->impl());
109     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->navigation()));
110     return result;
111 }
112 
113 
jsPerformanceTiming(ExecState * exec,JSValue slotBase,const Identifier &)114 JSValue jsPerformanceTiming(ExecState* exec, JSValue slotBase, const Identifier&)
115 {
116     JSPerformance* castedThis = static_cast<JSPerformance*>(asObject(slotBase));
117     UNUSED_PARAM(exec);
118     Performance* imp = static_cast<Performance*>(castedThis->impl());
119     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->timing()));
120     return result;
121 }
122 
123 
jsPerformanceMemory(ExecState * exec,JSValue slotBase,const Identifier &)124 JSValue jsPerformanceMemory(ExecState* exec, JSValue slotBase, const Identifier&)
125 {
126     JSPerformance* castedThis = static_cast<JSPerformance*>(asObject(slotBase));
127     UNUSED_PARAM(exec);
128     Performance* imp = static_cast<Performance*>(castedThis->impl());
129     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->memory()));
130     return result;
131 }
132 
133 
toJS(JSC::ExecState * exec,JSDOMGlobalObject * globalObject,Performance * impl)134 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Performance* impl)
135 {
136     return wrap<JSPerformance>(exec, globalObject, impl);
137 }
138 
toPerformance(JSC::JSValue value)139 Performance* toPerformance(JSC::JSValue value)
140 {
141     return value.inherits(&JSPerformance::s_info) ? static_cast<JSPerformance*>(asObject(value))->impl() : 0;
142 }
143 
144 }
145 
146 #endif // ENABLE(WEB_TIMING)
147