#ifndef RUNTIME_ARRAY_H_
#define RUNTIME_ARRAY_H_
#include "BridgeJSC.h"
#include "JSDOMBinding.h"
#include <runtime/ArrayPrototype.h>
namespace JSC {
class RuntimeArray : public JSArray {
public:
typedef JSArray Base;
static RuntimeArray* create(ExecState* exec, Bindings::Array* array)
{
Structure* domStructure = WebCore::deprecatedGetDOMStructure<RuntimeArray>(exec);
RuntimeArray* runtimeArray = new (NotNull, allocateCell<RuntimeArray>(*exec->heap())) RuntimeArray(exec, domStructure);
runtimeArray->finishCreation(exec->globalData(), array);
return runtimeArray;
}
typedef Bindings::Array BindingsArray;
~RuntimeArray();
static void destroy(JSCell*);
static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
static bool getOwnPropertySlot(JSCell*, ExecState*, const Identifier&, PropertySlot&);
static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned, PropertySlot&);
static bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&);
static void put(JSCell*, ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&);
static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
static bool deleteProperty(JSCell*, ExecState*, const Identifier &propertyName);
static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName);
unsigned getLength() const { return m_array->getLength(); }
Bindings::Array* getConcreteArray() const { return m_array; }
static const ClassInfo s_info;
static ArrayPrototype* createPrototype(ExecState*, JSGlobalObject* globalObject)
{
return globalObject->arrayPrototype();
}
static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
}
protected:
void finishCreation(JSGlobalData&, Bindings::Array*);
static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesGetPropertyNames | JSArray::StructureFlags;
private:
RuntimeArray(ExecState*, Structure*);
static JSValue lengthGetter(ExecState*, JSValue, const Identifier&);
static JSValue indexGetter(ExecState*, JSValue, unsigned);
BindingsArray* m_array;
};
}
#endif // RUNTIME_ARRAY_H_