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

Unified Diff: Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp

Issue 19494002: Distinguish actions registered with setTimeout() and setInterval(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix test, and add a new test. Created 7 years, 5 months 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
Index: Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
diff --git a/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp b/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
index 64c095295c2745f3ec4eed602b2a28149152f93c..9da10ac5cce85409c66c9ca501c256302af929ec 100644
--- a/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
+++ b/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
@@ -46,7 +46,7 @@
namespace WebCore {
-void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, bool singleShot)
+void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, DOMTimer::TimerType timerType)
{
WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(args.Holder());
@@ -71,7 +71,7 @@ void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, bool
}
}
WTF::String stringFunction = toWebCoreString(function);
- timerId = DOMTimer::install(workerGlobalScope, adoptPtr(new ScheduledAction(v8Context, stringFunction, workerGlobalScope->url(), args.GetIsolate())), timeout, singleShot);
+ timerId = DOMTimer::install(workerGlobalScope, timerType, adoptPtr(new ScheduledAction(v8Context, stringFunction, workerGlobalScope->url(), args.GetIsolate())), timeout);
} else if (function->IsFunction()) {
size_t paramCount = argumentCount >= 2 ? argumentCount - 2 : 0;
v8::Local<v8::Value>* params = 0;
@@ -84,7 +84,7 @@ void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, bool
OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(v8Context, v8::Handle<v8::Function>::Cast(function), paramCount, params, args.GetIsolate()));
// FIXME: We should use a OwnArrayPtr for params.
delete [] params;
- timerId = DOMTimer::install(workerGlobalScope, action.release(), timeout, singleShot);
+ timerId = DOMTimer::install(workerGlobalScope, timerType, action.release(), timeout);
} else
return;
@@ -116,12 +116,12 @@ void V8WorkerGlobalScope::importScriptsMethodCustom(const v8::FunctionCallbackIn
void V8WorkerGlobalScope::setTimeoutMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
- return SetTimeoutOrInterval(args, true);
+ return SetTimeoutOrInterval(args, DOMTimer::TimerTypeTimeout);
}
void V8WorkerGlobalScope::setIntervalMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
- return SetTimeoutOrInterval(args, false);
+ return SetTimeoutOrInterval(args, DOMTimer::TimerTypeInterval);
}
v8::Handle<v8::Value> toV8(WorkerGlobalScope* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)

Powered by Google App Engine
This is Rietveld 408576698