Changeset 269934 in webkit


Ignore:
Timestamp:
Nov 17, 2020 4:36:12 PM (3 years ago)
Author:
Chris Dumez
Message:

Make sure ProcessThrottler is always holding a ProcessAssertion for its child process
https://bugs.webkit.org/show_bug.cgi?id=219053

Reviewed by Geoff Garen.

Make sure ProcessThrottler is always holding a ProcessAssertion for its child process. Previously, when changing the assertion
type (e.g. when going from background to foreground) we would release the previous assertion and then take the new one.

RunningBoard developers recommend that we wait until the new ProcessAssertion is taken before we release the previous one to
avoid churn. It is also important we always hold a ProcessAssertion at all times for the child process because the child process
may exit otherwise.

  • UIProcess/ProcessThrottler.cpp:

(WebKit::ProcessThrottler::setAssertionType):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r269928 r269934  
     12020-11-17  Chris Dumez  <cdumez@apple.com>
     2
     3        Make sure ProcessThrottler is always holding a ProcessAssertion for its child process
     4        https://bugs.webkit.org/show_bug.cgi?id=219053
     5
     6        Reviewed by Geoff Garen.
     7
     8        Make sure ProcessThrottler is always holding a ProcessAssertion for its child process. Previously, when changing the assertion
     9        type (e.g. when going from background to foreground) we would release the previous assertion and then take the new one.
     10
     11        RunningBoard developers recommend that we wait until the new ProcessAssertion is taken before we release the previous one to
     12        avoid churn. It is also important we always hold a ProcessAssertion at all times for the child process because the child process
     13        may exit otherwise.
     14
     15        * UIProcess/ProcessThrottler.cpp:
     16        (WebKit::ProcessThrottler::setAssertionType):
     17
    1182020-11-17  Chris Dumez  <cdumez@apple.com>
    219
  • trunk/Source/WebKit/UIProcess/ProcessThrottler.cpp

    r265162 r269934  
    128128
    129129    PROCESSTHROTTLER_RELEASE_LOG("setAssertionType: Updating process assertion type to %u (foregroundActivities: %u, backgroundActivities: %u)", newType, m_foregroundActivities.size(), m_backgroundActivities.size());
     130
     131    // Keep the previous assertion around until after the new one has been created so that we always hold
     132    // a process assertion for the process.
     133    auto previousAssertion = std::exchange(m_assertion, nullptr);
    130134    if (m_shouldTakeUIBackgroundAssertion) {
    131135        auto assertion = makeUnique<ProcessAndUIAssertion>(m_processIdentifier, assertionName(newType), newType);
Note: See TracChangeset for help on using the changeset viewer.