Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 357ab70819c4a640f26f83a620ec2683fcccaade
      
https://github.com/WebKit/WebKit/commit/357ab70819c4a640f26f83a620ec2683fcccaade
  Author: Ben Nham <[email protected]>
  Date:   2026-06-17 (Wed, 17 Jun 2026)

  Changed paths:
    M Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebProcessPool.cpp
    M Source/WebKit/UIProcess/WebProcessPool.h
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm

  Log Message:
  -----------
  Debounce screen properties changed notifications
https://bugs.webkit.org/show_bug.cgi?id=317278
rdar://177875932

Reviewed by Mike Wyrzykowski.

314702@main debounced ScreenPropertiesDidChange IPC messages. However, we've 
gotten more logs and it
now seems that not only are we sending excessive number of IPCs, but the time 
spent in the screen
properties changed notification handler is also excessive. For instance, some 
part of
`collectScreenProperties` involves sync IPCs to WindowServer, so calling that 
too often can affect
the responsiveness of the UIProcess's main thread.

Fix this by moving the debouncing up one level. Previously we were debouncing 
only IPC sends. Now we
are debouncing screen properties changed notification handler (which as a side 
effect, also
debounces IPC sends since that is downstream of the screen properties changed 
notification).

Other related in changes in the patch:

1. The debouncing interval is configurable via a pref and arbitrarily defaults 
to 250 ms.

2. I removed the excessive update logging introduced in 314702@main as it made 
the code more
   complicated to maintain.

3. Both `displayPropertiesChanged` and `screenPropertiesChanged` are debounced, 
and
   `displayPropertiesChanged` now updates the suppressEDR property on the 
screen properties
   object. Previously, only `screenPropertiesChanged` updated the suppressEDR 
property. In talking
   to others, this just seemed like an oversight.

* Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::registerNotificationObservers):
(WebKit::WebProcessPool::screenPropertiesUpdateTimerFired):
(WebKit::WebProcessPool::screenPropertiesChanged):
(WebKit::WebProcessPool::displayPropertiesChanged):
(WebKit::displayReconfigurationCallBack):
(WebKit::webProcessPoolHighDynamicRangeDidChangeCallback):
(WebKit::WebProcessPool::registerHighDynamicRangeChangeCallback):
(WebKit::WebProcessPool::didRefreshDisplay):
(WebKit::WebProcessPool::suppressEDR):
(WebKit::WebProcessPool::sendScreenPropertiesChangedToAllProcesses): Deleted.
(WebKit::WebProcessPool::logScreenPropertiesUpdateReasonsTimerFired): Deleted.
(WebKit::WebProcessPool::dispatchScreenPropertiesChangedToAllProcesses): 
Deleted.
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::accessibilitySettingsDidChange):
* Source/WebKit/UIProcess/WebProcessPool.cpp:
* Source/WebKit/UIProcess/WebProcessPool.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::screenDidChangeColorSpace):

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



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

Reply via email to