Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 75c66e5982a9258fa7019336c884473a1cabf393
      
https://github.com/WebKit/WebKit/commit/75c66e5982a9258fa7019336c884473a1cabf393
  Author: Chris Dumez <[email protected]>
  Date:   2026-07-24 (Fri, 24 Jul 2026)

  Changed paths:
    M Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm
    M Source/WebKit/UIProcess/WebProcessProxy.h

  Log Message:
  -----------
  WebProcessProxy::cacheMediaMIMETypes never broadcasts cached types to other 
web processes
https://bugs.webkit.org/show_bug.cgi?id=320070

Reviewed by Jean-Yves Avenard.

When a web process lazily computes the supported media MIME types (by loading
AVFoundation and querying [AVURLAsset audiovisualMIMETypes]), it reports them
back to the UI process via CacheMediaMIMETypes. The UI process caches them in a
process-global and is supposed to push them to every other existing web process
(via SetMediaMIMETypes) so those processes can avoid recomputing them.

This broadcast was broken in two ways, both present since the machinery was
introduced in 201372@main (2018):

  1. cacheMediaMIMETypes() iterated over the other processes but called
     cacheMediaMIMETypesInternal(types) on `this` rather than on the loop
     variable `process`, so the message would have targeted the wrong process.

  2. Even ignoring (1), cacheMediaMIMETypesInternal() guarded on
     `!mediaTypeCache().isEmpty()` and returned early. Since mediaTypeCache() is
     a UI-process global that cacheMediaMIMETypes() populates before the loop,
     that guard was always true by the time the helper ran, so the
     SetMediaMIMETypes IPC was never sent to any process.

The net effect was that already-running web processes never received the cached
types over IPC and had to recompute them independently on first use.

Fix this by inlining the broadcast into the loop so it sends SetMediaMIMETypes
directly to each peer process, and remove the now-unused
cacheMediaMIMETypesInternal() helper.

Note that the practical value of this broadcast is limited today:

  - New web processes were never affected: they already receive the cached types
    at launch via WebProcessCreationParameters (WebProcessPoolCocoa.mm), which
    seeds both AVAssetMIMETypeCache and RemoteMediaPlayerMIMETypeCache. That leg
    has always worked; only the broadcast to already-running peers was broken.

  - Since media playback moved to the GPU process (205763@main), the WebProcess
    no longer loads AVFoundation for playback type queries; those go through
    RemoteMediaPlayerMIMETypeCache to the GPU process instead. The original
    rationale (avoid loading AVFoundation in every web process) now mostly
    applies to the non-GPU-process fallback path and to RemoteImageDecoderAVF,
    which still consults AVAssetMIMETypeCache locally (see the TODOs there about
    removing that dependency).

So the concrete benefit is narrow: a long-lived, already-running web process
that later hits one of the remaining local AVAssetMIMETypeCache consumers avoids
an AVFoundation load, and its RemoteMediaPlayerMIMETypeCache avoids a sync IPC 
to
the GPU process. If RemoteImageDecoderAVF is eventually routed through the GPU
process, this whole broadcast/cache chain could be removed outright (modulo the
non-GPU-process fallback).

* Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::cacheMediaMIMETypes):
(WebKit::WebProcessProxy::cacheMediaMIMETypesInternal): Deleted.
* Source/WebKit/UIProcess/WebProcessProxy.h:

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



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

Reply via email to