void WebSharedWorkerImpl::connectTask(PassOwnPtr<WebMessagePortChannel> channel, ExecutionContext* context) { // Wrap the passed-in channel in a MessagePort, and send it off via a connect event. MessagePort* port = MessagePort::create(*context); port->entangle(channel); WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); ASSERT_WITH_SECURITY_IMPLICATION(workerGlobalScope->isSharedWorkerGlobalScope()); workerGlobalScope->dispatchEvent(createConnectEvent(port)); }
void WebSharedWorkerImpl::connectTask(WebMessagePortChannelUniquePtr channel, ExecutionContext* context) { // Wrap the passed-in channel in a MessagePort, and send it off via a connect // event. MessagePort* port = MessagePort::create(*context); port->entangle(std::move(channel)); WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); SECURITY_DCHECK(workerGlobalScope->isSharedWorkerGlobalScope()); workerGlobalScope->dispatchEvent(createConnectEvent(port)); }
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)); }) { }