Bug 232193

Summary: Remove unnecessary refcount increase when using m_player in MediaPlayerPrivateRemote
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: MediaAssignee: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Status: NEW ---    
Severity: Normal CC: eric.carlson, ews-watchlist, glenn, jer.noble, philipj, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Other   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=232124
Attachments:
Description Flags
Patch jean-yves.avenard: review?

Description Jean-Yves Avenard [:jya] 2021-10-22 20:52:03 PDT
As mentioned in: https://bugs.webkit.org/show_bug.cgi?id=232124#c3

We have a lot of this code pattern:
```
    if (RefPtr player = m_player.get())
        m_player->addAudioTrack(addResult.iterator->value);
```

there's no side effect possible when calling m_player here, so there's no need to keep a strong reference :

doing:
```
    if (m_player)
        m_player->addAudioTrack(addResult.iterator->value);
```

is fine
Comment 1 Radar WebKit Bug Importer 2021-10-22 20:53:31 PDT
<rdar://problem/84574114>
Comment 2 Jean-Yves Avenard [:jya] 2021-10-24 21:32:59 PDT
Created attachment 442336 [details]
Patch