Title: [286604] trunk/Source/WebKit
Revision
286604
Author
[email protected]
Date
2021-12-07 12:11:07 -0800 (Tue, 07 Dec 2021)

Log Message

Make WebLockRegistryProxy::processDidExit() return early if process never registered any locks
https://bugs.webkit.org/show_bug.cgi?id=233832

Reviewed by Darin Adler.

Make WebLockRegistryProxy::processDidExit() return early if process never registered any locks.
This avoids calling LocalWebLockRegistry::clientsAreGoingAway() (which can be expensive) in the
case we know for sure no locks were registered by this process.

* UIProcess/WebLockRegistryProxy.cpp:
(WebKit::WebLockRegistryProxy::requestLock):
(WebKit::WebLockRegistryProxy::processDidExit):
* UIProcess/WebLockRegistryProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (286603 => 286604)


--- trunk/Source/WebKit/ChangeLog	2021-12-07 19:51:36 UTC (rev 286603)
+++ trunk/Source/WebKit/ChangeLog	2021-12-07 20:11:07 UTC (rev 286604)
@@ -1,5 +1,21 @@
 2021-12-07  Chris Dumez  <[email protected]>
 
+        Make WebLockRegistryProxy::processDidExit() return early if process never registered any locks
+        https://bugs.webkit.org/show_bug.cgi?id=233832
+
+        Reviewed by Darin Adler.
+
+        Make WebLockRegistryProxy::processDidExit() return early if process never registered any locks.
+        This avoids calling LocalWebLockRegistry::clientsAreGoingAway() (which can be expensive) in the
+        case we know for sure no locks were registered by this process.
+
+        * UIProcess/WebLockRegistryProxy.cpp:
+        (WebKit::WebLockRegistryProxy::requestLock):
+        (WebKit::WebLockRegistryProxy::processDidExit):
+        * UIProcess/WebLockRegistryProxy.h:
+
+2021-12-07  Chris Dumez  <[email protected]>
+
         Reload web views when toggling the captive portal mode at system level
         https://bugs.webkit.org/show_bug.cgi?id=233900
 

Modified: trunk/Source/WebKit/UIProcess/WebLockRegistryProxy.cpp (286603 => 286604)


--- trunk/Source/WebKit/UIProcess/WebLockRegistryProxy.cpp	2021-12-07 19:51:36 UTC (rev 286603)
+++ trunk/Source/WebKit/UIProcess/WebLockRegistryProxy.cpp	2021-12-07 20:11:07 UTC (rev 286604)
@@ -53,6 +53,7 @@
 {
     MESSAGE_CHECK(lockIdentifier.processIdentifier() == m_process.coreProcessIdentifier());
     MESSAGE_CHECK(clientID.processIdentifier() == m_process.coreProcessIdentifier());
+    m_hasEverRequestedLocks = true;
 
     m_process.websiteDataStore().webLockRegistry().requestLock(WTFMove(clientOrigin), lockIdentifier, clientID, WTFMove(name), lockMode, steal, ifAvailable, [weakThis = WeakPtr { *this }, lockIdentifier, clientID](bool success) {
         if (weakThis)
@@ -90,7 +91,8 @@
 
 void WebLockRegistryProxy::processDidExit()
 {
-    m_process.websiteDataStore().webLockRegistry().clientsAreGoingAway(m_process.coreProcessIdentifier());
+    if (m_hasEverRequestedLocks)
+        m_process.websiteDataStore().webLockRegistry().clientsAreGoingAway(m_process.coreProcessIdentifier());
 }
 
 #undef MESSAGE_CHECK

Modified: trunk/Source/WebKit/UIProcess/WebLockRegistryProxy.h (286603 => 286604)


--- trunk/Source/WebKit/UIProcess/WebLockRegistryProxy.h	2021-12-07 19:51:36 UTC (rev 286603)
+++ trunk/Source/WebKit/UIProcess/WebLockRegistryProxy.h	2021-12-07 20:11:07 UTC (rev 286604)
@@ -57,6 +57,7 @@
     void clientIsGoingAway(WebCore::ClientOrigin&&, WebCore::ScriptExecutionContextIdentifier);
 
     WebProcessProxy& m_process;
+    bool m_hasEverRequestedLocks { false };
 };
 
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to