Skip to content

Commit

Permalink
Cherry-pick 256bf3a. rdar://problem/108805025
Browse files Browse the repository at this point in the history
    Use the XPCConnectionTerminationWatchdog on macOS too
    https://bugs.webkit.org/show_bug.cgi?id=256096

    Reviewed by Ben Nham.

    Use the XPCConnectionTerminationWatchdog on macOS too now that process
    suspension is no longer specific to iOS.

    * Source/WebKit/UIProcess/Cocoa/AuxiliaryProcessProxyCocoa.mm:
    (WebKit::AuxiliaryProcessProxy::platformStartConnectionTerminationWatchdog):
    * Source/WebKit/UIProcess/Cocoa/XPCConnectionTerminationWatchdog.h:
    * Source/WebKit/UIProcess/Cocoa/XPCConnectionTerminationWatchdog.mm:
    (WebKit::XPCConnectionTerminationWatchdog::XPCConnectionTerminationWatchdog):

    Canonical link: https://commits.webkit.org/263514@main
Identifier: 259548.859@safari-7615-branch
  • Loading branch information
cdumez authored and MyahCobbs committed Jun 28, 2023
1 parent 9ec0db8 commit bb38f11
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Source/WebKit/UIProcess/Cocoa/AuxiliaryProcessProxyCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#import <WebCore/WebMAudioUtilitiesCocoa.h>
#import <wtf/cocoa/VectorCocoa.h>

#if PLATFORM(IOS_FAMILY)
#if USE(RUNNINGBOARD)
#include "XPCConnectionTerminationWatchdog.h"
#endif

Expand Down Expand Up @@ -65,8 +65,8 @@

void AuxiliaryProcessProxy::platformStartConnectionTerminationWatchdog()
{
#if PLATFORM(IOS_FAMILY)
// On iOS deploy a watchdog in the UI process, since the child process may be suspended.
#if USE(RUNNINGBOARD)
// Deploy a watchdog in the UI process, since the child process may be suspended.
// If 30s is insufficient for any outstanding activity to complete cleanly, then it will be killed.
ASSERT(m_connection && m_connection->xpcConnection());
XPCConnectionTerminationWatchdog::startConnectionTerminationWatchdog(m_connection->xpcConnection(), 30_s);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ class XPCConnectionTerminationWatchdog {

OSObjectPtr<xpc_connection_t> m_xpcConnection;
RunLoop::Timer m_watchdogTimer;
#if PLATFORM(IOS_FAMILY)
Ref<ProcessAndUIAssertion> m_assertion;
#endif
};

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@
#import "config.h"
#import "XPCConnectionTerminationWatchdog.h"

#import "XPCUtilities.h"

#if PLATFORM(IOS_FAMILY)
#import "ProcessAssertion.h"
#endif
#import "XPCUtilities.h"

namespace WebKit {

Expand All @@ -42,9 +39,7 @@
XPCConnectionTerminationWatchdog::XPCConnectionTerminationWatchdog(OSObjectPtr<xpc_connection_t>&& xpcConnection, Seconds interval)
: m_xpcConnection(WTFMove(xpcConnection))
, m_watchdogTimer(RunLoop::main(), this, &XPCConnectionTerminationWatchdog::watchdogTimerFired)
#if PLATFORM(IOS_FAMILY)
, m_assertion(ProcessAndUIAssertion::create(xpc_connection_get_pid(m_xpcConnection.get()), "XPCConnectionTerminationWatchdog"_s, ProcessAssertionType::Background))
#endif
{
m_watchdogTimer.startOneShot(interval);
}
Expand Down

0 comments on commit bb38f11

Please sign in to comment.