Bug 234328 - Twitter scroll stutter: ensure that CA backing store is always deallocated on the main thread
Summary: Twitter scroll stutter: ensure that CA backing store is always deallocated on...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Scrolling (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-12-14 17:54 PST by Simon Fraser (smfr)
Modified: 2021-12-15 14:32 PST (History)
9 users (show)

See Also:


Attachments
Patch (25.17 KB, patch)
2021-12-14 17:59 PST, Simon Fraser (smfr)
thorton: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (25.18 KB, patch)
2021-12-14 21:20 PST, Simon Fraser (smfr)
ews-feeder: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2021-12-14 17:54:18 PST
Twitter scroll stutter: ensure that CA backing store is always deallocated on the main thread
Comment 1 Simon Fraser (smfr) 2021-12-14 17:59:45 PST
Created attachment 447186 [details]
Patch
Comment 2 Simon Fraser (smfr) 2021-12-14 17:59:49 PST
<rdar://problem/85892959>
Comment 3 Tim Horton 2021-12-14 19:45:00 PST
Comment on attachment 447186 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=447186&action=review

Not the least frightening patch I've ever seen.

> Source/WebCore/WebCore.xcodeproj/project.pbxproj:-33104
> -				7B582DD82716F55B004B92D0 /* (null) in Headers */,

This seems bad

> Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerContentsDelayedReleaser.mm:82
> +            RunLoop::main().dispatch([] {

Isn't it the scrolling thread runloop you're racing here (freeing the transaction), not the main thread?
Comment 4 Simon Fraser (smfr) 2021-12-14 20:09:44 PST
Comment on attachment 447186 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=447186&action=review

>> Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerContentsDelayedReleaser.mm:82
>> +            RunLoop::main().dispatch([] {
> 
> Isn't it the scrolling thread runloop you're racing here (freeing the transaction), not the main thread?

Probably, but we know we've exited the scrolling thread transaction (tho it may still be in the teardown phase), and we have a dispatch here so it should almost always win. I never saw us lose the race in practice. If we do, it's not the end of the world.
Comment 5 Simon Fraser (smfr) 2021-12-14 21:20:00 PST
Created attachment 447201 [details]
Patch
Comment 6 EWS 2021-12-15 09:47:18 PST
Committed r287079 (?): <https://commits.webkit.org/r287079>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 447201 [details].