JSCallbackFunction.cpp [plain text]
#include "config.h"
#include "JSCallbackFunction.h"
#include "APICallbackFunction.h"
#include "APICast.h"
#include "CodeBlock.h"
#include "Error.h"
#include "ExceptionHelpers.h"
#include "FunctionPrototype.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "JSLock.h"
#include "JSCInlines.h"
#include <wtf/Vector.h>
namespace JSC {
STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(JSCallbackFunction);
const ClassInfo JSCallbackFunction::s_info = { "CallbackFunction", &InternalFunction::s_info, 0, 0, CREATE_METHOD_TABLE(JSCallbackFunction) };
JSCallbackFunction::JSCallbackFunction(VM& vm, Structure* structure, JSObjectCallAsFunctionCallback callback)
: InternalFunction(vm, structure)
, m_callback(callback)
{
}
void JSCallbackFunction::finishCreation(VM& vm, const String& name)
{
Base::finishCreation(vm, name);
ASSERT(inherits(info()));
}
JSCallbackFunction* JSCallbackFunction::create(VM& vm, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const String& name)
{
JSCallbackFunction* function = new (NotNull, allocateCell<JSCallbackFunction>(vm.heap)) JSCallbackFunction(vm, globalObject->callbackFunctionStructure(), callback);
function->finishCreation(vm, name);
return function;
}
CallType JSCallbackFunction::getCallData(JSCell*, CallData& callData)
{
callData.native.function = APICallbackFunction::call<JSCallbackFunction>;
return CallTypeHost;
}
}