Title: [279583] trunk/Source
Revision
279583
Author
cdu...@apple.com
Date
2021-07-06 09:00:16 -0700 (Tue, 06 Jul 2021)

Log Message

Unreviewed, reverting r279495.

Seems to have caused a ~2% PLT5 regression

Reverted changeset:

"[macOS] Suspend WebProcesses that are in the process cache"
https://bugs.webkit.org/show_bug.cgi?id=227269
https://commits.webkit.org/r279495

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (279582 => 279583)


--- trunk/Source/WebCore/ChangeLog	2021-07-06 15:17:41 UTC (rev 279582)
+++ trunk/Source/WebCore/ChangeLog	2021-07-06 16:00:16 UTC (rev 279583)
@@ -1,3 +1,15 @@
+2021-07-06  Chris Dumez  <cdu...@apple.com>
+
+        Unreviewed, reverting r279495.
+
+        Seems to have caused a ~2% PLT5 regression
+
+        Reverted changeset:
+
+        "[macOS] Suspend WebProcesses that are in the process cache"
+        https://bugs.webkit.org/show_bug.cgi?id=227269
+        https://commits.webkit.org/r279495
+
 2021-07-06  Youenn Fablet  <you...@apple.com>
 
         Remove MediaStreamTrack.onconstrainederror

Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.cpp (279582 => 279583)


--- trunk/Source/WebCore/workers/service/context/SWContextManager.cpp	2021-07-06 15:17:41 UTC (rev 279582)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.cpp	2021-07-06 16:00:16 UTC (rev 279583)
@@ -143,11 +143,6 @@
         if (completionHandler)
             completionHandler();
 
-        if (m_pendingServiceWorkerTerminationRequests.isEmpty()) {
-            for (auto& handler : std::exchange(m_whenTerminationRequestsAreDoneHandlers, { }))
-                handler();
-        }
-
         // Spin the runloop before releasing the worker thread proxy, as there would otherwise be
         // a race towards its destruction.
         callOnMainThread([serviceWorker = WTFMove(serviceWorker)] { });
@@ -154,14 +149,6 @@
     });
 }
 
-void SWContextManager::whenTerminationRequestsAreDone(CompletionHandler<void()>&& completionHandler)
-{
-    if (m_pendingServiceWorkerTerminationRequests.isEmpty())
-        return completionHandler();
-
-    m_whenTerminationRequestsAreDoneHandlers.append(WTFMove(completionHandler));
-}
-
 void SWContextManager::forEachServiceWorkerThread(const WTF::Function<void(ServiceWorkerThreadProxy&)>& apply)
 {
     for (auto& workerThread : m_workerMap.values())

Modified: trunk/Source/WebCore/workers/service/context/SWContextManager.h (279582 => 279583)


--- trunk/Source/WebCore/workers/service/context/SWContextManager.h	2021-07-06 15:17:41 UTC (rev 279582)
+++ trunk/Source/WebCore/workers/service/context/SWContextManager.h	2021-07-06 16:00:16 UTC (rev 279583)
@@ -107,8 +107,6 @@
     static constexpr Seconds workerTerminationTimeout { 10_s };
     static constexpr Seconds syncWorkerTerminationTimeout { 100_ms }; // Only used by layout tests.
 
-    WEBCORE_EXPORT void whenTerminationRequestsAreDone(CompletionHandler<void()>&&);
-
 private:
     SWContextManager() = default;
 
@@ -130,7 +128,6 @@
         Timer m_timeoutTimer;
     };
     HashMap<ServiceWorkerIdentifier, std::unique_ptr<ServiceWorkerTerminationRequest>> m_pendingServiceWorkerTerminationRequests;
-    Vector<CompletionHandler<void()>> m_whenTerminationRequestsAreDoneHandlers;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebKit/ChangeLog (279582 => 279583)


--- trunk/Source/WebKit/ChangeLog	2021-07-06 15:17:41 UTC (rev 279582)
+++ trunk/Source/WebKit/ChangeLog	2021-07-06 16:00:16 UTC (rev 279583)
@@ -1,3 +1,15 @@
+2021-07-06  Chris Dumez  <cdu...@apple.com>
+
+        Unreviewed, reverting r279495.
+
+        Seems to have caused a ~2% PLT5 regression
+
+        Reverted changeset:
+
+        "[macOS] Suspend WebProcesses that are in the process cache"
+        https://bugs.webkit.org/show_bug.cgi?id=227269
+        https://commits.webkit.org/r279495
+
 2021-07-06  Alexander Mikhaylenko  <al...@gnome.org>
 
         [GTK4] Navigation swipe doesn't work when the page scrolls horizontally

Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp (279582 => 279583)


--- trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2021-07-06 15:17:41 UTC (rev 279582)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.cpp	2021-07-06 16:00:16 UTC (rev 279583)
@@ -289,14 +289,8 @@
     ASSERT(m_isInProcessCache != value);
     m_isInProcessCache = value;
 
-    if (!m_isInProcessCache)
-        platformResumeProcess();
+    send(Messages::WebProcess::SetIsInProcessCache(m_isInProcessCache), 0);
 
-    sendWithAsyncReply(Messages::WebProcess::SetIsInProcessCache(m_isInProcessCache), [weakThis = makeWeakPtr(*this), isEnteringProcessCache = value]() mutable {
-        if (isEnteringProcessCache && weakThis && weakThis->m_isInProcessCache)
-            weakThis->platformSuspendProcess();
-    });
-
     if (m_isInProcessCache) {
         // WebProcessProxy objects normally keep the process pool alive but we do not want this to be the case
         // for cached processes or it would leak the pool.
@@ -2010,16 +2004,6 @@
     PAL::systemBeep();
 }
 
