Changeset 224041 in webkit
- Timestamp:
- Oct 26, 2017 1:14:40 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
- 2 copied
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r224037 r224041 1 2017-10-26 Chris Dumez <cdumez@apple.com> 2 3 Bring back SWContextManager abstraction in WebCore 4 https://bugs.webkit.org/show_bug.cgi?id=178876 5 6 Reviewed by Geoffrey Garen. 7 8 Bring back SWContextManager abstraction in WebCore. It was killed in <https://trac.webkit.org/changeset/223718> but 9 is actually useful when the ServiceWorker wants to message the storage process. 10 11 * Sources.txt: 12 * WebCore.xcodeproj/project.pbxproj: 13 * workers/service/context/SWContextManager.cpp: Added. 14 (WebCore::SWContextManager::singleton): 15 (WebCore::SWContextManager::setConnection): 16 (WebCore::SWContextManager::connection const): 17 (WebCore::SWContextManager::registerServiceWorkerThread): 18 (WebCore::SWContextManager::serviceWorkerThreadProxy const): 19 (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope): 20 * workers/service/context/SWContextManager.h: Copied from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h. 21 (WebCore::SWContextManager::Connection::~Connection): 22 1 23 2017-10-26 Basuke Suzuki <Basuke.Suzuki@sony.com> 2 24 -
trunk/Source/WebCore/Sources.txt
r224006 r224041 2170 2170 workers/service/context/ServiceWorkerThread.cpp 2171 2171 workers/service/context/ServiceWorkerThreadProxy.cpp 2172 workers/service/context/SWContextManager.cpp 2172 2173 2173 2174 workers/service/server/SWClientConnection.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r224027 r224041 1179 1179 463EB6231B8789E00096ED51 /* TagCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 463EB6211B8789CB0096ED51 /* TagCollection.h */; }; 1180 1180 465307D01DB6EE4800E4137C /* JSUIEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E045EF1DAA104F00B0D8B9 /* JSUIEventInit.h */; }; 1181 46658DC91FA24B8700F7DD54 /* SWContextManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4672413B1FA24B140088BD6D /* SWContextManager.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1181 1182 466ED8D31EDE0144005E43F6 /* JSDOMRectList.h in Headers */ = {isa = PBXBuildFile; fileRef = 466ED8D21EDE0135005E43F6 /* JSDOMRectList.h */; }; 1182 1183 4671E0661D67A59600C6B497 /* CanvasPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 4671E0641D67A57B00C6B497 /* CanvasPath.h */; }; … … 7368 7369 4671E0631D67A57B00C6B497 /* CanvasPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CanvasPath.cpp; sourceTree = "<group>"; }; 7369 7370 4671E0641D67A57B00C6B497 /* CanvasPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CanvasPath.h; sourceTree = "<group>"; }; 7371 4672413A1FA24B140088BD6D /* SWContextManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SWContextManager.cpp; sourceTree = "<group>"; }; 7372 4672413B1FA24B140088BD6D /* SWContextManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWContextManager.h; sourceTree = "<group>"; }; 7370 7373 467302011C4EFE6600BCB357 /* IgnoreOpensDuringUnloadCountIncrementer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IgnoreOpensDuringUnloadCountIncrementer.h; sourceTree = "<group>"; }; 7371 7374 4682D1FF1F79782300C863DB /* StoredCredentialsPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StoredCredentialsPolicy.h; sourceTree = "<group>"; }; … … 17264 17267 4112B5411F9F9C9C00E67875 /* ServiceWorkerThreadProxy.cpp */, 17265 17268 4112B53F1F9F9C9B00E67875 /* ServiceWorkerThreadProxy.h */, 17269 4672413A1FA24B140088BD6D /* SWContextManager.cpp */, 17270 4672413B1FA24B140088BD6D /* SWContextManager.h */, 17266 17271 ); 17267 17272 path = context; … … 29386 29391 B2E4EC980D00C22B00432643 /* SVGZoomEvent.h in Headers */, 29387 29392 517A531D1F4B53B100DCDC0A /* SWClientConnection.h in Headers */, 29393 46658DC91FA24B8700F7DD54 /* SWContextManager.h in Headers */, 29388 29394 517A52F01F47535B00DCDC0A /* SWServer.h in Headers */, 29389 29395 51F645971F4A686F00B54DED /* SWServerRegistration.h in Headers */, -
trunk/Source/WebCore/workers/service/context/SWContextManager.cpp
r224040 r224041 24 24 */ 25 25 26 # pragma once26 #include "config.h" 27 27 28 28 #if ENABLE(SERVICE_WORKER) 29 30 #include "Connection.h" 31 #include "MessageReceiver.h" 32 #include <WebCore/ServiceWorkerThreadProxy.h> 33 #include <wtf/HashMap.h> 29 #include "SWContextManager.h" 34 30 35 31 namespace WebCore { 36 struct FetchOptions; 37 class ResourceRequest; 38 struct ServiceWorkerContextData; 32 33 SWContextManager& SWContextManager::singleton() 34 { 35 static SWContextManager* sharedManager = new SWContextManager; 36 return *sharedManager; 39 37 } 40 38 41 namespace WebKit { 42 struct WebPreferencesStore; 39 void SWContextManager::setConnection(std::unique_ptr<Connection>&& connection) 40 { 41 ASSERT(!m_connection); 42 m_connection = WTFMove(connection); 43 } 43 44 44 class ServiceWorkerContextManager : public IPC::MessageReceiver { 45 public: 46 ServiceWorkerContextManager(Ref<IPC::Connection>&&, uint64_t pageID, const WebPreferencesStore&); 45 auto SWContextManager::connection() const -> Connection* 46 { 47 return m_connection.get(); 48 } 47 49 48 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final; 50 void SWContextManager::registerServiceWorkerThread(Ref<ServiceWorkerThreadProxy>&& serviceWorkerThreadProxy) 51 { 52 auto serviceWorkerIdentifier = serviceWorkerThreadProxy->identifier(); 53 auto result = m_workerMap.add(serviceWorkerIdentifier, WTFMove(serviceWorkerThreadProxy)); 54 ASSERT_UNUSED(result, result.isNewEntry); 55 } 49 56 50 private: 51 void updatePreferences(const WebPreferencesStore&); 57 ServiceWorkerThreadProxy* SWContextManager::serviceWorkerThreadProxy(uint64_t serviceWorkerIdentifier) const 58 { 59 return m_workerMap.get(serviceWorkerIdentifier); 60 } 52 61 53 void startServiceWorker(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerContextData&); 54 void startFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, WebCore::ResourceRequest&&, WebCore::FetchOptions&&); 55 void postMessageToServiceWorkerGlobalScope(uint64_t serverConnectionIdentifier, uint64_t serviceWorkerIdentifier, const IPC::DataReference& message, const String& sourceOrigin); 62 void SWContextManager::postMessageToServiceWorkerGlobalScope(uint64_t serviceWorkerIdentifier, Ref<SerializedScriptValue>&& message, const String& sourceOrigin) 63 { 64 auto* serviceWorker = m_workerMap.get(serviceWorkerIdentifier); 65 if (!serviceWorker) 66 return; 56 67 57 Ref<IPC::Connection> m_connectionToStorageProcess; 58 HashMap<uint64_t, RefPtr<WebCore::ServiceWorkerThreadProxy>> m_workerMap; 59 uint64_t m_pageID { 0 }; 60 uint64_t m_previousServiceWorkerID { 0 }; 61 }; 68 // FIXME: We should pass valid MessagePortChannels. 69 serviceWorker->thread().postMessageToServiceWorkerGlobalScope(WTFMove(message), nullptr, sourceOrigin); 70 } 62 71 63 } // namespace Web Kit72 } // namespace WebCore 64 73 65 #endif // ENABLE(SERVICE_WORKER)74 #endif -
trunk/Source/WebCore/workers/service/context/SWContextManager.h
r224040 r224041 28 28 #if ENABLE(SERVICE_WORKER) 29 29 30 #include "Connection.h" 31 #include "MessageReceiver.h" 32 #include <WebCore/ServiceWorkerThreadProxy.h> 30 #include "ExceptionOr.h" 31 #include "ServiceWorkerThreadProxy.h" 33 32 #include <wtf/HashMap.h> 34 33 35 34 namespace WebCore { 36 struct FetchOptions;37 class ResourceRequest;38 struct ServiceWorkerContextData;39 }40 35 41 namespace WebKit { 42 struct WebPreferencesStore; 36 class SerializedScriptValue; 43 37 44 class S erviceWorkerContextManager : public IPC::MessageReceiver {38 class SWContextManager { 45 39 public: 46 ServiceWorkerContextManager(Ref<IPC::Connection>&&, uint64_t pageID, const WebPreferencesStore&);40 WEBCORE_EXPORT static SWContextManager& singleton(); 47 41 48 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final; 42 class Connection { 43 public: 44 virtual ~Connection() { } 45 }; 46 47 WEBCORE_EXPORT void setConnection(std::unique_ptr<Connection>&&); 48 WEBCORE_EXPORT Connection* connection() const; 49 50 WEBCORE_EXPORT void registerServiceWorkerThread(Ref<ServiceWorkerThreadProxy>&&); 51 WEBCORE_EXPORT ServiceWorkerThreadProxy* serviceWorkerThreadProxy(uint64_t) const; 52 WEBCORE_EXPORT void postMessageToServiceWorkerGlobalScope(uint64_t serviceWorkerIdentifier, Ref<SerializedScriptValue>&& message, const String& sourceOrigin); 49 53 50 54 private: 51 void updatePreferences(const WebPreferencesStore&);55 SWContextManager() = default; 52 56 53 void startServiceWorker(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerContextData&); 54 void startFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, WebCore::ResourceRequest&&, WebCore::FetchOptions&&); 55 void postMessageToServiceWorkerGlobalScope(uint64_t serverConnectionIdentifier, uint64_t serviceWorkerIdentifier, const IPC::DataReference& message, const String& sourceOrigin); 56 57 Ref<IPC::Connection> m_connectionToStorageProcess; 58 HashMap<uint64_t, RefPtr<WebCore::ServiceWorkerThreadProxy>> m_workerMap; 59 uint64_t m_pageID { 0 }; 60 uint64_t m_previousServiceWorkerID { 0 }; 57 HashMap<uint64_t, RefPtr<ServiceWorkerThreadProxy>> m_workerMap; 58 std::unique_ptr<Connection> m_connection; 61 59 }; 62 60 63 } // namespace Web Kit61 } // namespace WebCore 64 62 65 63 #endif // ENABLE(SERVICE_WORKER) -
trunk/Source/WebKit/CMakeLists.txt
r223958 r224041 542 542 543 543 WebProcess/Storage/ServiceWorkerClientFetch.cpp 544 WebProcess/Storage/ServiceWorkerContextManager.cpp545 544 WebProcess/Storage/WebSWClientConnection.cpp 545 WebProcess/Storage/WebSWContextManagerConnection.cpp 546 546 WebProcess/Storage/WebSWOriginTable.cpp 547 547 WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp … … 689 689 690 690 WebProcess/Storage/ServiceWorkerClientFetch.messages.in 691 WebProcess/Storage/ServiceWorkerContextManager.messages.in692 691 WebProcess/Storage/WebSWClientConnection.messages.in 692 WebProcess/Storage/WebSWContextManagerConnection.messages.in 693 693 694 694 WebProcess/UserContent/WebUserContentController.messages.in -
trunk/Source/WebKit/ChangeLog
r224035 r224041 1 2017-10-26 Chris Dumez <cdumez@apple.com> 2 3 Bring back SWContextManager abstraction in WebCore 4 https://bugs.webkit.org/show_bug.cgi?id=178876 5 6 Reviewed by Geoffrey Garen. 7 8 Bring back SWContextManager abstraction in WebCore. It was killed in <https://trac.webkit.org/changeset/223718> but 9 is actually useful when the ServiceWorker wants to message the storage process. 10 11 * CMakeLists.txt: 12 * DerivedSources.make: 13 * StorageProcess/ServiceWorker/WebSWServerConnection.cpp: 14 (WebKit::WebSWServerConnection::startServiceWorkerContext): 15 (WebKit::WebSWServerConnection::startFetch): 16 (WebKit::WebSWServerConnection::postMessageToServiceWorkerGlobalScope): 17 * WebKit.xcodeproj/project.pbxproj: 18 * WebProcess/Storage/WebSWContextManagerConnection.cpp: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.cpp. 19 (WebKit::WebSWContextManagerConnection::WebSWContextManagerConnection): 20 (WebKit::WebSWContextManagerConnection::updatePreferences): 21 (WebKit::WebSWContextManagerConnection::startServiceWorker): 22 (WebKit::WebSWContextManagerConnection::startFetch): 23 (WebKit::WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope): 24 * WebProcess/Storage/WebSWContextManagerConnection.h: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h. 25 * WebProcess/Storage/WebSWContextManagerConnection.messages.in: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.messages.in. 26 * WebProcess/WebProcess.cpp: 27 (WebKit::WebProcess::didReceiveMessage): 28 (WebKit::WebProcess::getWorkerContextConnection): 29 * WebProcess/WebProcess.h: 30 1 31 2017-10-26 Alexey Proskuryakov <ap@apple.com> 2 32 -
trunk/Source/WebKit/DerivedSources.make
r223903 r224041 127 127 SecItemShimProxy \ 128 128 ServiceWorkerClientFetch \ 129 ServiceWorkerContextManager \130 129 SmartMagnificationController \ 131 130 StorageAreaMap \ … … 164 163 WebPaymentCoordinatorProxy \ 165 164 WebSWClientConnection \ 165 WebSWContextManagerConnection \ 166 166 WebSWServerConnection \ 167 167 PlaybackSessionManager \ -
trunk/Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp
r223964 r224041 32 32 #include "Logging.h" 33 33 #include "ServiceWorkerClientFetchMessages.h" 34 #include "ServiceWorkerContextManagerMessages.h"35 34 #include "StorageProcess.h" 36 35 #include "StorageToWebProcessConnectionMessages.h" … … 39 38 #include "WebProcessMessages.h" 40 39 #include "WebSWClientConnectionMessages.h" 40 #include "WebSWContextManagerConnectionMessages.h" 41 41 #include "WebSWOriginStore.h" 42 42 #include "WebSWServerConnectionMessages.h" … … 98 98 void WebSWServerConnection::startServiceWorkerContext(const ServiceWorkerContextData& data) 99 99 { 100 if (sendToContextProcess(Messages:: ServiceWorkerContextManager::StartServiceWorker(identifier(), data)))100 if (sendToContextProcess(Messages::WebSWContextManagerConnection::StartServiceWorker(identifier(), data))) 101 101 return; 102 102 … … 106 106 void WebSWServerConnection::startFetch(uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, const ResourceRequest& request, const FetchOptions& options) 107 107 { 108 sendToContextProcess(Messages:: ServiceWorkerContextManager::StartFetch(identifier(), fetchIdentifier, serviceWorkerIdentifier, request, options));108 sendToContextProcess(Messages::WebSWContextManagerConnection::StartFetch(identifier(), fetchIdentifier, serviceWorkerIdentifier, request, options)); 109 109 } 110 110 111 111 void WebSWServerConnection::postMessageToServiceWorkerGlobalScope(uint64_t serviceWorkerIdentifier, const IPC::DataReference& message, const String& sourceOrigin) 112 112 { 113 sendToContextProcess(Messages:: ServiceWorkerContextManager::PostMessageToServiceWorkerGlobalScope(identifier(),serviceWorkerIdentifier, message, sourceOrigin));113 sendToContextProcess(Messages::WebSWContextManagerConnection::PostMessageToServiceWorkerGlobalScope(serviceWorkerIdentifier, message, sourceOrigin)); 114 114 } 115 115 -
trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r224035 r224041 892 892 413075B41DE85F580039EC69 /* LibWebRTCProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 413075A81DE85EE70039EC69 /* LibWebRTCProvider.h */; }; 893 893 4131F3D11F96BCCC0059995A /* ServiceWorkerClientFetch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4131F3D01F96BCC80059995A /* ServiceWorkerClientFetch.cpp */; }; 894 4131F3D41F96E9350059995A /* ServiceWorkerContextManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4131F3D31F96E9310059995A /* ServiceWorkerContextManager.cpp */; };895 4131F3D51F96E9350059995A /* ServiceWorkerContextManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4131F3D21F96E9300059995A /* ServiceWorkerContextManager.h */; };896 894 4131F3E21F9880840059995A /* WebServiceWorkerFetchTaskClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4131F3E01F98712C0059995A /* WebServiceWorkerFetchTaskClient.cpp */; }; 897 895 4135FBD11F4FB8090074C47B /* CacheStorageEngineCaches.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4135FBCF1F4FB7F20074C47B /* CacheStorageEngineCaches.cpp */; }; … … 920 918 41FAF5F91E3C1025001AE678 /* LibWebRTCResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FAF5F71E3C0B47001AE678 /* LibWebRTCResolver.cpp */; }; 921 919 4450AEC01DC3FAE5009943F2 /* SharedMemoryCocoa.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4450AEBF1DC3FAE5009943F2 /* SharedMemoryCocoa.cpp */; }; 922 460F488F1F996F7100CF4B87 /* ServiceWorkerContextManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 460F488D1F996F6C00CF4B87 /* ServiceWorkerContextManagerMessageReceiver.cpp */; };923 460F48901F996F7100CF4B87 /* ServiceWorkerContextManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 460F488E1F996F6C00CF4B87 /* ServiceWorkerContextManagerMessages.h */; };920 460F488F1F996F7100CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 460F488D1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp */; }; 921 460F48901F996F7100CF4B87 /* WebSWContextManagerConnectionMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 460F488E1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessages.h */; }; 924 922 462107D81F38DBDB00DD7810 /* PingLoad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 462107D71F38DBD300DD7810 /* PingLoad.cpp */; }; 925 923 463FD4801EB9459600A2982C /* WKProcessTerminationReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 463FD47F1EB9458400A2982C /* WKProcessTerminationReason.h */; settings = {ATTRIBUTES = (Private, ); }; }; 926 924 463FD4821EB94EC000A2982C /* ProcessTerminationReason.h in Headers */ = {isa = PBXBuildFile; fileRef = 463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */; }; 927 925 465250E61ECF52DC002025CB /* WebKit2InitializeCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 465250E51ECF52CD002025CB /* WebKit2InitializeCocoa.mm */; }; 926 466BC03B1FA266DA002FA9C1 /* WebSWContextManagerConnection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 466BC0381FA266C9002FA9C1 /* WebSWContextManagerConnection.cpp */; }; 927 466BC03C1FA266DA002FA9C1 /* WebSWContextManagerConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 466BC0391FA266C9002FA9C1 /* WebSWContextManagerConnection.h */; }; 928 928 46A2B6081E5676A600C3DEDA /* BackgroundProcessResponsivenessTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 46A2B6061E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.cpp */; }; 929 929 46A2B6091E5676A600C3DEDA /* BackgroundProcessResponsivenessTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 46A2B6071E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.h */; }; … … 3195 3195 4131F3CF1F96A9360059995A /* ServiceWorkerClientFetch.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ServiceWorkerClientFetch.messages.in; sourceTree = "<group>"; }; 3196 3196 4131F3D01F96BCC80059995A /* ServiceWorkerClientFetch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerClientFetch.cpp; sourceTree = "<group>"; }; 3197 4131F3D21F96E9300059995A /* ServiceWorkerContextManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerContextManager.h; sourceTree = "<group>"; };3198 4131F3D31F96E9310059995A /* ServiceWorkerContextManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerContextManager.cpp; sourceTree = "<group>"; };3199 3197 4131F3E01F98712C0059995A /* WebServiceWorkerFetchTaskClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebServiceWorkerFetchTaskClient.cpp; sourceTree = "<group>"; }; 3200 3198 4135FBCF1F4FB7F20074C47B /* CacheStorageEngineCaches.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheStorageEngineCaches.cpp; sourceTree = "<group>"; }; … … 3232 3230 41FAF5F71E3C0B47001AE678 /* LibWebRTCResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibWebRTCResolver.cpp; path = Network/webrtc/LibWebRTCResolver.cpp; sourceTree = "<group>"; }; 3233 3231 4450AEBF1DC3FAE5009943F2 /* SharedMemoryCocoa.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SharedMemoryCocoa.cpp; sourceTree = "<group>"; }; 3234 460F488D1F996F6C00CF4B87 /* ServiceWorkerContextManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerContextManagerMessageReceiver.cpp; sourceTree = "<group>"; };3235 460F488E1F996F6C00CF4B87 /* ServiceWorkerContextManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerContextManagerMessages.h; sourceTree = "<group>"; };3232 460F488D1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWContextManagerConnectionMessageReceiver.cpp; sourceTree = "<group>"; }; 3233 460F488E1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWContextManagerConnectionMessages.h; sourceTree = "<group>"; }; 3236 3234 462107D71F38DBD300DD7810 /* PingLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PingLoad.cpp; path = NetworkProcess/PingLoad.cpp; sourceTree = "<group>"; }; 3237 3235 463FD47F1EB9458400A2982C /* WKProcessTerminationReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKProcessTerminationReason.h; sourceTree = "<group>"; }; 3238 3236 463FD4811EB94EAD00A2982C /* ProcessTerminationReason.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProcessTerminationReason.h; sourceTree = "<group>"; }; 3239 3237 465250E51ECF52CD002025CB /* WebKit2InitializeCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebKit2InitializeCocoa.mm; sourceTree = "<group>"; }; 3238 466BC0381FA266C9002FA9C1 /* WebSWContextManagerConnection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebSWContextManagerConnection.cpp; sourceTree = "<group>"; }; 3239 466BC0391FA266C9002FA9C1 /* WebSWContextManagerConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSWContextManagerConnection.h; sourceTree = "<group>"; }; 3240 466BC03A1FA266C9002FA9C1 /* WebSWContextManagerConnection.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebSWContextManagerConnection.messages.in; sourceTree = "<group>"; }; 3240 3241 46A2B6061E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BackgroundProcessResponsivenessTimer.cpp; sourceTree = "<group>"; }; 3241 3242 46A2B6071E5675A200C3DEDA /* BackgroundProcessResponsivenessTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackgroundProcessResponsivenessTimer.h; sourceTree = "<group>"; }; … … 6213 6214 4131F3CE1F96A4950059995A /* ServiceWorkerClientFetch.h */, 6214 6215 4131F3CF1F96A9360059995A /* ServiceWorkerClientFetch.messages.in */, 6215 4131F3D31F96E9310059995A /* ServiceWorkerContextManager.cpp */,6216 4131F3D21F96E9300059995A /* ServiceWorkerContextManager.h */,6217 6216 414DEDC51F9E4BEC0047C40D /* ServiceWorkerFrameLoaderClient.cpp */, 6218 6217 414DEDC41F9E4BEB0047C40D /* ServiceWorkerFrameLoaderClient.h */, … … 6224 6223 517A53021F4793B200DCDC0A /* WebSWClientConnection.h */, 6225 6224 517A530C1F479E9700DCDC0A /* WebSWClientConnection.messages.in */, 6225 466BC0381FA266C9002FA9C1 /* WebSWContextManagerConnection.cpp */, 6226 466BC0391FA266C9002FA9C1 /* WebSWContextManagerConnection.h */, 6227 466BC03A1FA266C9002FA9C1 /* WebSWContextManagerConnection.messages.in */, 6226 6228 83F1A0771F96E7700045B94E /* WebSWOriginTable.cpp */, 6227 6229 83F1A0781F96E7710045B94E /* WebSWOriginTable.h */, … … 8066 8068 E18E6914169B667B009B6670 /* SecItemShimProxyMessages.h */, 8067 8069 617A52D71F43A9B600DCDC0A /* ServiceWorkerClientFetchMessageReceiver.cpp */, 8068 460F488D1F996F6C00CF4B87 /* ServiceWorkerContextManagerMessageReceiver.cpp */,8069 460F488E1F996F6C00CF4B87 /* ServiceWorkerContextManagerMessages.h */,8070 8070 2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */, 8071 8071 2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */, … … 8162 8162 517A530E1F47A84300DCDC0A /* WebSWClientConnectionMessageReceiver.cpp */, 8163 8163 517A530D1F47A84300DCDC0A /* WebSWClientConnectionMessages.h */, 8164 460F488D1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp */, 8165 460F488E1F996F6C00CF4B87 /* WebSWContextManagerConnectionMessages.h */, 8164 8166 517A52D71F43A9B600DCDC0A /* WebSWServerConnectionMessageReceiver.cpp */, 8165 8167 517A52D61F43A9B600DCDC0A /* WebSWServerConnectionMessages.h */, … … 8842 8844 E18E6918169B667B009B6670 /* SecItemShimProxyMessages.h in Headers */, 8843 8845 514D9F5719119D35000063A7 /* ServicesController.h in Headers */, 8844 4131F3D51F96E9350059995A /* ServiceWorkerContextManager.h in Headers */,8845 460F48901F996F7100CF4B87 /* ServiceWorkerContextManagerMessages.h in Headers */,8846 8846 414DEDD71F9EDDE50047C40D /* ServiceWorkerProcessProxy.h in Headers */, 8847 8847 1AFDE65A1954A42B00C48FFA /* SessionState.h in Headers */, … … 9079 9079 517A53051F4793C600DCDC0A /* WebSWClientConnection.h in Headers */, 9080 9080 517A53101F47A86200DCDC0A /* WebSWClientConnectionMessages.h in Headers */, 9081 466BC03C1FA266DA002FA9C1 /* WebSWContextManagerConnection.h in Headers */, 9082 460F48901F996F7100CF4B87 /* WebSWContextManagerConnectionMessages.h in Headers */, 9081 9083 832994A81F96F50200AC57B1 /* WebSWOriginStore.h in Headers */, 9082 9084 83F1A07A1F96E7790045B94E /* WebSWOriginTable.h in Headers */, … … 10437 10439 4131F3D11F96BCCC0059995A /* ServiceWorkerClientFetch.cpp in Sources */, 10438 10440 617A52D81F43A9DA00DCDC0A /* ServiceWorkerClientFetchMessageReceiver.cpp in Sources */, 10439 4131F3D41F96E9350059995A /* ServiceWorkerContextManager.cpp in Sources */,10440 460F488F1F996F7100CF4B87 /* ServiceWorkerContextManagerMessageReceiver.cpp in Sources */,10441 10441 414DEDD81F9EDDE50047C40D /* ServiceWorkerProcessProxy.cpp in Sources */, 10442 10442 1AFDE6591954A42B00C48FFA /* SessionState.cpp in Sources */, … … 10737 10737 517A53041F4793C600DCDC0A /* WebSWClientConnection.cpp in Sources */, 10738 10738 517A530F1F47A86200DCDC0A /* WebSWClientConnectionMessageReceiver.cpp in Sources */, 10739 466BC03B1FA266DA002FA9C1 /* WebSWContextManagerConnection.cpp in Sources */, 10740 460F488F1F996F7100CF4B87 /* WebSWContextManagerConnectionMessageReceiver.cpp in Sources */, 10739 10741 832994A71F96F50200AC57B1 /* WebSWOriginStore.cpp in Sources */, 10740 10742 83F1A0791F96E7790045B94E /* WebSWOriginTable.cpp in Sources */, -
trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
r224040 r224041 25 25 26 26 #include "config.h" 27 #include " ServiceWorkerContextManager.h"27 #include "WebSWContextManagerConnection.h" 28 28 29 29 #if ENABLE(SERVICE_WORKER) … … 44 44 #include <WebCore/EmptyFrameLoaderClient.h> 45 45 #include <WebCore/LibWebRTCProvider.h> 46 #include <WebCore/MessagePortChannel.h>47 46 #include <WebCore/PageConfiguration.h> 48 47 #include <WebCore/RuntimeEnabledFeatures.h> … … 83 82 }; 84 83 85 ServiceWorkerContextManager::ServiceWorkerContextManager(Ref<IPC::Connection>&& connection, uint64_t pageID, const WebPreferencesStore& store)84 WebSWContextManagerConnection::WebSWContextManagerConnection(Ref<IPC::Connection>&& connection, uint64_t pageID, const WebPreferencesStore& store) 86 85 : m_connectionToStorageProcess(WTFMove(connection)) 87 86 , m_pageID(pageID) … … 90 89 } 91 90 92 void ServiceWorkerContextManager::updatePreferences(const WebPreferencesStore& store)91 void WebSWContextManagerConnection::updatePreferences(const WebPreferencesStore& store) 93 92 { 94 93 RuntimeEnabledFeatures::sharedFeatures().setCacheAPIEnabled(store.getBoolValueForKey(WebPreferencesKey::cacheAPIEnabledKey())); … … 96 95 } 97 96 98 void ServiceWorkerContextManager::startServiceWorker(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData& data)97 void WebSWContextManagerConnection::startServiceWorker(uint64_t serverConnectionIdentifier, const ServiceWorkerContextData& data) 99 98 { 100 99 // FIXME: Provide a sensical session ID. … … 113 112 auto serviceWorkerThreadProxy = ServiceWorkerThreadProxy::create(WTFMove(pageConfiguration), serverConnectionIdentifier, data, sessionID, WebProcess::singleton().cacheStorageProvider()); 114 113 auto serviceWorkerIdentifier = serviceWorkerThreadProxy->identifier(); 115 auto result = m_workerMap.add(serviceWorkerIdentifier, WTFMove(serviceWorkerThreadProxy)); 116 ASSERT_UNUSED(result, result.isNewEntry); 114 SWContextManager::singleton().registerServiceWorkerThread(WTFMove(serviceWorkerThreadProxy)); 117 115 118 116 LOG(ServiceWorker, "Context process PID: %i started worker thread %s\n", getpid(), data.workerID.utf8().data()); … … 121 119 } 122 120 123 void ServiceWorkerContextManager::startFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, ResourceRequest&& request, FetchOptions&& options)121 void WebSWContextManagerConnection::startFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, ResourceRequest&& request, FetchOptions&& options) 124 122 { 125 auto serviceWorkerThreadProxy = serviceWorkerIdentifier ? m_workerMap.get(serviceWorkerIdentifier) : nullptr;123 auto* serviceWorkerThreadProxy = SWContextManager::singleton().serviceWorkerThreadProxy(serviceWorkerIdentifier); 126 124 if (!serviceWorkerThreadProxy) { 127 125 m_connectionToStorageProcess->send(Messages::StorageProcess::DidNotHandleFetch(serverConnectionIdentifier, fetchIdentifier), 0); … … 133 131 } 134 132 135 void ServiceWorkerContextManager::postMessageToServiceWorkerGlobalScope(uint64_t serverConnectionIdentifier,uint64_t serviceWorkerIdentifier, const IPC::DataReference& message, const String& sourceOrigin)133 void WebSWContextManagerConnection::postMessageToServiceWorkerGlobalScope(uint64_t serviceWorkerIdentifier, const IPC::DataReference& message, const String& sourceOrigin) 136 134 { 137 auto* serviceWorker = m_workerMap.get(serviceWorkerIdentifier); 138 if (!serviceWorker) 139 return; 140 141 // FIXME: We should pass valid MessagePortChannels. 142 serviceWorker->thread().postMessageToServiceWorkerGlobalScope(SerializedScriptValue::adopt(message.vector()), nullptr, sourceOrigin); 135 SWContextManager::singleton().postMessageToServiceWorkerGlobalScope(serviceWorkerIdentifier, SerializedScriptValue::adopt(message.vector()), sourceOrigin); 143 136 } 144 137 -
trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h
r224040 r224041 30 30 #include "Connection.h" 31 31 #include "MessageReceiver.h" 32 #include <WebCore/ServiceWorkerThreadProxy.h> 33 #include <wtf/HashMap.h> 32 #include <WebCore/SWContextManager.h> 34 33 35 34 namespace WebCore { … … 40 39 41 40 namespace WebKit { 41 42 42 struct WebPreferencesStore; 43 43 44 class ServiceWorkerContextManager :public IPC::MessageReceiver {44 class WebSWContextManagerConnection : public WebCore::SWContextManager::Connection, public IPC::MessageReceiver { 45 45 public: 46 ServiceWorkerContextManager(Ref<IPC::Connection>&&, uint64_t pageID, const WebPreferencesStore&);46 WebSWContextManagerConnection(Ref<IPC::Connection>&&, uint64_t pageID, const WebPreferencesStore&); 47 47 48 48 void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final; 49 50 void postMessageToServiceWorkerGlobalScope(uint64_t serviceWorkerIdentifier, const IPC::DataReference& message, const String& sourceOrigin); 49 51 50 52 private: … … 53 55 void startServiceWorker(uint64_t serverConnectionIdentifier, const WebCore::ServiceWorkerContextData&); 54 56 void startFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, WebCore::ResourceRequest&&, WebCore::FetchOptions&&); 55 void postMessageToServiceWorkerGlobalScope(uint64_t serverConnectionIdentifier, uint64_t serviceWorkerIdentifier, const IPC::DataReference& message, const String& sourceOrigin);56 57 57 58 Ref<IPC::Connection> m_connectionToStorageProcess; 58 HashMap<uint64_t, RefPtr<WebCore::ServiceWorkerThreadProxy>> m_workerMap;59 59 uint64_t m_pageID { 0 }; 60 60 uint64_t m_previousServiceWorkerID { 0 }; -
trunk/Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in
r224040 r224041 23 23 #if ENABLE(SERVICE_WORKER) 24 24 25 messages -> ServiceWorkerContextManager{25 messages -> WebSWContextManagerConnection { 26 26 StartServiceWorker(uint64_t serverConnectionIdentifier, struct WebCore::ServiceWorkerContextData contextData) 27 27 StartFetch(uint64_t serverConnectionIdentifier, uint64_t fetchIdentifier, uint64_t serviceWorkerIdentifier, WebCore::ResourceRequest request, struct WebCore::FetchOptions options) 28 PostMessageToServiceWorkerGlobalScope(uint64_t serv erConnectionIdentifier, uint64_t serviceWorkerIdentifier, IPC::DataReference message, String sourceOrigin)28 PostMessageToServiceWorkerGlobalScope(uint64_t serviceWorkerIdentifier, IPC::DataReference message, String sourceOrigin) 29 29 } 30 30 -
trunk/Source/WebKit/WebProcess/WebProcess.cpp
r223981 r224041 42 42 #include "NetworkSessionCreationParameters.h" 43 43 #include "PluginProcessConnectionManager.h" 44 #include "ServiceWorkerContextManager.h"45 #include "ServiceWorkerContextManagerMessages.h"46 44 #include "SessionTracker.h" 47 45 #include "StatisticsData.h" … … 69 67 #include "WebProcessProxyMessages.h" 70 68 #include "WebResourceLoadStatisticsStoreMessages.h" 69 #include "WebSWContextManagerConnection.h" 70 #include "WebSWContextManagerConnectionMessages.h" 71 71 #include "WebServiceWorkerProvider.h" 72 72 #include "WebSocketStream.h" … … 675 675 676 676 #if ENABLE(SERVICE_WORKER) 677 if (decoder.messageReceiverName() == Messages:: ServiceWorkerContextManager::messageReceiverName()) {678 ASSERT( m_serviceWorkerManager);679 if ( m_serviceWorkerManager)680 m_serviceWorkerManager->didReceiveMessage(connection, decoder);677 if (decoder.messageReceiverName() == Messages::WebSWContextManagerConnection::messageReceiverName()) { 678 ASSERT(SWContextManager::singleton().connection()); 679 if (auto* contextManagerConnection = SWContextManager::singleton().connection()) 680 static_cast<WebSWContextManagerConnection&>(*contextManagerConnection).didReceiveMessage(connection, decoder); 681 681 return; 682 682 } … … 1643 1643 void WebProcess::getWorkerContextConnection(uint64_t pageID, const WebPreferencesStore& store) 1644 1644 { 1645 ASSERT(!m_serviceWorkerManager);1646 1647 1645 #if USE(UNIX_DOMAIN_SOCKETS) 1648 1646 IPC::Connection::SocketPair socketPair = IPC::Connection::createPlatformConnection(); … … 1665 1663 auto workerContextConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this); 1666 1664 workerContextConnection->open(); 1667 m_serviceWorkerManager = ServiceWorkerContextManager(WTFMove(workerContextConnection), pageID, store);1665 SWContextManager::singleton().setConnection(std::make_unique<WebSWContextManagerConnection>(WTFMove(workerContextConnection), pageID, store)); 1668 1666 WebProcess::singleton().parentProcessConnection()->send(Messages::WebProcessProxy::DidGetWorkerContextConnection(connectionClientPort), 0); 1669 1667 } -
trunk/Source/WebKit/WebProcess/WebProcess.h
r223981 r224041 31 31 #include "ResourceCachesToClear.h" 32 32 #include "SandboxExtension.h" 33 #include "ServiceWorkerContextManager.h"34 33 #include "TextCheckerState.h" 35 34 #include "ViewUpdateDispatcher.h" … … 438 437 std::unique_ptr<WaylandCompositorDisplay> m_waylandCompositorDisplay; 439 438 #endif 440 #if ENABLE(SERVICE_WORKER)441 std::optional<ServiceWorkerContextManager> m_serviceWorkerManager;442 #endif443 439 }; 444 440
Note: See TracChangeset
for help on using the changeset viewer.