#ifndef KJS_RUNTIME_OBJECT_H
#define KJS_RUNTIME_OBJECT_H
#include "BridgeJSC.h"
#include <runtime/JSGlobalObject.h>
#include <runtime/JSObjectWithGlobalObject.h>
namespace JSC {
namespace Bindings {
class RuntimeObject : public JSObjectWithGlobalObject {
public:
static RuntimeObject* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, PassRefPtr<Instance> instance)
{
return new (allocateCell<RuntimeObject>(*exec->heap())) RuntimeObject(exec, globalObject, structure, instance);
}
virtual ~RuntimeObject();
virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier& propertyName, PropertyDescriptor&);
virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const;
virtual CallType getCallData(CallData&);
virtual ConstructType getConstructData(ConstructData&);
virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
void invalidate();
Instance* getInternalInstance() const { return m_instance.get(); }
static JSObject* throwInvalidAccessError(ExecState*);
static const ClassInfo s_info;
static ObjectPrototype* createPrototype(ExecState*, JSGlobalObject* globalObject)
{
return globalObject->objectPrototype();
}
static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
{
return Structure::create(globalData, prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
}
protected:
RuntimeObject(ExecState*, JSGlobalObject*, Structure*, PassRefPtr<Instance>);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSObjectWithGlobalObject::StructureFlags;
private:
static JSValue fallbackObjectGetter(ExecState*, JSValue, const Identifier&);
static JSValue fieldGetter(ExecState*, JSValue, const Identifier&);
static JSValue methodGetter(ExecState*, JSValue, const Identifier&);
RefPtr<Instance> m_instance;
};
}
}
#endif