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

Side by Side Diff: media/base/cdm_session_tracker.cc

Issue 2426813002: EME: Close existing sessions on CDM failure (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/base/cdm_session_tracker.h"
6
7 namespace media {
8
9 CdmSessionTracker::CdmSessionTracker() {}
10
11 CdmSessionTracker::~CdmSessionTracker() {
12 DCHECK(session_ids_.empty());
13 }
14
15 void CdmSessionTracker::AddSession(const std::string& session_id) {
16 DCHECK(session_ids_.find(session_id) == session_ids_.end());
17 session_ids_.insert(session_id);
18 }
19
20 void CdmSessionTracker::RemoveSession(const std::string& session_id) {
21 auto it = session_ids_.find(session_id);
22 DCHECK(it != session_ids_.end());
23 session_ids_.erase(it);
24 }
25
26 void CdmSessionTracker::CloseRemainingSessions(
27 SessionClosedCB session_closed_cb) {
28 std::unordered_set<std::string> session_ids;
29 session_ids.swap(session_ids_);
30
31 for (const auto& session_id : session_ids)
32 session_closed_cb.Run(session_id);
33 }
34
35 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698