Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: Source/bindings/core/v8/ScheduledAction.cpp

Issue 721033004: Implement WindowTimers.set{Timeout,Interval} without [Custom] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-overload-with-variadic
Patch Set: rebased Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/core/v8/ScheduledAction.h ('k') | Source/bindings/core/v8/custom/V8WindowCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/ScheduledAction.cpp
diff --git a/Source/bindings/core/v8/ScheduledAction.cpp b/Source/bindings/core/v8/ScheduledAction.cpp
index 6bf05b28483612ae10d66ee256af97b7912ee89d..2013751aa9286deb34960682bdf99ad499c19241 100644
--- a/Source/bindings/core/v8/ScheduledAction.cpp
+++ b/Source/bindings/core/v8/ScheduledAction.cpp
@@ -46,22 +46,15 @@
namespace blink {
-ScheduledAction::ScheduledAction(ScriptState* scriptState, v8::Handle<v8::Function> function, int argc, v8::Handle<v8::Value> argv[], v8::Isolate* isolate)
- : m_scriptState(scriptState)
- , m_function(isolate, function)
- , m_info(isolate)
- , m_code(String(), KURL(), TextPosition::belowRangePosition())
+PassOwnPtr<ScheduledAction> ScheduledAction::create(ScriptState* scriptState, const ScriptValue& handler, const Vector<ScriptValue>& arguments)
{
- m_info.ReserveCapacity(argc);
- for (int i = 0; i < argc; ++i)
- m_info.Append(argv[i]);
+ ASSERT(handler.isFunction());
+ return adoptPtr(new ScheduledAction(scriptState, handler, arguments));
}
-ScheduledAction::ScheduledAction(ScriptState* scriptState, const String& code, const KURL& url, v8::Isolate* isolate)
- : m_scriptState(scriptState)
- , m_info(isolate)
- , m_code(code, url)
+PassOwnPtr<ScheduledAction> ScheduledAction::create(ScriptState* scriptState, const String& handler)
{
+ return adoptPtr(new ScheduledAction(scriptState, handler));
}
ScheduledAction::~ScheduledAction()
@@ -87,6 +80,25 @@ void ScheduledAction::execute(ExecutionContext* context)
}
}
+ScheduledAction::ScheduledAction(ScriptState* scriptState, const ScriptValue& function, const Vector<ScriptValue>& arguments)
+ : m_scriptState(scriptState)
+ , m_info(scriptState->isolate())
+ , m_code(String(), KURL(), TextPosition::belowRangePosition())
+{
+ ASSERT(function.isFunction());
+ m_function.set(scriptState->isolate(), v8::Handle<v8::Function>::Cast(function.v8Value()));
+ m_info.ReserveCapacity(arguments.size());
+ for (const ScriptValue& argument : arguments)
+ m_info.Append(argument.v8Value());
+}
+
+ScheduledAction::ScheduledAction(ScriptState* scriptState, const String& code)
+ : m_scriptState(scriptState)
+ , m_info(scriptState->isolate())
+ , m_code(code, KURL())
+{
+}
+
void ScheduledAction::execute(LocalFrame* frame)
{
if (!m_scriptState->contextIsValid()) {
« no previous file with comments | « Source/bindings/core/v8/ScheduledAction.h ('k') | Source/bindings/core/v8/custom/V8WindowCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698