#ifndef ScheduledAction_h
#define ScheduledAction_h
#include "JSDOMBinding.h"
#include "PlatformString.h"
#include <heap/Strong.h>
#include <heap/StrongInlines.h>
#include <runtime/JSCell.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
namespace JSC {
class JSGlobalObject;
}
namespace WebCore {
class Document;
class ContentSecurityPolicy;
class ScriptExecutionContext;
class WorkerContext;
class ScheduledAction {
WTF_MAKE_NONCOPYABLE(ScheduledAction); WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<ScheduledAction> create(JSC::ExecState*, DOMWrapperWorld* isolatedWorld, ContentSecurityPolicy*);
void execute(ScriptExecutionContext*);
private:
ScheduledAction(JSC::ExecState*, JSC::JSValue function, DOMWrapperWorld* isolatedWorld);
ScheduledAction(const String& code, DOMWrapperWorld* isolatedWorld)
: m_function(*isolatedWorld->globalData())
, m_code(code)
, m_isolatedWorld(isolatedWorld)
{
}
void executeFunctionInContext(JSC::JSGlobalObject*, JSC::JSValue thisValue, ScriptExecutionContext*);
void execute(Document*);
#if ENABLE(WORKERS)
void execute(WorkerContext*);
#endif
JSC::Strong<JSC::Unknown> m_function;
Vector<JSC::Strong<JSC::Unknown> > m_args;
String m_code;
RefPtr<DOMWrapperWorld> m_isolatedWorld;
};
}
#endif // ScheduledAction_h