-#if !PLATFORM(MAC)
-void WebProcessProxy::platformSuspendProcess()
-{
-}
-
-void WebProcessProxy::platformResumeProcess()
-{
-}
-#endif
-
 } // namespace WebKit
 
 #undef MESSAGE_CHECK

Modified: trunk/Source/WebKit/UIProcess/WebProcessProxy.h (279582 => 279583)


--- trunk/Source/WebKit/UIProcess/WebProcessProxy.h	2021-07-06 15:17:41 UTC (rev 279582)
+++ trunk/Source/WebKit/UIProcess/WebProcessProxy.h	2021-07-06 16:00:16 UTC (rev 279583)
@@ -471,9 +471,6 @@
 
     void processDidTerminateOrFailedToLaunch(ProcessTerminationReason);
 
-    void platformSuspendProcess();
-    void platformResumeProcess();
-
     // IPC::Connection::Client
     friend class WebConnectionToWebProcess;
     void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;

Modified: trunk/Source/WebKit/UIProcess/mac/WebProcessProxyMac.mm (279582 => 279583)


--- trunk/Source/WebKit/UIProcess/mac/WebProcessProxyMac.mm	2021-07-06 15:17:41 UTC (rev 279582)
+++ trunk/Source/WebKit/UIProcess/mac/WebProcessProxyMac.mm	2021-07-06 16:00:16 UTC (rev 279583)
@@ -31,7 +31,6 @@
 
 #import "WKFullKeyboardAccessWatcher.h"
 #import <Kernel/kern/cs_blobs.h>
-#import <signal.h>
 #import <wtf/ProcessPrivilege.h>
 #import <wtf/spi/cocoa/SecuritySPI.h>
 
@@ -79,24 +78,6 @@
     processPool().setDisplayLinkPreferredFramesPerSecond(*connection(), observerID, displayID, preferredFramesPerSecond);
 }
 
-void WebProcessProxy::platformSuspendProcess()
-{
-    RELEASE_LOG(Process, "%p - [PID=%i] WebProcessProxy::platformSuspendProcess", this, processIdentifier());
-    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-    if (auto* connection = this->connection())
-        xpc_connection_kill(connection->xpcConnection(), SIGSTOP);
-    ALLOW_DEPRECATED_DECLARATIONS_END
-}
-
-void WebProcessProxy::platformResumeProcess()
-{
-    RELEASE_LOG(Process, "%p - [PID=%i] WebProcessProxy::platformResumeProcess", this, processIdentifier());
-    ALLOW_DEPRECATED_DECLARATIONS_BEGIN
-    if (auto* connection = this->connection())
-        xpc_connection_kill(connection->xpcConnection(), SIGCONT);
-    ALLOW_DEPRECATED_DECLARATIONS_END
-}
-
 } // namespace WebKit
 
 #endif // PLATFORM(MAC)

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (279582 => 279583)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-07-06 15:17:41 UTC (rev 279582)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2021-07-06 16:00:16 UTC (rev 279583)
@@ -614,7 +614,7 @@
     m_hasSuspendedPageProxy = hasSuspendedPageProxy;
 }
 
-void WebProcess::setIsInProcessCache(bool isInProcessCache, CompletionHandler<void()>&& completionHandler)
+void WebProcess::setIsInProcessCache(bool isInProcessCache)
 {
 #if PLATFORM(COCOA)
     if (isInProcessCache) {
@@ -629,18 +629,6 @@
 #else
     UNUSED_PARAM(isInProcessCache);
 #endif
-
-#if ENABLE(SERVICE_WORKER)
-    if (isInProcessCache) {
-        // When calling the completion handler, the parent process may suspend us. We do not want to get suspended until pending requests to
-        // stop service workers are processed because this would be wasteful from a memory standpoint. Also, service worker termination
-        // requests have a timeout and this timeout would be reached if we suspended while it is being processed.
-        SWContextManager::singleton().whenTerminationRequestsAreDone(WTFMove(completionHandler));
-        return;
-    }
-#endif
-
-    completionHandler();
 }
 
 void WebProcess::markIsNoLongerPrewarmed()

Modified: trunk/Source/WebKit/WebProcess/WebProcess.h (279582 => 279583)


--- trunk/Source/WebKit/WebProcess/WebProcess.h	2021-07-06 15:17:41 UTC (rev 279582)
+++ trunk/Source/WebKit/WebProcess/WebProcess.h	2021-07-06 16:00:16 UTC (rev 279583)
@@ -420,7 +420,7 @@
     void platformTerminate();
 
     void setHasSuspendedPageProxy(bool);
-    void setIsInProcessCache(bool, CompletionHandler<void()>&&);
+    void setIsInProcessCache(bool);
     void markIsNoLongerPrewarmed();
 
     void registerURLSchemeAsEmptyDocument(const String&);

Modified: trunk/Source/WebKit/WebProcess/WebProcess.messages.in (279582 => 279583)


--- trunk/Source/WebKit/WebProcess/WebProcess.messages.in	2021-07-06 15:17:41 UTC (rev 279582)
+++ trunk/Source/WebKit/WebProcess/WebProcess.messages.in	2021-07-06 16:00:16 UTC (rev 279583)
@@ -105,7 +105,7 @@
 #endif
 
     SetHasSuspendedPageProxy(bool hasSuspendedPageProxy);
-    SetIsInProcessCache(bool isInProcessCache) -> () Async
+    SetIsInProcessCache(bool isInProcessCache)
     MarkIsNoLongerPrewarmed()
     GetActivePagesOriginsForTesting() -> (Vector<String> activeOrigins) Async
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to