Source/modules/websockets/WorkerThreadableWebSocketChannel.cpp
// Caller of this function should hold a reference to the bridge, because this function may call WebSocket::didClose() in the end,
// which causes the bridge to get disconnected from the WebSocket and deleted if there is no other reference.
Caller of this function should hold a reference to the bridge, because this function may call WebSocket::didClose() in the end,
which causes the bridge to get disconnected from the WebSocket and deleted if there is no other reference.
Caller of this function should hold a reference to the bridge because this function may call WebSocket :: didClose () in the end which causes the bridge to get disconnected from the WebSocket and deleted if there is no other reference .
bool WorkerThreadableWebSocketChannel::Bridge::waitForMethodCompletion(PassOwnPtr<ExecutionContextTask> task)
{
    ASSERT(m_workerGlobalScope);
    ASSERT(m_syncHelper);
    m_loaderProxy.postTaskToLoader(task);
    Vector<blink::WebWaitableEvent*> events;
    events.append(m_syncHelper->event());
    ThreadState::SafePointScope scope(ThreadState::HeapPointersOnStack);
    blink::Platform::current()->waitMultipleEvents(events);
    return !m_workerGlobalScope->thread()->runLoop().terminated();
}
bool WorkerThreadableWebSocketChannel :: Bridge :: waitForMethodCompletion ( PassOwnPtr < ExecutionContextTask > task ) { ASSERT ( m_workerGlobalScope ) ; ASSERT ( m_syncHelper ) ; m_loaderProxy . postTaskToLoader ( task ) ; Vector < blink :: WebWaitableEvent * > events ; events . append ( m_syncHelper -> event ( ) ) ; ThreadState :: SafePointScope scope ( ThreadState :: HeapPointersOnStack ) ; blink :: Platform :: current ( ) -> waitMultipleEvents ( events ) ; return ! m_workerGlobalScope -> thread ( ) -> runLoop ( ) . terminated ( ) ; }
Caller of this function should hold a reference to the bridge, because this function may call WebSocket::didClose() in the end,
which causes the bridge to get disconnected from the WebSocket and deleted if there is no other reference.
Caller of this function should hold a reference to the bridge because this function may call WebSocket :: didClose () in the end which causes the bridge to get disconnected from the WebSocket and deleted if there is no other reference .
// We wait for the syncHelper event even if a shutdown event is fired. // See https://codereview.chromium.org/267323004/#msg43 for why we need to wait this. // This is checking whether a shutdown event is fired or not.