Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(810)

Unified Diff: content/browser/media/media_web_contents_observer.cc

Issue 1810213002: media: Allow WMPI to send playing started notification while playing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/media/media_web_contents_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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())
« no previous file with comments | « content/browser/media/media_web_contents_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698