WebKit Bugzilla
Attachment 339454 Details for
Bug 185261
: Adopt new async _savecookies SPI for keeping networking process active during flushing cookies
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185261-20180503134601.patch (text/plain), 10.14 KB, created by
Sihui Liu
on 2018-05-03 13:46:02 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sihui Liu
Created:
2018-05-03 13:46:02 PDT
Size:
10.14 KB
patch
obsolete
>Subversion Revision: 231192 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c4b55410f4575ba272e49d5e425586a5bdd1613c..80c916b2a3fe2e1b5721a6652179e41380ffe6fb 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,19 @@ >+2018-05-03 Sihui Liu <sihui_liu@apple.com> >+ >+ Adopt new async _savecookies SPI for keeping networking process active during flushing cookies >+ https://bugs.webkit.org/show_bug.cgi?id=185261 >+ <rdar://problem/37214391> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We should keep networking process active(not suspended) before cookies are fully synced to >+ disk. With the new async SPI _savecookies, we are able to achieve this by taking a background >+ aseertion before calling this SPI and releasing the assertion in the completion handler. >+ >+ * platform/network/NetworkStorageSession.cpp: >+ (WebCore::NetworkStorageSession::sessionCount): >+ * platform/network/NetworkStorageSession.h: >+ > 2018-04-30 Myles C. Maxfield <mmaxfield@apple.com> > > Improve the performance of FontCascadeDescription's effectiveFamilies >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index b676465924fcb8a23db2768466ffe93c4a56bd1f..b47990e57c1a66b270855179a3e8921134758f57 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,23 @@ >+2018-05-03 Sihui Liu <sihui_liu@apple.com> >+ >+ Adopt new async _savecookies SPI for keeping networking process active during flushing cookies >+ https://bugs.webkit.org/show_bug.cgi?id=185261 >+ <rdar://problem/37214391> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * NetworkProcess/NetworkProcess.cpp: >+ (WebKit::NetworkProcess::didSyncAllCookies const): >+ * NetworkProcess/NetworkProcess.h: >+ * NetworkProcess/cocoa/NetworkProcessCocoa.mm: >+ (WebKit::NetworkProcess::syncAllCookies): >+ * UIProcess/Network/NetworkProcessProxy.cpp: >+ (WebKit::NetworkProcessProxy::setIsSyncingCookies): >+ * UIProcess/Network/NetworkProcessProxy.h: >+ * UIProcess/Network/NetworkProcessProxy.messages.in: >+ * UIProcess/WebProcessPool.cpp: >+ (WebKit::WebProcessPool::syncNetworkProcessCookies): >+ > 2018-04-30 Per Arne Vollan <pvollan@apple.com> > > Use correct runloop type in the WebContent process. >diff --git a/Source/WebCore/platform/network/NetworkStorageSession.cpp b/Source/WebCore/platform/network/NetworkStorageSession.cpp >index 03307a60541ac9ea1f46c5ee81f9029c3d44008e..eed176f1c798896805ea8e2a2eb850013732a789 100644 >--- a/Source/WebCore/platform/network/NetworkStorageSession.cpp >+++ b/Source/WebCore/platform/network/NetworkStorageSession.cpp >@@ -60,6 +60,11 @@ void NetworkStorageSession::forEach(const WTF::Function<void(const WebCore::Netw > functor(*storageSession); > } > >+unsigned NetworkStorageSession::sessionCount() >+{ >+ return globalSessionMap().size() + 1; >+} >+ > bool NetworkStorageSession::processMayUseCookieAPI() > { > return m_processMayUseCookieAPI; >diff --git a/Source/WebCore/platform/network/NetworkStorageSession.h b/Source/WebCore/platform/network/NetworkStorageSession.h >index 2a78644656ccb29a3f68c88a1b06d5d1197f40a6..a0506ae78147d049584e5e25a4d3ccb8c15af0c1 100644 >--- a/Source/WebCore/platform/network/NetworkStorageSession.h >+++ b/Source/WebCore/platform/network/NetworkStorageSession.h >@@ -73,6 +73,7 @@ public: > WEBCORE_EXPORT static void ensureSession(PAL::SessionID, const String& identifierBase = String()); > WEBCORE_EXPORT static void destroySession(PAL::SessionID); > WEBCORE_EXPORT static void forEach(const WTF::Function<void(const WebCore::NetworkStorageSession&)>&); >+ WEBCORE_EXPORT static unsigned sessionCount(); > WEBCORE_EXPORT static void permitProcessToUseCookieAPI(bool); > WEBCORE_EXPORT static bool processMayUseCookieAPI(); > >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.cpp b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >index 3b0ff20185115445ba81e870b4295057d536db90..5e51d1c44c4277a11afb899875e314b875b9e05b 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.cpp >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.cpp >@@ -928,6 +928,11 @@ void NetworkProcess::registerURLSchemeAsCanDisplayOnlyIfCanRequest(const String& > SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest(scheme); > } > >+void NetworkProcess::didSyncAllCookies() const >+{ >+ parentProcessConnection()->send(Messages::NetworkProcessProxy::SetIsSyncingCookies(false), 0); >+} >+ > #if !PLATFORM(COCOA) > void NetworkProcess::initializeProcess(const ChildProcessInitializationParameters&) > { >diff --git a/Source/WebKit/NetworkProcess/NetworkProcess.h b/Source/WebKit/NetworkProcess/NetworkProcess.h >index ce412b459286b369df12cd08f33385ad8c9ddde9..7e0ba15db4ac49687eeae8f1e1760db12962e412 100644 >--- a/Source/WebKit/NetworkProcess/NetworkProcess.h >+++ b/Source/WebKit/NetworkProcess/NetworkProcess.h >@@ -227,6 +227,7 @@ private: > void clearCacheForAllOrigins(uint32_t cachesToClear); > void setAllowsAnySSLCertificateForWebSocket(bool); > void syncAllCookies(); >+ void didSyncAllCookies() const; > > void didGrantSandboxExtensionsToStorageProcessForBlobs(uint64_t requestID); > >@@ -270,6 +271,8 @@ private: > bool m_logCookieInformation { false }; > #endif > >+ uint64_t m_syncingCookiesResultsToCollect { 0 }; >+ > RefPtr<NetworkCache::Cache> m_cache; > > typedef HashMap<const char*, std::unique_ptr<NetworkProcessSupplement>, PtrHash<const char*>> NetworkProcessSupplementMap; >diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm b/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm >index 0f583d8f5a75700108e9d4e5d6191decbd9628e0..100dc2607edddbf07653b24ef5ac600d992746c9 100644 >--- a/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm >+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm >@@ -229,7 +229,19 @@ void NetworkProcess::syncAllCookies() > ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); > #pragma clang diagnostic push > #pragma clang diagnostic ignored "-Wdeprecated-declarations" >- _CFHTTPCookieStorageFlushCookieStores(); >+ m_syncingCookiesResultsToCollect = WebCore::NetworkStorageSession::sessionCount(); >+ >+ auto *resultsToCollectPtr = &m_syncingCookiesResultsToCollect; >+ WebCore::NetworkStorageSession::forEach([&] (const WebCore::NetworkStorageSession& networkStorageSession) { >+ [networkStorageSession.nsCookieStorage() _saveCookies:^{ >+ *resultsToCollectPtr = m_syncingCookiesResultsToCollect - 1; >+ >+#if PLATFORM(IOS) >+ if (!(*resultsToCollectPtr)) >+ didSyncAllCookies(); >+#endif >+ }]; >+ }); > #pragma clang diagnostic pop > } > >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >index 6b3287bf842519b706aae4f80da906a59d47e78e..f03bb80aa2c4ae41172c87149b371169619fa26c 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp >@@ -548,6 +548,16 @@ void NetworkProcessProxy::setIsHoldingLockedFiles(bool isHoldingLockedFiles) > } > } > >+void NetworkProcessProxy::setIsSyncingCookies(bool isSyncingCookies) >+{ >+ if (!isSyncingCookies) { >+ RELEASE_LOG(ProcessSuspension, "%p - NetworkProcessProxy is releasing a background assertion because the Network process is done syncing cookies", this); >+ m_tokenForSyncingCookies = nullptr; >+ return; >+ } >+ RELEASE_LOG(ProcessSuspension, "%p - NetworkProcessProxy is taking a background assertion because the Network process is syncing cookies", this); >+ m_tokenForSyncingCookies = throttler().backgroundActivityToken(); >+} > > #if ENABLE(CONTENT_EXTENSIONS) > void NetworkProcessProxy::contentExtensionRules(UserContentControllerIdentifier identifier) >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >index c9dc792a9b5e07ccfe10529a7e19ae6aba490d97..05bee5ff356cd30b013215d4e28f81b5cc874f33 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h >@@ -92,6 +92,7 @@ public: > void processReadyToSuspend(); > > void setIsHoldingLockedFiles(bool); >+ void setIsSyncingCookies(bool); > > ProcessThrottler& throttler() { return m_throttler; } > WebProcessPool& processPool() { return m_processPool; } >@@ -167,6 +168,7 @@ private: > #endif > ProcessThrottler m_throttler; > ProcessThrottler::BackgroundActivityToken m_tokenForHoldingLockedFiles; >+ ProcessThrottler::BackgroundActivityToken m_tokenForSyncingCookies; > > HashMap<uint64_t, CompletionHandler<void(bool success)>> m_writeBlobToFilePathCallbackMap; > HashMap<uint64_t, WTF::CompletionHandler<void(bool wasGranted)>> m_storageAccessResponseCallbackMap; >diff --git a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in >index 184c2fd5441f8d870436d15b76a4d2dff637286f..49015608230184c4411b12cf5b8bb02b969f363d 100644 >--- a/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in >+++ b/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in >@@ -35,6 +35,8 @@ messages -> NetworkProcessProxy LegacyReceiver { > > ProcessReadyToSuspend() > SetIsHoldingLockedFiles(bool isHoldingLockedFiles) >+ SetIsSyncingCookies(bool isSyncingCookies) >+ > > # Diagnostic messages logging > LogDiagnosticMessage(uint64_t pageID, String message, String description, enum WebCore::ShouldSample shouldSample) >diff --git a/Source/WebKit/UIProcess/WebProcessPool.cpp b/Source/WebKit/UIProcess/WebProcessPool.cpp >index ca548be1dfa657d8ab04162fddd6ccb1e5ae5d7e..3d6ead9c752ed46f2b74c09f078188f937700632 100644 >--- a/Source/WebKit/UIProcess/WebProcessPool.cpp >+++ b/Source/WebKit/UIProcess/WebProcessPool.cpp >@@ -1593,6 +1593,11 @@ void WebProcessPool::terminateServiceWorkerProcesses() > > void WebProcessPool::syncNetworkProcessCookies() > { >+#if PLATFORM(IOS) >+ if (m_tokenForSyncingCookies) >+ return; >+ m_networkprocess->setIsSyncingCookies(true); >+#endif > sendSyncToNetworkingProcess(Messages::NetworkProcess::SyncAllCookies(), Messages::NetworkProcess::SyncAllCookies::Reply()); > } >
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185261
:
339454
|
339782
|
339801
|
339807
|
339825
|
339831
|
339904