Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: abc95c76eb7c76745bf91399fc658080d19ee4cb
      
https://github.com/WebKit/WebKit/commit/abc95c76eb7c76745bf91399fc658080d19ee4cb
  Author: Aleksei Marchenko <[email protected]>
  Date:   2026-06-29 (Mon, 29 Jun 2026)

  Changed paths:
    M Source/WebCore/Modules/model-element/ModelPlayer.h
    M Source/WebKit/ModelProcess/cocoa/ModelProcessModelPlayerProxy.mm

  Log Message:
  -----------
  Convert models off the main thread in the model process
https://bugs.webkit.org/show_bug.cgi?id=316954
rdar://170323515

Reviewed by Mike Wyrzykowski.

WKUSDStageConverter::convert() is a synchronous, CPU-heavy transform run
inline on the model process's main queue. That process is multi-tenant, so
one conversion stalls interaction for every <model> in every tab.

Move convert() onto a serial background WorkQueue owned by
RKUSDModelLoadScheduler, handing the data off as a SharedBuffer so even the
NSData copy happens off-main. Serial (not parallel) keeps at most one USD
stage materialized at once, since several would risk a jetsam.

Each conversion holds a ThreadSafeWeakPtr to its player: the worker skips
the convert, and the main thread skips delivery, if the <model> was
unloaded -- destruction is the cancellation signal, no explicit handle.
Resolving that weak ref off-main could drop the player's last reference on
the WorkQueue, running ~ModelProcessModelPlayerProxy() (RealityKit
teardown) off the main thread; ModelPlayer is pinned to
WTF::DestructionThread::Main so the final destruction hops back to main.

* Source/WebCore/Modules/model-element/ModelPlayer.h:
* Source/WebKit/ModelProcess/cocoa/ModelProcessModelPlayerProxy.mm:
(WebKit::RKUSDModelLoadScheduler::scheduleModelConversion):
(WebKit::RKUSDModelLoadScheduler::loadNextModel):
(WebKit::ModelProcessModelPlayerProxy::loadModel):

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



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

Reply via email to