/*
    This file is part of the WebKit open source project.
    This file has been generated by generate-bindings.pl. DO NOT MODIFY!

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#include "config.h"

#if ENABLE(RESOURCE_TIMING)

#include "JSPerformanceResourceTiming.h"

#include "PerformanceResourceTiming.h"
#include "URL.h"
#include <runtime/JSString.h>
#include <wtf/GetPtr.h>

using namespace JSC;

namespace WebCore {

/* Hash table */

static const HashTableValue JSPerformanceResourceTimingTableValues[] =
{
    { "initiatorType", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingInitiatorType), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "redirectStart", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingRedirectStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "redirectEnd", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingRedirectEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "fetchStart", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingFetchStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "domainLookupStart", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingDomainLookupStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "domainLookupEnd", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingDomainLookupEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "connectStart", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingConnectStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "connectEnd", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingConnectEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "secureConnectionStart", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingSecureConnectionStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "requestStart", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingRequestStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "responseStart", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingResponseStart), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "responseEnd", DontDelete | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingResponseEnd), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { "constructor", DontEnum | ReadOnly, NoIntrinsic, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsPerformanceResourceTimingConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) },
    { 0, 0, NoIntrinsic, 0, 0 }
};

static const HashTable JSPerformanceResourceTimingTable = { 34, 31, true, JSPerformanceResourceTimingTableValues, 0 };
/* Hash table for constructor */

static const HashTableValue JSPerformanceResourceTimingConstructorTableValues[] =
{
    { 0, 0, NoIntrinsic, 0, 0 }
};

static const HashTable JSPerformanceResourceTimingConstructorTable = { 1, 0, false, JSPerformanceResourceTimingConstructorTableValues, 0 };
const ClassInfo JSPerformanceResourceTimingConstructor::s_info = { "PerformanceResourceTimingConstructor", &Base::s_info, &JSPerformanceResourceTimingConstructorTable, 0, CREATE_METHOD_TABLE(JSPerformanceResourceTimingConstructor) };

JSPerformanceResourceTimingConstructor::JSPerformanceResourceTimingConstructor(Structure* structure, JSDOMGlobalObject* globalObject)
    : DOMConstructorObject(structure, globalObject)
{
}

void JSPerformanceResourceTimingConstructor::finishCreation(VM& vm, JSDOMGlobalObject* globalObject)
{
    Base::finishCreation(vm);
    ASSERT(inherits(info()));
    putDirect(vm, vm.propertyNames->prototype, JSPerformanceResourceTimingPrototype::self(vm, globalObject), DontDelete | ReadOnly);
    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontDelete | DontEnum);
}

bool JSPerformanceResourceTimingConstructor::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    return getStaticValueSlot<JSPerformanceResourceTimingConstructor, JSDOMWrapper>(exec, JSPerformanceResourceTimingConstructorTable, jsCast<JSPerformanceResourceTimingConstructor*>(object), propertyName, slot);
}

/* Hash table for prototype */

static const HashTableValue JSPerformanceResourceTimingPrototypeTableValues[] =
{
    { 0, 0, NoIntrinsic, 0, 0 }
};

static const HashTable JSPerformanceResourceTimingPrototypeTable = { 1, 0, false, JSPerformanceResourceTimingPrototypeTableValues, 0 };
const ClassInfo JSPerformanceResourceTimingPrototype::s_info = { "PerformanceResourceTimingPrototype", &Base::s_info, &JSPerformanceResourceTimingPrototypeTable, 0, CREATE_METHOD_TABLE(JSPerformanceResourceTimingPrototype) };

JSObject* JSPerformanceResourceTimingPrototype::self(VM& vm, JSGlobalObject* globalObject)
{
    return getDOMPrototype<JSPerformanceResourceTiming>(vm, globalObject);
}

const ClassInfo JSPerformanceResourceTiming::s_info = { "PerformanceResourceTiming", &Base::s_info, &JSPerformanceResourceTimingTable, 0 , CREATE_METHOD_TABLE(JSPerformanceResourceTiming) };

JSPerformanceResourceTiming::JSPerformanceResourceTiming(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<PerformanceResourceTiming> impl)
    : JSPerformanceEntry(structure, globalObject, impl)
{
}

void JSPerformanceResourceTiming::finishCreation(VM& vm)
{
    Base::finishCreation(vm);
    ASSERT(inherits(info()));
}

JSObject* JSPerformanceResourceTiming::createPrototype(VM& vm, JSGlobalObject* globalObject)
{
    return JSPerformanceResourceTimingPrototype::create(vm, globalObject, JSPerformanceResourceTimingPrototype::createStructure(vm, globalObject, JSPerformanceEntryPrototype::self(vm, globalObject)));
}

