WebKit Bugzilla
Attachment 359251 Details for
Bug 193484
: Remove more NetworkProcess::singleton use
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-193484-20190115201339.patch (text/plain), 8.18 KB, created by
Alex Christensen
on 2019-01-15 20:13:40 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2019-01-15 20:13:40 PST
Size:
8.18 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 240027) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,31 @@ >+2019-01-15 Alex Christensen <achristensen@webkit.org> >+ >+ Remove more NetworkProcess::singleton use >+ https://bugs.webkit.org/show_bug.cgi?id=193484 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This removes the use of NetworkProcess::singleton in the LegacyCustomProtocolManager. >+ This is the kind of awful duct tape code that keeps me awake at night, but it's necessary >+ because we can't quite remove LegacyCustomProtocolManager yet but we need to allow more than >+ one NetworkProcess object. To make it work well enough until we remove LegacyCustomProtocolManager, >+ use the last NetworkProcess object that has been created. >+ >+ * NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm: >+ (newestNetworkProcess): >+ (LegacyCustomProtocolManager::networkProcessCreated): >+ (+[WKCustomProtocol canInitWithRequest:]): >+ (-[WKCustomProtocol initWithRequest:cachedResponse:client:]): >+ (-[WKCustomProtocol startLoading]): >+ (-[WKCustomProtocol stopLoading]): >+ * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp: >+ (WebKit::LegacyCustomProtocolManager::LegacyCustomProtocolManager): >+ (WebKit::LegacyCustomProtocolManager::startLoading): >+ (WebKit::LegacyCustomProtocolManager::stopLoading): >+ * NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h: >+ * NetworkProcess/NetworkProcess.cpp: >+ (WebKit::NetworkProcess::NetworkProcess): >+ > 2019-01-15 Ryosuke Niwa <rniwa@webkit.org> > > VisualViewport API should be updated upon opening of keyboard >Index: Source/WebKit/NetworkProcess/NetworkProcess.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/NetworkProcess.cpp (revision 240013) >+++ Source/WebKit/NetworkProcess/NetworkProcess.cpp (working copy) >@@ -142,6 +142,9 @@ NetworkProcess::NetworkProcess() > addSupplement<WebCookieManager>(); > #if ENABLE(LEGACY_CUSTOM_PROTOCOL_MANAGER) > addSupplement<LegacyCustomProtocolManager>(); >+#if PLATFORM(COCOA) >+ LegacyCustomProtocolManager::networkProcessCreated(*this); >+#endif > #endif > #if ENABLE(PROXIMITY_NETWORKING) > addSupplement<NetworkProximityManager>(); >Index: Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp >=================================================================== >--- Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp (revision 240013) >+++ Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp (working copy) >@@ -27,9 +27,9 @@ > #include "config.h" > #include "LegacyCustomProtocolManager.h" > >-#include "ChildProcess.h" > #include "LegacyCustomProtocolManagerMessages.h" > #include "LegacyCustomProtocolManagerProxyMessages.h" >+#include "NetworkProcess.h" > #include "NetworkProcessCreationParameters.h" > #include "WebCoreArgumentCoders.h" > #include <WebCore/ResourceRequest.h> >@@ -47,10 +47,10 @@ const char* LegacyCustomProtocolManager: > return "LegacyCustomProtocolManager"; > } > >-LegacyCustomProtocolManager::LegacyCustomProtocolManager(ChildProcess& childProcess) >- : m_childProcess(childProcess) >+LegacyCustomProtocolManager::LegacyCustomProtocolManager(NetworkProcess& networkProcess) >+ : m_networkProcess(networkProcess) > { >- m_childProcess.addMessageReceiver(Messages::LegacyCustomProtocolManager::messageReceiverName(), *this); >+ m_networkProcess.addMessageReceiver(Messages::LegacyCustomProtocolManager::messageReceiverName(), *this); > } > > void LegacyCustomProtocolManager::initialize(const NetworkProcessCreationParameters& parameters) >@@ -77,12 +77,12 @@ void LegacyCustomProtocolManager::remove > > void LegacyCustomProtocolManager::startLoading(uint64_t customProtocolID, const WebCore::ResourceRequest& request) > { >- m_childProcess.send(Messages::LegacyCustomProtocolManagerProxy::StartLoading(customProtocolID, request)); >+ m_networkProcess.send(Messages::LegacyCustomProtocolManagerProxy::StartLoading(customProtocolID, request)); > } > > void LegacyCustomProtocolManager::stopLoading(uint64_t customProtocolID) > { >- m_childProcess.send(Messages::LegacyCustomProtocolManagerProxy::StopLoading(customProtocolID), 0); >+ m_networkProcess.send(Messages::LegacyCustomProtocolManagerProxy::StopLoading(customProtocolID), 0); > } > > } // namespace WebKit >Index: Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h >=================================================================== >--- Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h (revision 240013) >+++ Source/WebKit/NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.h (working copy) >@@ -59,13 +59,13 @@ class ResourceResponse; > > namespace WebKit { > >-class ChildProcess; >+class NetworkProcess; > struct NetworkProcessCreationParameters; > > class LegacyCustomProtocolManager : public NetworkProcessSupplement, public IPC::MessageReceiver { > WTF_MAKE_NONCOPYABLE(LegacyCustomProtocolManager); > public: >- explicit LegacyCustomProtocolManager(ChildProcess&); >+ explicit LegacyCustomProtocolManager(NetworkProcess&); > > static const char* supplementName(); > >@@ -96,6 +96,7 @@ public: > > #if PLATFORM(COCOA) > void registerProtocolClass(NSURLSessionConfiguration*); >+ static void networkProcessCreated(NetworkProcess&); > #endif > > private: >@@ -113,7 +114,7 @@ private: > > void registerProtocolClass(); > >- ChildProcess& m_childProcess; >+ NetworkProcess& m_networkProcess; > > typedef HashMap<uint64_t, CustomProtocol> CustomProtocolMap; > CustomProtocolMap m_customProtocolMap; >Index: Source/WebKit/NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm >=================================================================== >--- Source/WebKit/NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm (revision 240013) >+++ Source/WebKit/NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm (working copy) >@@ -39,6 +39,17 @@ > > using namespace WebKit; > >+static RefPtr<NetworkProcess>& newestNetworkProcess() >+{ >+ static NeverDestroyed<RefPtr<NetworkProcess>> networkProcess; >+ return networkProcess.get(); >+} >+ >+void LegacyCustomProtocolManager::networkProcessCreated(NetworkProcess& networkProcess) >+{ >+ newestNetworkProcess() = &networkProcess; >+} >+ > @interface WKCustomProtocol : NSURLProtocol { > @private > uint64_t _customProtocolID; >@@ -54,7 +65,7 @@ @interface WKCustomProtocol : NSURLProto > > + (BOOL)canInitWithRequest:(NSURLRequest *)request > { >- if (auto* customProtocolManager = NetworkProcess::singleton().supplement<LegacyCustomProtocolManager>()) >+ if (auto* customProtocolManager = newestNetworkProcess()->supplement<LegacyCustomProtocolManager>()) > return customProtocolManager->supportsScheme([[[request URL] scheme] lowercaseString]); > return NO; > } >@@ -75,7 +86,7 @@ - (id)initWithRequest:(NSURLRequest *)re > if (!self) > return nil; > >- if (auto* customProtocolManager = NetworkProcess::singleton().supplement<LegacyCustomProtocolManager>()) >+ if (auto* customProtocolManager = newestNetworkProcess()->supplement<LegacyCustomProtocolManager>()) > _customProtocolID = customProtocolManager->addCustomProtocol(self); > _initializationRunLoop = CFRunLoopGetCurrent(); > >@@ -89,13 +100,13 @@ - (CFRunLoopRef)initializationRunLoop > > - (void)startLoading > { >- if (auto* customProtocolManager = NetworkProcess::singleton().supplement<LegacyCustomProtocolManager>()) >+ if (auto* customProtocolManager = newestNetworkProcess()->supplement<LegacyCustomProtocolManager>()) > customProtocolManager->startLoading(self.customProtocolID, [self request]); > } > > - (void)stopLoading > { >- if (auto* customProtocolManager = NetworkProcess::singleton().supplement<LegacyCustomProtocolManager>()) { >+ if (auto* customProtocolManager = newestNetworkProcess()->supplement<LegacyCustomProtocolManager>()) { > customProtocolManager->stopLoading(self.customProtocolID); > customProtocolManager->removeCustomProtocol(self.customProtocolID); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ggaren
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 193484
: 359251