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

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: Rebase again. 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
« no previous file with comments | « Source/bindings/v8/custom/V8WindowCustom.cpp ('k') | Source/core/dom/ScriptExecutionContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
diff --git a/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp b/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
index 53ee451d9b0a5bb74fecba287bc4119bcbef9a4f..11cadb38731fad9ff8fbbbc8c88b053363d88f3f 100644
--- a/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
+++ b/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
@@ -48,7 +48,7 @@
namespace WebCore {
-void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, bool singleShot)
+void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, DOMTimer::Type timerType)
{
WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toNative(args.Holder());
@@ -87,10 +87,14 @@ void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, bool
int32_t timeout = argumentCount >= 2 ? args[1]->Int32Value() : 0;
int timerId;
- if (singleShot)
+ switch (timerType) {
+ case DOMTimer::TimeoutType:
timerId = DOMWindowTimers::setTimeout(workerGlobalScope, action.release(), timeout);
- else
+ break;
+ case DOMTimer::IntervalType:
timerId = DOMWindowTimers::setInterval(workerGlobalScope, action.release(), timeout);
+ break;
+ }
v8SetReturnValue(args, timerId);
}
@@ -120,12 +124,12 @@ void V8WorkerGlobalScope::importScriptsMethodCustom(const v8::FunctionCallbackIn
void V8WorkerGlobalScope::setTimeoutMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
- return SetTimeoutOrInterval(args, true);
+ return SetTimeoutOrInterval(args, DOMTimer::TimeoutType);
}
void V8WorkerGlobalScope::setIntervalMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
- return SetTimeoutOrInterval(args, false);
+ return SetTimeoutOrInterval(args, DOMTimer::IntervalType);
}
v8::Handle<v8::Value> toV8(WorkerGlobalScope* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
« no previous file with comments | « Source/bindings/v8/custom/V8WindowCustom.cpp ('k') | Source/core/dom/ScriptExecutionContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698