bool JSPerformanceResourceTiming::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
    JSPerformanceResourceTiming* thisObject = jsCast<JSPerformanceResourceTiming*>(object);
    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
    return getStaticValueSlot<JSPerformanceResourceTiming, Base>(exec, JSPerformanceResourceTimingTable, thisObject, propertyName, slot);
}

EncodedJSValue jsPerformanceResourceTimingInitiatorType(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSPerformanceResourceTiming* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    PerformanceResourceTiming& impl = castedThis->impl();
    JSValue result = jsStringWithCache(exec, impl.initiatorType());
    return JSValue::encode(result);
}


EncodedJSValue jsPerformanceResourceTimingRedirectStart(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSPerformanceResourceTiming* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    PerformanceResourceTiming& impl = castedThis->impl();
    JSValue result = jsNumber(impl.redirectStart());
    return JSValue::encode(result);
}


EncodedJSValue jsPerformanceResourceTimingRedirectEnd(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSPerformanceResourceTiming* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    PerformanceResourceTiming& impl = castedThis->impl();
    JSValue result = jsNumber(impl.redirectEnd());
    return JSValue::encode(result);
}


EncodedJSValue jsPerformanceResourceTimingFetchStart(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSPerformanceResourceTiming* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    PerformanceResourceTiming& impl = castedThis->impl();
    JSValue result = jsNumber(impl.fetchStart());
    return JSValue::encode(result);
}


EncodedJSValue jsPerformanceResourceTimingDomainLookupStart(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSPerformanceResourceTiming* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    PerformanceResourceTiming& impl = castedThis->impl();
    JSValue result = jsNumber(impl.domainLookupStart());
    return JSValue::encode(result);
}


EncodedJSValue jsPerformanceResourceTimingDomainLookupEnd(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSPerformanceResourceTiming* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    PerformanceResourceTiming& impl = castedThis->impl();
    JSValue result = jsNumber(impl.domainLookupEnd());
    return JSValue::encode(result);
}


EncodedJSValue jsPerformanceResourceTimingConnectStart(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSPerformanceResourceTiming* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    PerformanceResourceTiming& impl = castedThis->impl();
    JSValue result = jsNumber(impl.connectStart());
    return JSValue::encode(result);
}


EncodedJSValue jsPerformanceResourceTimingConnectEnd(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSPerformanceResourceTiming* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    PerformanceResourceTiming& impl = castedThis->impl();
    JSValue result = jsNumber(impl.connectEnd());
    return JSValue::encode(result);
}


EncodedJSValue jsPerformanceResourceTimingSecureConnectionStart(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSPerformanceResourceTiming* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    PerformanceResourceTiming& impl = castedThis->impl();
    JSValue result = jsNumber(impl.secureConnectionStart());
    return JSValue::encode(result);
}


EncodedJSValue jsPerformanceResourceTimingRequestStart(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSPerformanceResourceTiming* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    PerformanceResourceTiming& impl = castedThis->impl();
    JSValue result = jsNumber(impl.requestStart());
    return JSValue::encode(result);
}


EncodedJSValue jsPerformanceResourceTimingResponseStart(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSPerformanceResourceTiming* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    PerformanceResourceTiming& impl = castedThis->impl();
    JSValue result = jsNumber(impl.responseStart());
    return JSValue::encode(result);
}


EncodedJSValue jsPerformanceResourceTimingResponseEnd(ExecState* exec, EncodedJSValue slotBase, EncodedJSValue thisValue, PropertyName)
{
    JSPerformanceResourceTiming* castedThis = jsDynamicCast<JSPerformanceResourceTiming*>(JSValue::decode(thisValue));
    UNUSED_PARAM(slotBase);
    if (!castedThis)
        return throwVMTypeError(exec);
    UNUSED_PARAM(exec);
    PerformanceResourceTiming& impl = castedThis->impl();
    JSValue result = jsNumber(impl.responseEnd());
    return JSValue::encode(result);
}


EncodedJSValue jsPerformanceResourceTimingConstructor(ExecState* exec, EncodedJSValue thisValue, EncodedJSValue, PropertyName)
{
    JSPerformanceResourceTiming* domObject = jsDynamicCast<JSPerformanceResourceTiming*>(JSValue::decode(thisValue));
    if (!domObject)
        return throwVMTypeError(exec);
    if (!domObject)
        return throwVMTypeError(exec);
    return JSValue::encode(JSPerformanceResourceTiming::getConstructor(exec->vm(), domObject->globalObject()));
}

JSValue JSPerformanceResourceTiming::getConstructor(VM& vm, JSGlobalObject* globalObject)
{
    return getDOMConstructor<JSPerformanceResourceTimingConstructor>(vm, jsCast<JSDOMGlobalObject*>(globalObject));
}


}

#endif // ENABLE(RESOURCE_TIMING)
