| Index: content/browser/media/media_web_contents_observer.cc
|
| diff --git a/content/browser/media/media_web_contents_observer.cc b/content/browser/media/media_web_contents_observer.cc
|
| index 654f99cfa4e69dfd1daef72143e5f2ca048d3d97..7d1c92426f771ab8f66b1568194aa9f1e46fd3d7 100644
|
| --- a/content/browser/media/media_web_contents_observer.cc
|
| +++ b/content/browser/media/media_web_contents_observer.cc
|
| @@ -213,10 +213,7 @@ void MediaWebContentsObserver::MaybeReleasePowerSaveBlockers() {
|
| void MediaWebContentsObserver::AddMediaPlayerEntry(
|
| const MediaPlayerId& id,
|
| ActiveMediaPlayerMap* player_map) {
|
| - DCHECK(std::find((*player_map)[id.first].begin(),
|
| - (*player_map)[id.first].end(),
|
| - id.second) == (*player_map)[id.first].end());
|
| - (*player_map)[id.first].push_back(id.second);
|
| + (*player_map)[id.first].insert(id.second);
|
| }
|
|
|
| bool MediaWebContentsObserver::RemoveMediaPlayerEntry(
|
| @@ -227,11 +224,9 @@ bool MediaWebContentsObserver::RemoveMediaPlayerEntry(
|
| return false;
|
|
|
| // Remove the player.
|
| - auto player_for_removal =
|
| - std::remove(it->second.begin(), it->second.end(), id.second);
|
| - if (player_for_removal == it->second.end())
|
| + bool did_remove = it->second.erase(id.second) == 1;
|
| + if (!did_remove)
|
| return false;
|
| - it->second.erase(player_for_removal);
|
|
|
| // If there are no players left, remove the map entry.
|
| if (it->second.empty())
|
|
|