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

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

Issue 19801002: Drop [LegacyImplementedInBaseClass] attribute from WindowTimers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Attempt to make the try bots happy 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/core.gypi » ('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 64c095295c2745f3ec4eed602b2a28149152f93c..53ee451d9b0a5bb74fecba287bc4119bcbef9a4f 100644
--- a/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
+++ b/Source/bindings/v8/custom/V8WorkerGlobalScopeCustom.cpp
@@ -41,8 +41,10 @@
#include "core/inspector/ScriptCallStack.h"
#include "core/page/ContentSecurityPolicy.h"
#include "core/page/DOMTimer.h"
+#include "core/page/DOMWindowTimers.h"
#include "core/workers/WorkerGlobalScope.h"
#include "modules/websockets/WebSocket.h"
+#include "wtf/OwnArrayPtr.h"
namespace WebCore {
@@ -55,13 +57,12 @@ void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, bool
return;
v8::Handle<v8::Value> function = args[0];
- int32_t timeout = argumentCount >= 2 ? args[1]->Int32Value() : 0;
- int timerId;
WorkerScriptController* script = workerGlobalScope->script();
if (!script)
return;
+ OwnPtr<ScheduledAction> action;
v8::Handle<v8::Context> v8Context = script->context();
if (function->IsString()) {
if (ContentSecurityPolicy* policy = workerGlobalScope->contentSecurityPolicy()) {
@@ -70,24 +71,27 @@ void SetTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& args, bool
return;
}
}
- WTF::String stringFunction = toWebCoreString(function);
- timerId = DOMTimer::install(workerGlobalScope, adoptPtr(new ScheduledAction(v8Context, stringFunction, workerGlobalScope->url(), args.GetIsolate())), timeout, singleShot);
+ action = adoptPtr(new ScheduledAction(v8Context, toWebCoreString(function), workerGlobalScope->url(), args.GetIsolate()));
} else if (function->IsFunction()) {
size_t paramCount = argumentCount >= 2 ? argumentCount - 2 : 0;
- v8::Local<v8::Value>* params = 0;
+ OwnArrayPtr<v8::Local<v8::Value> > params;
if (paramCount > 0) {
- params = new v8::Local<v8::Value>[paramCount];
+ params = adoptArrayPtr(new v8::Local<v8::Value>[paramCount]);
for (size_t i = 0; i < paramCount; ++i)
params[i] = args[i+2];
}
// ScheduledAction takes ownership of actual params and releases them in its destructor.
- 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);
+ action = adoptPtr(new ScheduledAction(v8Context, v8::Handle<v8::Function>::Cast(function), paramCount, params.get(), args.GetIsolate()));
} else
return;
+ int32_t timeout = argumentCount >= 2 ? args[1]->Int32Value() : 0;
+ int timerId;
+ if (singleShot)
+ timerId = DOMWindowTimers::setTimeout(workerGlobalScope, action.release(), timeout);
+ else
+ timerId = DOMWindowTimers::setInterval(workerGlobalScope, action.release(), timeout);
+
v8SetReturnValue(args, timerId);
}
« no previous file with comments | « Source/bindings/v8/custom/V8WindowCustom.cpp ('k') | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698