2 * Copyright (C) 2000 Harri Porten (porten@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reseved.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef ScheduledAction_h
21 #define ScheduledAction_h
23 #include "JSDOMBinding.h"
24 #include "PlatformString.h"
25 #include <heap/Strong.h>
26 #include <runtime/JSCell.h>
27 #include <wtf/PassOwnPtr.h>
28 #include <wtf/Vector.h>
37 class ContentSecurityPolicy;
38 class ScriptExecutionContext;
41 /* An action (either function or string) to be executed after a specified
42 * time interval, either once or repeatedly. Used for window.setTimeout()
43 * and window.setInterval()
45 class ScheduledAction {
46 WTF_MAKE_NONCOPYABLE(ScheduledAction); WTF_MAKE_FAST_ALLOCATED;
48 static PassOwnPtr<ScheduledAction> create(JSC::ExecState*, DOMWrapperWorld* isolatedWorld, ContentSecurityPolicy*);
50 void execute(ScriptExecutionContext*);
53 ScheduledAction(JSC::ExecState*, JSC::JSValue function, DOMWrapperWorld* isolatedWorld);
54 ScheduledAction(const String& code, DOMWrapperWorld* isolatedWorld)
55 : m_function(*isolatedWorld->globalData())
57 , m_isolatedWorld(isolatedWorld)
61 void executeFunctionInContext(JSC::JSGlobalObject*, JSC::JSValue thisValue, ScriptExecutionContext*);
62 void execute(Document*);
64 void execute(WorkerContext*);
67 JSC::Strong<JSC::Unknown> m_function;
68 Vector<JSC::Strong<JSC::Unknown> > m_args;
70 RefPtr<DOMWrapperWorld> m_isolatedWorld;
73 } // namespace WebCore
75 #endif // ScheduledAction_h