Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c53a7f951fa09d02d7695f80611ea2118fdcb53e
      
https://github.com/WebKit/WebKit/commit/c53a7f951fa09d02d7695f80611ea2118fdcb53e
  Author: Rupin Mittal <[email protected]>
  Date:   2026-04-27 (Mon, 27 Apr 2026)

  Changed paths:
    M Source/WebKit/UIProcess/Cocoa/ProcessAssertionCocoa.mm
    M Source/WebKit/UIProcess/ProcessAssertion.h
    M Tools/Scripts/webkitpy/style/checkers/cpp.py

  Log Message:
  -----------
  Create WKRBSAssertion subclass of RBSAssertion to prevent missing invalidate 
calls
https://bugs.webkit.org/show_bug.cgi?id=313382
rdar://175648970

Reviewed by Ben Nham.

RunningBoardServices requires that the client invalidate the RBSAssertion before
it is deallocated. This is subtle and easy to miss. The consequence of 
forgetting
to call invalidate is a crash. Recently, we had to fix such a crash that was
affecting users: https://commits.webkit.org/311649@main.

To prevent us from having to remember to always call invalidate and possibly
forgetting, we create a subclass WKRBSAssertion which automatically calls
invalidate before deallocation.

WebKit code should never allocate an RBSAssertion directly. It should only use
WKRBSAssertion.

We amend all parts of the codebase that currently create an RBSAssertion to use
this WKRBSAssertion instead. We remove explicit calls to invalidate since they
are no longer needed.

We also modify the style checker to ensure that no new code will directly create
an RBSAssertion.

There is no behavior change.

* Source/WebKit/UIProcess/Cocoa/ProcessAssertionCocoa.mm:
(-[WKRBSAssertion dealloc]):
(-[WKProcessAssertionBackgroundTaskManager _updateBackgroundTask]):
(-[WKProcessAssertionBackgroundTaskManager _releaseBackgroundTask]):
(WebKit::ProcessAssertion::init):
(WebKit::ProcessAssertion::~ProcessAssertion):
* Source/WebKit/UIProcess/ProcessAssertion.h:
* Tools/Scripts/webkitpy/style/checkers/cpp.py:
(check_rbs_assertion):
(process_line):
(CppChecker):

Canonical link: https://commits.webkit.org/312175@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to