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

Unified Diff: Source/bindings/core/v8/custom/V8WorkerGlobalScopeCustom.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/custom/V8WindowCustom.cpp ('k') | Source/core/frame/DOMWindowTimers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/custom/V8WorkerGlobalScopeCustom.cpp
diff --git a/Source/bindings/core/v8/custom/V8WorkerGlobalScopeCustom.cpp b/Source/bindings/core/v8/custom/V8WorkerGlobalScopeCustom.cpp
index 2fff589d233bc064c8d2bbfa1e9457fc2c5c7c62..0ba182a027b15d1d6793c532f25cd84f4ee90fe5 100644
--- a/Source/bindings/core/v8/custom/V8WorkerGlobalScopeCustom.cpp
+++ b/Source/bindings/core/v8/custom/V8WorkerGlobalScopeCustom.cpp
@@ -45,65 +45,6 @@
namespace blink {
-static void setTimeoutOrInterval(const v8::FunctionCallbackInfo<v8::Value>& info, bool singleShot)
-{
- WorkerGlobalScope* workerGlobalScope = V8WorkerGlobalScope::toImpl(info.Holder());
- ASSERT(workerGlobalScope);
-
- int argumentCount = info.Length();
- if (argumentCount < 1)
- return;
-
- v8::Handle<v8::Value> function = info[0];
-
- WorkerScriptController* script = workerGlobalScope->script();
- if (!script)
- return;
-
- ScriptState* scriptState = ScriptState::current(info.GetIsolate());
- OwnPtr<ScheduledAction> action;
- if (function->IsString()) {
- if (ContentSecurityPolicy* policy = workerGlobalScope->contentSecurityPolicy()) {
- if (!policy->allowEval()) {
- v8SetReturnValue(info, 0);
- return;
- }
- }
- action = adoptPtr(new ScheduledAction(scriptState, toCoreString(function.As<v8::String>()), KURL(), info.GetIsolate()));
- } else if (function->IsFunction()) {
- size_t paramCount = argumentCount >= 2 ? argumentCount - 2 : 0;
- OwnPtr<v8::Local<v8::Value>[]> params;
- if (paramCount > 0) {
- params = adoptArrayPtr(new v8::Local<v8::Value>[paramCount]);
- for (size_t i = 0; i < paramCount; ++i)
- params[i] = info[i+2];
- }
- // ScheduledAction takes ownership of actual params and releases them in its destructor.
- action = adoptPtr(new ScheduledAction(scriptState, v8::Handle<v8::Function>::Cast(function), paramCount, params.get(), info.GetIsolate()));
- } else {
- return;
- }
-
- int32_t timeout = argumentCount >= 2 ? info[1]->Int32Value() : 0;
- int timerId;
- if (singleShot)
- timerId = DOMWindowTimers::setTimeout(*workerGlobalScope, action.release(), timeout);
- else
- timerId = DOMWindowTimers::setInterval(*workerGlobalScope, action.release(), timeout);
-
- v8SetReturnValue(info, timerId);
-}
-
-void V8WorkerGlobalScope::setTimeoutMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
-{
- return setTimeoutOrInterval(info, true);
-}
-
-void V8WorkerGlobalScope::setIntervalMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
-{
- return setTimeoutOrInterval(info, false);
-}
-
v8::Handle<v8::Value> toV8(WorkerGlobalScope* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{
// Notice that we explicitly ignore creationContext because the WorkerGlobalScope is its own creationContext.
« no previous file with comments | « Source/bindings/core/v8/custom/V8WindowCustom.cpp ('k') | Source/core/frame/DOMWindowTimers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698