Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Unified Diff: third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp

Issue 2263173002: [WONT COMMIT] WebSocket: Remove WorkerThread::terminated() call (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..745f0e21d48c2cd66f79e505dfb3bd64c1c601dc 100644
--- a/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp
+++ b/third_party/WebKit/Source/modules/websockets/WorkerWebSocketChannel.cpp
@@ -72,15 +72,29 @@ public:
// All setters are called on the main thread.
void setConnectRequestResult(bool connectRequestResult)
{
+ DCHECK(isMainThread());
m_connectRequestResult = connectRequestResult;
}
+ void setWorkerThreadTerminated(bool workerThreadTerminated)
+ {
+ DCHECK(isMainThread());
+ m_workerThreadTerminated = workerThreadTerminated;
+ }
+
// All getter are called on the worker thread.
bool connectRequestResult() const
{
+ DCHECK(!isMainThread());
return m_connectRequestResult;
}
+ bool workerThreadTerminated() const
+ {
+ DCHECK(!isMainThread());
+ return m_workerThreadTerminated;
+ }
+
// This should be called after all setters are called and before any
// getters are called.
void signalWorkerThread()
@@ -97,12 +111,12 @@ public:
private:
explicit WebSocketChannelSyncHelper(std::unique_ptr<WaitableEvent> event)
: m_event(std::move(event))
- , m_connectRequestResult(false)
{
}
std::unique_ptr<WaitableEvent> m_event;
- bool m_connectRequestResult;
+ bool m_connectRequestResult = false;
+ bool m_workerThreadTerminated = false;
};
WorkerWebSocketChannel::WorkerWebSocketChannel(WorkerGlobalScope& workerGlobalScope, WebSocketChannelClient* client, std::unique_ptr<SourceLocation> location)
@@ -365,6 +379,7 @@ void Peer::didError()
void Peer::contextDestroyed()
{
DCHECK(isMainThread());
+ m_syncHelper->setWorkerThreadTerminated(true);
yhirano 2016/08/23 02:27:15 I think this can be called after m_syncHelper->sig
if (m_mainWebSocketChannel) {
m_mainWebSocketChannel->disconnect();
m_mainWebSocketChannel = nullptr;
@@ -495,7 +510,7 @@ bool Bridge::waitForMethodCompletion(const WebTraceLocation& location, std::uniq
SafePointScope scope(BlinkGC::HeapPointersOnStack);
m_syncHelper->wait();
// This is checking whether a shutdown event is fired or not.
- return !m_workerGlobalScope->thread()->terminated();
+ return !m_syncHelper->workerThreadTerminated();
}
DEFINE_TRACE(Bridge)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698