Get rid of ServiceWorker::allWorkers() hashmap
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 00:28:42 +0000 (00:28 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 29 Nov 2017 00:28:42 +0000 (00:28 +0000)
commit817d3af79f86729a5e83cec4df5fb1420d0fac3e
treec03c0903a45ba45a01fa015618729427c7e934fa
parentc0a79a3f87404782be1b073a4ca4338f7c909de9
Get rid of ServiceWorker::allWorkers() hashmap
https://bugs.webkit.org/show_bug.cgi?id=180111

Reviewed by Brady Eidson.

Get rid of ServiceWorker::allWorkers() hashmap as it is not thread safe and we'll soon have
ServiceWorker objects living in various service worker threads.

Instead, we now have a per-ScriptExecutionContext map, which is inherently thread-safe.

No new tests, no web-facing behavior change.

* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::registerServiceWorker):
(WebCore::ScriptExecutionContext::unregisterServiceWorker):
* dom/ScriptExecutionContext.h:
(WebCore::ScriptExecutionContext::serviceWorker):
* workers/service/ServiceWorker.cpp:
(WebCore::ServiceWorker::getOrCreate):
(WebCore::ServiceWorker::ServiceWorker):
(WebCore::ServiceWorker::~ServiceWorker):
(WebCore::ServiceWorker::stop):
* workers/service/ServiceWorker.h:
* workers/service/server/SWClientConnection.cpp:
(WebCore::SWClientConnection::updateWorkerState):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/dom/ScriptExecutionContext.cpp
Source/WebCore/dom/ScriptExecutionContext.h
Source/WebCore/workers/service/ServiceWorker.cpp
Source/WebCore/workers/service/ServiceWorker.h
Source/WebCore/workers/service/server/SWClientConnection.cpp