virtual void performTask(ScriptExecutionContext* scriptContext)
 {
     RefPtr<MessagePort> port = MessagePort::create(*scriptContext);
     port->entangle(m_channel.release());
     ASSERT_WITH_SECURITY_IMPLICATION(scriptContext->isWorkerGlobalScope());
     WorkerGlobalScope* workerGlobalScope = static_cast<WorkerGlobalScope*>(scriptContext);
     // Since close() stops the thread event loop, this should not ever get called while closing.
     ASSERT(!workerGlobalScope->isClosing());
     ASSERT_WITH_SECURITY_IMPLICATION(workerGlobalScope->isSharedWorkerGlobalScope());
     workerGlobalScope->dispatchEvent(createConnectEvent(port));
 }
 SharedWorkerConnectTask(MessagePortChannel* channel)
     : ScriptExecutionContext::Task([=] (ScriptExecutionContext& context) {
         RefPtr<MessagePort> port = MessagePort::create(context);
         port->entangle(std::unique_ptr<MessagePortChannel>(channel));
         ASSERT_WITH_SECURITY_IMPLICATION(context.isWorkerGlobalScope());
         WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(&context);
         // Since close() stops the thread event loop, this should not ever get called while closing.
         ASSERT(!workerGlobalScope->isClosing());
         ASSERT_WITH_SECURITY_IMPLICATION(workerGlobalScope->isSharedWorkerGlobalScope());
         workerGlobalScope->dispatchEvent(createConnectEvent(port));
     })
 {
 }
Exemplo n.º 3
0
void WorkerRunLoop::Task::performTask(const WorkerRunLoop& runLoop, ScriptExecutionContext* context)
{
    WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
    if ((!workerGlobalScope->isClosing() && !runLoop.terminated()) || m_task->isCleanupTask())
        m_task->performTask(context);
}