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

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

Issue 19494002: Distinguish actions registered with setTimeout() and setInterval(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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/V8WindowCustom.cpp
diff --git a/Source/bindings/v8/custom/V8WindowCustom.cpp b/Source/bindings/v8/custom/V8WindowCustom.cpp
index ae23d16b3a7f202387c096a7eb0a32a0f02feeda..3e9738f352f440da317c54a7263bf3cb99a84967 100644
--- a/Source/bindings/v8/custom/V8WindowCustom.cpp
+++ b/Source/bindings/v8/custom/V8WindowCustom.cpp
@@ -69,7 +69,7 @@
namespace WebCore {
-void WindowSetTimeoutImpl(const v8::FunctionCallbackInfo<v8::Value>& args, bool singleShot)
+void WindowSetTimeoutImpl(const v8::FunctionCallbackInfo<v8::Value>& args, DOMTimer::TimerType timerType)
{
int argumentCount = args.Length();
@@ -112,6 +112,8 @@ void WindowSetTimeoutImpl(const v8::FunctionCallbackInfo<v8::Value>& args, bool
if (!BindingSecurity::shouldAllowAccessToFrame(imp->frame()))
return;
+ ASSERT(imp->frame());
+
int id;
if (function->IsFunction()) {
int paramCount = argumentCount >= 2 ? argumentCount - 2 : 0;
@@ -125,20 +127,18 @@ void WindowSetTimeoutImpl(const v8::FunctionCallbackInfo<v8::Value>& args, bool
}
// params is passed to action, and released in action's destructor
- ASSERT(imp->frame());
OwnPtr<ScheduledAction> action = adoptPtr(new ScheduledAction(imp->frame()->script()->currentWorldContext(), v8::Handle<v8::Function>::Cast(function), paramCount, params, args.GetIsolate()));
// FIXME: We should use OwnArrayPtr for params.
delete[] params;
- id = DOMTimer::install(scriptContext, action.release(), timeout, singleShot);
+ id = DOMTimer::install(scriptContext, timerType, action.release(), timeout);
} else {
if (imp->document() && !imp->document()->contentSecurityPolicy()->allowEval()) {
v8SetReturnValue(args, 0);
return;
}
- ASSERT(imp->frame());
- id = DOMTimer::install(scriptContext, adoptPtr(new ScheduledAction(imp->frame()->script()->currentWorldContext(), functionString, KURL(), args.GetIsolate())), timeout, singleShot);
+ id = DOMTimer::install(scriptContext, timerType, adoptPtr(new ScheduledAction(imp->frame()->script()->currentWorldContext(), functionString, KURL(), args.GetIsolate())), timeout);
}
// Try to do the idle notification before the timeout expires to get better
@@ -419,13 +419,13 @@ void V8Window::namedPropertyGetterCustom(v8::Local<v8::String> name, const v8::P
void V8Window::setTimeoutMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
- WindowSetTimeoutImpl(args, true);
+ WindowSetTimeoutImpl(args, DOMTimer::TimerTypeTimeout);
}
void V8Window::setIntervalMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& args)
{
- WindowSetTimeoutImpl(args, false);
+ WindowSetTimeoutImpl(args, DOMTimer::TimerTypeInterval);
}
bool V8Window::namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>)

Powered by Google App Engine
This is Rietveld 408576698