| Index: third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp
|
| diff --git a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp
|
| index 4bcf08becbb71b9600024e3f42871149fbc8fff9..60d001f774e655ecd220ac6efd35ebef2632f301 100644
|
| --- a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp
|
| +++ b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp
|
| @@ -109,7 +109,6 @@ WorkerWebSocketChannel::WorkerWebSocketChannel(WorkerGlobalScope& workerGlobalSc
|
| : m_bridge(new Bridge(client, workerGlobalScope))
|
| , m_locationAtConnection(std::move(location))
|
| {
|
| - m_bridge->initialize(m_locationAtConnection->clone());
|
| }
|
|
|
| WorkerWebSocketChannel::~WorkerWebSocketChannel()
|
| @@ -120,7 +119,7 @@ WorkerWebSocketChannel::~WorkerWebSocketChannel()
|
| bool WorkerWebSocketChannel::connect(const KURL& url, const String& protocol)
|
| {
|
| ASSERT(m_bridge);
|
| - return m_bridge->connect(url, protocol);
|
| + return m_bridge->connect(m_locationAtConnection->clone(), url, protocol);
|
| }
|
|
|
| void WorkerWebSocketChannel::send(const CString& message)
|
| @@ -214,7 +213,6 @@ void Peer::connect(const KURL& url, const String& protocol)
|
| bool connectRequestResult = m_mainWebSocketChannel->connect(url, protocol);
|
| m_syncHelper->setConnectRequestResult(connectRequestResult);
|
| }
|
| - m_syncHelper->signalWorkerThread();
|
| }
|
|
|
| void Peer::sendTextAsCharVector(std::unique_ptr<Vector<char>> data)
|
| @@ -393,34 +391,23 @@ Bridge::~Bridge()
|
| ASSERT(!m_peer);
|
| }
|
|
|
| -void Bridge::createPeerOnMainThread(std::unique_ptr<SourceLocation> location, WorkerThreadLifecycleContext* workerThreadLifecycleContext, ExecutionContext* context)
|
| +void Bridge::connectOnMainThread(std::unique_ptr<SourceLocation> location, WorkerThreadLifecycleContext* workerThreadLifecycleContext, const KURL& url, const String& protocol, ExecutionContext* context)
|
| {
|
| DCHECK(isMainThread());
|
| DCHECK(!m_peer);
|
| Peer* peer = new Peer(this, m_loaderProxy, m_syncHelper, workerThreadLifecycleContext);
|
| - if (peer->initialize(std::move(location), context))
|
| + if (peer->initialize(std::move(location), context)) {
|
| m_peer = peer;
|
| - m_syncHelper->signalWorkerThread();
|
| -}
|
| -
|
| -void Bridge::initialize(std::unique_ptr<SourceLocation> location)
|
| -{
|
| - // Wait for completion of the task on the main thread because the connection
|
| - // must synchronously be established (see Bridge::connect).
|
| - if (!waitForMethodCompletion(BLINK_FROM_HERE, createCrossThreadTask(&Bridge::createPeerOnMainThread, wrapCrossThreadPersistent(this), passed(location->clone()), wrapCrossThreadPersistent(m_workerGlobalScope->thread()->getWorkerThreadLifecycleContext())))) {
|
| - // The worker thread has been signalled to shutdown before method completion.
|
| - disconnect();
|
| + m_peer->connect(url, protocol);
|
| }
|
| + m_syncHelper->signalWorkerThread();
|
| }
|
|
|
| -bool Bridge::connect(const KURL& url, const String& protocol)
|
| +bool Bridge::connect(std::unique_ptr<SourceLocation> location, const KURL& url, const String& protocol)
|
| {
|
| - if (!m_peer)
|
| - return false;
|
| -
|
| // Wait for completion of the task on the main thread because the mixed
|
| // content check must synchronously be conducted.
|
| - if (!waitForMethodCompletion(BLINK_FROM_HERE, createCrossThreadTask(&Peer::connect, wrapCrossThreadPersistent(m_peer.get()), url, protocol)))
|
| + if (!waitForMethodCompletion(BLINK_FROM_HERE, createCrossThreadTask(&Bridge::connectOnMainThread, wrapCrossThreadPersistent(this), passed(location->clone()), wrapCrossThreadPersistent(m_workerGlobalScope->thread()->getWorkerThreadLifecycleContext()), url, protocol)))
|
| return false;
|
|
|
| return m_syncHelper->connectRequestResult();
|
|
|