Skip to content

Commit

Permalink
VideoFullscreenModelContext::m_manager should be a WeakPtr
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=261218
rdar://115069669

Reviewed by Jer Noble.

Changed VideoFullscreenModelContext::m_manager from a VideoFullscreenManagerProxy* to a
WeakPtr<VideoFullscreenManagerProxy>. Removed the unused VideoFullscreenModelContext::invalidate()
function.

* Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h:
* Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenModelContext::VideoFullscreenModelContext):

Canonical link: https://commits.webkit.org/267917@main
  • Loading branch information
aestes committed Sep 12, 2023
1 parent 5025334 commit dcc8e6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ class VideoFullscreenModelContext final
}
virtual ~VideoFullscreenModelContext();

void invalidate() { m_manager = nullptr; }

PlatformView *layerHostView() const { return m_layerHostView.get(); }
void setLayerHostView(RetainPtr<PlatformView>&& layerHostView) { m_layerHostView = WTFMove(layerHostView); }

Expand Down Expand Up @@ -129,7 +127,7 @@ class VideoFullscreenModelContext final
WTFLogChannel& logChannel() const;
#endif

VideoFullscreenManagerProxy* m_manager;
WeakPtr<VideoFullscreenManagerProxy> m_manager;
Ref<PlaybackSessionModelContext> m_playbackSessionModel;
PlaybackSessionContextIdentifier m_contextId;
RetainPtr<PlatformView> m_layerHostView;
Expand All @@ -148,8 +146,15 @@ class VideoFullscreenModelContext final
#endif
};

class VideoFullscreenManagerProxy : public RefCounted<VideoFullscreenManagerProxy>, private IPC::MessageReceiver {
class VideoFullscreenManagerProxy
: public RefCounted<VideoFullscreenManagerProxy>
, public CanMakeWeakPtr<VideoFullscreenManagerProxy>
, private IPC::MessageReceiver {
public:
using CanMakeWeakPtr<VideoFullscreenManagerProxy>::WeakPtrImplType;
using CanMakeWeakPtr<VideoFullscreenManagerProxy>::WeakValueType;
using CanMakeWeakPtr<VideoFullscreenManagerProxy>::weakPtrFactory;

static Ref<VideoFullscreenManagerProxy> create(WebPageProxy&, PlaybackSessionManagerProxy&);
virtual ~VideoFullscreenManagerProxy();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ - (BOOL)prefersStatusBarHidden
#pragma mark - VideoFullscreenModelContext

VideoFullscreenModelContext::VideoFullscreenModelContext(VideoFullscreenManagerProxy& manager, PlaybackSessionModelContext& playbackSessionModel, PlaybackSessionContextIdentifier contextId)
: m_manager(&manager)
: m_manager(manager)
, m_playbackSessionModel(playbackSessionModel)
, m_contextId(contextId)
{
Expand Down

0 comments on commit dcc8e6f

Please sign in to comment.