예제 #1
0
void ScheduledAction::execute(WorkerGlobalScope* worker)
{
    ASSERT(worker->thread()->isCurrentThread());
    ASSERT(m_scriptState->contextIsValid());
    if (!m_function.isEmpty()) {
        ScriptState::Scope scope(m_scriptState.get());
        Vector<v8::Handle<v8::Value> > info;
        createLocalHandlesForArgs(&info);
        V8ScriptRunner::callFunction(m_function.newLocal(m_scriptState->isolate()), worker, m_scriptState->context()->Global(), info.size(), info.data(), m_scriptState->isolate());
    } else {
        worker->script()->evaluate(m_code);
    }
}
예제 #2
0
void ScheduledAction::execute(LocalFrame* frame)
{
    if (m_scriptState->contextIsEmpty())
        return;

    TRACE_EVENT0("v8", "ScheduledAction::execute");
    ScriptState::Scope scope(m_scriptState.get());
    if (!m_function.isEmpty()) {
        Vector<v8::Handle<v8::Value> > info;
        createLocalHandlesForArgs(&info);
        frame->script().callFunction(m_function.newLocal(m_scriptState->isolate()), m_scriptState->context()->Global(), info.size(), info.data());
    } else {
        frame->script().executeScriptAndReturnValue(m_scriptState->context(), ScriptSourceCode(m_code));
    }

    // The frame might be invalid at this point because JavaScript could have released it.
}