JSValue toJS(ExecState*, WorkerContext* workerContext) { if (!workerContext) return jsNull(); WorkerScriptController* script = workerContext->script(); if (!script) return jsNull(); JSWorkerContext* contextWrapper = script->workerContextWrapper(); ASSERT(contextWrapper); return contextWrapper; }
void ScheduledAction::execute(WorkerContext* workerContext) { // In a Worker, the execution should always happen on a worker thread. ASSERT(workerContext->thread()->threadID() == currentThread()); WorkerScriptController* scriptController = workerContext->script(); if (m_function) { JSWorkerContext* contextWrapper = scriptController->workerContextWrapper(); executeFunctionInContext(contextWrapper, contextWrapper, workerContext); } else { ScriptSourceCode code(m_code, workerContext->url()); scriptController->evaluate(code); } }