Title: [230918] trunk/Source/WebKit
Revision
230918
Author
[email protected]
Date
2018-04-23 13:29:36 -0700 (Mon, 23 Apr 2018)

Log Message

WebProcessProxy frequently re-takes a process assertion for the network process even though is already has one
https://bugs.webkit.org/show_bug.cgi?id=184889
<rdar://problem/38151530>

Reviewed by Brady Eidson.

In ProcessThrottler::updateAssertionNow(), if the new process assertion state is the same
as the existing one, then return early. Otherwise, we would end up calling WebProcessProxy::didSetAssertionState()
for the same assertion state, which would cause duplicate logging but also some unnecessary work.

* UIProcess/ProcessThrottler.cpp:
(WebKit::ProcessThrottler::updateAssertionNow):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (230917 => 230918)


--- trunk/Source/WebKit/ChangeLog	2018-04-23 20:27:15 UTC (rev 230917)
+++ trunk/Source/WebKit/ChangeLog	2018-04-23 20:29:36 UTC (rev 230918)
@@ -1,3 +1,18 @@
+2018-04-23  Chris Dumez  <[email protected]>
+
+        WebProcessProxy frequently re-takes a process assertion for the network process even though is already has one
+        https://bugs.webkit.org/show_bug.cgi?id=184889
+        <rdar://problem/38151530>
+
+        Reviewed by Brady Eidson.
+
+        In ProcessThrottler::updateAssertionNow(), if the new process assertion state is the same
+        as the existing one, then return early. Otherwise, we would end up calling WebProcessProxy::didSetAssertionState()
+        for the same assertion state, which would cause duplicate logging but also some unnecessary work.
+
+        * UIProcess/ProcessThrottler.cpp:
+        (WebKit::ProcessThrottler::updateAssertionNow):
+
 2018-04-23  Zan Dobersek  <[email protected]>
 
         [CoordGraphics] Remove unused trajectory cruft in CoordinatedLayerTreeHost, CoordinatedGraphicsLayer

Modified: trunk/Source/WebKit/UIProcess/ProcessThrottler.cpp (230917 => 230918)


--- trunk/Source/WebKit/UIProcess/ProcessThrottler.cpp	2018-04-23 20:27:15 UTC (rev 230917)
+++ trunk/Source/WebKit/UIProcess/ProcessThrottler.cpp	2018-04-23 20:29:36 UTC (rev 230918)
@@ -57,10 +57,12 @@
 {
     m_suspendTimer.stop();
     if (m_assertion) {
-        if (m_assertion->state() != assertionState())
-            RELEASE_LOG(ProcessSuspension, "%p - ProcessThrottler::updateAssertionNow() updating process assertion state to %u (foregroundActivities: %lu, backgroundActivities: %lu)", this, assertionState(), m_foregroundCounter.value(), m_backgroundCounter.value());
-        m_assertion->setState(assertionState());
-        m_process.didSetAssertionState(assertionState());
+        auto newState = assertionState();
+        if (m_assertion->state() == newState)
+            return;
+        RELEASE_LOG(ProcessSuspension, "%p - ProcessThrottler::updateAssertionNow() updating process assertion state to %u (foregroundActivities: %lu, backgroundActivities: %lu)", this, newState, m_foregroundCounter.value(), m_backgroundCounter.value());
+        m_assertion->setState(newState);
+        m_process.didSetAssertionState(newState);
     }
 }
     
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to