tizen beta release
[framework/web/webkit-efl.git] / DerivedSources / WebCore / JSVoidCallback.cpp
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 "JSVoidCallback.h"
23
24 #include "ExceptionCode.h"
25 #include "JSDOMBinding.h"
26 #include "VoidCallback.h"
27 #include <runtime/Error.h>
28 #include <wtf/GetPtr.h>
29
30 using namespace JSC;
31
32 namespace WebCore {
33
34 ASSERT_CLASS_FITS_IN_CELL(JSVoidCallback);
35
36 /* Hash table for prototype */
37 #if ENABLE(JIT)
38 #define THUNK_GENERATOR(generator) , generator
39 #else
40 #define THUNK_GENERATOR(generator)
41 #endif
42 #if ENABLE(DFG_JIT)
43 #define INTRINSIC(intrinsic) , intrinsic
44 #else
45 #define INTRINSIC(intrinsic)
46 #endif
47
48 static const HashTableValue JSVoidCallbackPrototypeTableValues[] =
49 {
50     { "handleEvent", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsVoidCallbackPrototypeFunctionHandleEvent), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
51     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
52 };
53
54 #undef THUNK_GENERATOR
55 static const HashTable JSVoidCallbackPrototypeTable = { 2, 1, JSVoidCallbackPrototypeTableValues, 0 };
56 const ClassInfo JSVoidCallbackPrototype::s_info = { "VoidCallbackPrototype", &JSC::JSNonFinalObject::s_info, &JSVoidCallbackPrototypeTable, 0, CREATE_METHOD_TABLE(JSVoidCallbackPrototype) };
57
58 JSObject* JSVoidCallbackPrototype::self(ExecState* exec, JSGlobalObject* globalObject)
59 {
60     return getDOMPrototype<JSVoidCallback>(exec, globalObject);
61 }
62
63 bool JSVoidCallbackPrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
64 {
65     JSVoidCallbackPrototype* thisObject = jsCast<JSVoidCallbackPrototype*>(cell);
66     return getStaticFunctionSlot<JSObject>(exec, &JSVoidCallbackPrototypeTable, thisObject, propertyName, slot);
67 }
68
69 bool JSVoidCallbackPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
70 {
71     JSVoidCallbackPrototype* thisObject = jsCast<JSVoidCallbackPrototype*>(object);
72     return getStaticFunctionDescriptor<JSObject>(exec, &JSVoidCallbackPrototypeTable, thisObject, propertyName, descriptor);
73 }
74
75 const ClassInfo JSVoidCallback::s_info = { "VoidCallback", &JSDOMWrapper::s_info, 0, 0 , CREATE_METHOD_TABLE(JSVoidCallback) };
76
77 JSVoidCallback::JSVoidCallback(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<VoidCallback> impl)
78     : JSDOMWrapper(structure, globalObject)
79     , m_impl(impl.leakRef())
80 {
81 }
82
83 void JSVoidCallback::finishCreation(JSGlobalData& globalData)
84 {
85     Base::finishCreation(globalData);
86     ASSERT(inherits(&s_info));
87 }
88
89 JSObject* JSVoidCallback::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
90 {
91     return JSVoidCallbackPrototype::create(exec->globalData(), globalObject, JSVoidCallbackPrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
92 }
93
94 EncodedJSValue JSC_HOST_CALL jsVoidCallbackPrototypeFunctionHandleEvent(ExecState* exec)
95 {
96     JSValue thisValue = exec->hostThisValue();
97     if (!thisValue.inherits(&JSVoidCallback::s_info))
98         return throwVMTypeError(exec);
99     JSVoidCallback* castedThis = static_cast<JSVoidCallback*>(asObject(thisValue));
100     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSVoidCallback::s_info);
101     VoidCallback* imp = static_cast<VoidCallback*>(castedThis->impl());
102     imp->handleEvent();
103     return JSValue::encode(jsUndefined());
104 }
105
106 static inline bool isObservable(JSVoidCallback* jsVoidCallback)
107 {
108     if (jsVoidCallback->hasCustomProperties())
109         return true;
110     return false;
111 }
112
113 bool JSVoidCallbackOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
114 {
115     JSVoidCallback* jsVoidCallback = static_cast<JSVoidCallback*>(handle.get().asCell());
116     if (!isObservable(jsVoidCallback))
117         return false;
118     UNUSED_PARAM(visitor);
119     return false;
120 }
121
122 void JSVoidCallbackOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
123 {
124     JSVoidCallback* jsVoidCallback = static_cast<JSVoidCallback*>(handle.get().asCell());
125     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
126     uncacheWrapper(world, jsVoidCallback->impl(), jsVoidCallback);
127     jsVoidCallback->releaseImpl();
128 }
129
130 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, VoidCallback* impl)
131 {
132     return wrap<JSVoidCallback>(exec, globalObject, impl);
133 }
134
135
136 }