Bug 232193 - Remove unnecessary refcount increase when using m_player in MediaPlayerPrivateRemote
Summary: Remove unnecessary refcount increase when using m_player in MediaPlayerPrivat...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jean-Yves Avenard [:jya]
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-22 20:52 PDT by Jean-Yves Avenard [:jya]
Modified: 2021-10-24 21:33 PDT (History)
7 users (show)

See Also:


Attachments
Patch (18.77 KB, patch)
2021-10-24 21:32 PDT, Jean-Yves Avenard [:jya]
jean-yves.avenard: review?
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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