Skip to content

Commit

Permalink
Deploy smart pointers in PlaybackSessionManager.mm and RemoteCaptureS…
Browse files Browse the repository at this point in the history
…ampleManager.cpp

https://bugs.webkit.org/show_bug.cgi?id=260245

Reviewed by Jer Noble.

Deployed more smart pointers in these two files.

* Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm:
(WebKit::PlaybackSessionManager::handleControlledElementIDRequest):
* Source/WebKit/WebProcess/cocoa/RemoteCaptureSampleManager.cpp:
(WebKit::RemoteCaptureSampleManager::setConnection):
(WebKit::RemoteCaptureSampleManager::addSource):
(WebKit::RemoteCaptureSampleManager::videoFrameAvailable):

Canonical link: https://commits.webkit.org/266956@main
  • Loading branch information
rniwa committed Aug 16, 2023
1 parent 3467db4 commit 943a874
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Source/WebKit/WebProcess/cocoa/PlaybackSessionManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,7 @@

void PlaybackSessionManager::handleControlledElementIDRequest(PlaybackSessionContextIdentifier contextId)
{
auto element = ensureModel(contextId).mediaElement();
if (element)
if (RefPtr element = ensureModel(contextId).mediaElement())
m_page->send(Messages::PlaybackSessionManagerProxy::HandleControlledElementIDResponse(contextId, element->getIdAttribute()));
}

Expand Down
6 changes: 3 additions & 3 deletions Source/WebKit/WebProcess/cocoa/RemoteCaptureSampleManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void RemoteCaptureSampleManager::setConnection(IPC::Connection* connection)
if (m_connection == connection)
return;

auto* parentConnection = WebProcess::singleton().parentProcessConnection();
RefPtr parentConnection = WebProcess::singleton().parentProcessConnection();
if (connection == parentConnection) {
if (!m_isRegisteredToParentProcessConnection) {
m_isRegisteredToParentProcessConnection = true;
Expand All @@ -83,7 +83,7 @@ void RemoteCaptureSampleManager::setConnection(IPC::Connection* connection)
void RemoteCaptureSampleManager::addSource(Ref<RemoteRealtimeAudioSource>&& source)
{
ASSERT(WTF::isMainRunLoop());
setConnection(&source->connection());
setConnection(Ref { source->connection() }.ptr());

m_queue->dispatch([this, protectedThis = Ref { *this }, source = WTFMove(source)]() mutable {
auto identifier = source->identifier();
Expand Down Expand Up @@ -147,7 +147,7 @@ void RemoteCaptureSampleManager::videoFrameAvailable(RealtimeMediaSourceIdentifi
Ref<RemoteVideoFrameProxy> videoFrame = [&] {
// FIXME: We need to either get GPUProcess or UIProcess object heap proxy. For now we always go to GPUProcess.
Locker lock(m_videoFrameObjectHeapProxyLock);
return RemoteVideoFrameProxy::create(*m_connection, *m_videoFrameObjectHeapProxy, WTFMove(properties));
return RemoteVideoFrameProxy::create(Ref { *m_connection }, Ref { *m_videoFrameObjectHeapProxy }, WTFMove(properties));
}();
auto iterator = m_videoSources.find(identifier);
if (iterator == m_videoSources.end()) {
Expand Down

0 comments on commit 943a874

Please sign in to comment.