[webkit-changes] [WebKit/WebKit] 805716: HTMLMediaElement::player() shouldn't return a RefPtr

Chris Dumez noreply at github.com
Tue Feb 13 19:40:35 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 805716af78821a5f5946c1acd31d2466bfeed080
      https://github.com/WebKit/WebKit/commit/805716af78821a5f5946c1acd31d2466bfeed080
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2024-02-13 (Tue, 13 Feb 2024)

  Changed paths:
    M Source/WebCore/Modules/WebGPU/GPUQueue.cpp
    M Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp
    M Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp
    M Source/WebCore/Modules/webcodecs/WebCodecsVideoFrame.cpp
    M Source/WebCore/html/HTMLMediaElement.h
    M Source/WebCore/html/HTMLVideoElement.cpp
    M Source/WebCore/html/MediaElementSession.cpp
    M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
    M Source/WebCore/page/CaptionUserPreferences.cpp
    M Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.mm
    M Source/WebCore/rendering/RenderVideo.cpp
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.mm
    M Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm

  Log Message:
  -----------
  HTMLMediaElement::player() shouldn't return a RefPtr
https://bugs.webkit.org/show_bug.cgi?id=269334

Reviewed by Ryosuke Niwa.

HTMLMediaElement::player() shouldn't return a RefPtr as it causes unnecessary
ref-counting churn for call sites that don't need it. Instead, follow the usual
pattern:
1. Have HTMLMediaElement::player() return a raw pointer
2. Introduce a HTMLMediaElement::protectedPlayer() which returns a RefPtr for
   the call sites that need a RefPtr

* Source/WebCore/Modules/WebGPU/GPUQueue.cpp:
(WebCore::imageBytesForSource):
* Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp:
(WebCore::WebKitMediaKeys::setMediaElement):
* Source/WebCore/Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::externalDeviceDisplayName const):
(WebCore::MediaControlsHost::externalDeviceType const):
* Source/WebCore/Modules/webcodecs/WebCodecsVideoFrame.cpp:
(WebCore::WebCodecsVideoFrame::create):
* Source/WebCore/html/HTMLMediaElement.h:
(WebCore::HTMLMediaElement::player const):
(WebCore::HTMLMediaElement::protectedPlayer const):
* Source/WebCore/html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::mediaPlayerFirstVideoFrameAvailable):
(WebCore::HTMLVideoElement::colorSpace const):
(WebCore::HTMLVideoElement::paintCurrentFrameInContext):
(WebCore::HTMLVideoElement::nativeImageForCurrentTime):
(WebCore::HTMLVideoElement::requestVideoFrameCallback):
(WebCore::HTMLVideoElement::cancelVideoFrameCallback):
(WebCore::HTMLVideoElement::serviceRequestVideoFrameCallbacks):
(WebCore::HTMLVideoElement::mediaPlayerEngineUpdated):
* Source/WebCore/html/MediaElementSession.cpp:
(WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const):
(WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::size):
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::texImageSource):
* Source/WebCore/page/CaptionUserPreferences.cpp:
(WebCore::CaptionUserPreferences::textTrackSelectionScore const):
* Source/WebCore/platform/cocoa/VideoPresentationModelVideoElement.mm:
(WebCore::VideoPresentationModelVideoElement::updateForEventName):
* Source/WebCore/rendering/RenderVideo.cpp:
(WebCore::RenderVideo::willBeDestroyed):
(WebCore::RenderVideo::calculateIntrinsicSizeInternal):
(WebCore::RenderVideo::videoBox const):
(WebCore::RenderVideo::paintReplaced):
(WebCore::RenderVideo::updatePlayer):
(WebCore::RenderVideo::acceleratedRenderingStateChanged):
(WebCore::RenderVideo::requiresImmediateCompositing const):
(WebCore::RenderVideo::foregroundIsKnownToBeOpaqueInRect const):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::simulateAudioInterruption):
(WebCore::Internals::beginSimulatedHDCPError):
(WebCore::Internals::endSimulatedHDCPError):
(WebCore::Internals::isPlayerVisibleInViewport const):
(WebCore::Internals::isPlayerMuted const):
(WebCore::Internals::isPlayerPaused const):
* Source/WebCore/testing/Internals.mm:
(WebCore::Internals::privatePlayerVolume):
(WebCore::Internals::privatePlayerMuted):
* Source/WebKit/WebProcess/GPU/media/RemoteMediaPlayerManager.cpp:
(WebKit::RemoteMediaPlayerManager::gpuProcessConnectionDidClose):
* Source/WebKit/WebProcess/cocoa/VideoPresentationManager.mm:
(WebKit::VideoPresentationManager::enterVideoFullscreenForVideoElement):

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




More information about the webkit-changes mailing list