Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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);
    }
}