#ifndef JSTestObj_h
#define JSTestObj_h
#include "JSDOMWrapper.h"
#include "TestObj.h"
namespace WebCore {
class JSTestObj : public JSDOMWrapper {
public:
typedef JSDOMWrapper Base;
static JSTestObj* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<TestObj> impl)
{
JSTestObj* ptr = new (NotNull, JSC::allocateCell<JSTestObj>(globalObject->vm().heap)) JSTestObj(structure, globalObject, impl);
ptr->finishCreation(globalObject->vm());
return ptr;
}
static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
static JSC::JSObject* getPrototype(JSC::VM&, JSC::JSGlobalObject*);
static bool getOwnPropertySlot(JSC::JSObject*, JSC::ExecState*, JSC::PropertyName, JSC::PropertySlot&);
static void destroy(JSC::JSCell*);
~JSTestObj();
DECLARE_INFO;
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
{
return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
static JSC::JSValue getConstructor(JSC::VM&, JSC::JSGlobalObject*);
JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute1;
JSC::WriteBarrier<JSC::Unknown> m_cachedAttribute2;
static void visitChildren(JSCell*, JSC::SlotVisitor&);
JSC::JSValue customAttr(JSC::ExecState*) const;
void setCustomAttr(JSC::ExecState*, JSC::JSValue);
JSC::JSValue customMethod(JSC::ExecState*);
JSC::JSValue customMethodWithArgs(JSC::ExecState*);
static JSC::JSValue classMethod2(JSC::ExecState*);
TestObj& impl() const { return *m_impl; }
void releaseImpl() { m_impl->deref(); m_impl = 0; }
void releaseImplIfNotNull()
{
if (m_impl) {
m_impl->deref();
m_impl = 0;
}
}
private:
TestObj* m_impl;
protected:
JSTestObj(JSC::Structure*, JSDOMGlobalObject*, PassRefPtr<TestObj>);
void finishCreation(JSC::VM& vm)
{
Base::finishCreation(vm);
ASSERT(inherits(info()));
}
static const unsigned StructureFlags = JSC::InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | JSC::OverridesGetOwnPropertySlot | JSC::OverridesVisitChildren | Base::StructureFlags;
};
class JSTestObjOwner : public JSC::WeakHandleOwner {
public:
virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
};
inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, TestObj*)
{
DEPRECATED_DEFINE_STATIC_LOCAL(JSTestObjOwner, jsTestObjOwner, ());
return &jsTestObjOwner;
}
inline void* wrapperContext(DOMWrapperWorld& world, TestObj*)
{
return &world;
}
JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, TestObj*);
TestObj* toTestObj(JSC::JSValue);
}
#endif