[webkit-changes] [WebKit/WebKit] 373d03: [UI-side compositing] Lock CALayer tree for scroll...

Simon Fraser noreply at github.com
Sat Mar 11 17:12:04 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 373d0328adcf7b2d3cdde3e8af721be38f8341e7
      https://github.com/WebKit/WebKit/commit/373d0328adcf7b2d3cdde3e8af721be38f8341e7
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2023-03-11 (Sat, 11 Mar 2023)

  Changed paths:
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.h
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm

  Log Message:
  -----------
  [UI-side compositing] Lock CALayer tree for scrolling thread hit-testing
https://bugs.webkit.org/show_bug.cgi?id=253011
rdar://105987016

Reviewed by Tim Horton.

Off-main-thread scrolling in the UI process on macOS traverses the layer tree
to find scrolling tree nodes, and consult event regions. If this tree is being
mutated on the main thread at the same time, we can crash.

So lock around the layer tree commit on the main thread in RemoteLayerTreeDrawingAreaProxy::commitLayerTree(),
and in RemoteLayerTreeEventDispatcher::determineWheelEventProcessing() on the scrolling thread, using
a lock owned by RemoteScrollingTreeMac.

This is similar to what ThreadedScrollingTree does with web process scrolling.

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
(WebKit::RemoteScrollingCoordinatorProxy::willCommitLayerAndScrollingTrees):
(WebKit::RemoteScrollingCoordinatorProxy::didCommitLayerAndScrollingTrees):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.h:
(WebKit::RemoteLayerTreeHitTestLocker::RemoteLayerTreeHitTestLocker):
(WebKit::RemoteLayerTreeHitTestLocker::~RemoteLayerTreeHitTestLocker):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.cpp:
(WebKit::RemoteLayerTreeEventDispatcher::determineWheelEventProcessing):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h:
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm:
(WebKit::RemoteScrollingCoordinatorProxyMac::willCommitLayerAndScrollingTrees):
(WebKit::RemoteScrollingCoordinatorProxyMac::didCommitLayerAndScrollingTrees):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.h:
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm:
(WebKit::RemoteScrollingTreeMac::lockLayersForHitTesting):
(WebKit::RemoteScrollingTreeMac::unlockLayersForHitTesting):
(WebKit::RemoteScrollingTreeMac::scrollingNodeForPoint):
(WebKit::RemoteScrollingTreeMac::eventListenerRegionTypesForPoint const):

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




More information about the webkit-changes mailing list