OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_CDM_SESSION_TRACKER_H_ | 5 #ifndef MEDIA_BASE_CDM_SESSION_TRACKER_H_ |
6 #define MEDIA_BASE_CDM_SESSION_TRACKER_H_ | 6 #define MEDIA_BASE_CDM_SESSION_TRACKER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <unordered_set> | 11 #include <unordered_set> |
12 | 12 |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "media/base/media_export.h" | 15 #include "media/base/media_export.h" |
16 #include "media/base/media_keys.h" | 16 #include "media/base/media_keys.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 | 19 |
20 class MEDIA_EXPORT CdmSessionTracker { | 20 class MEDIA_EXPORT CdmSessionTracker { |
21 public: | 21 public: |
22 CdmSessionTracker(); | 22 CdmSessionTracker(); |
23 ~CdmSessionTracker(); | 23 ~CdmSessionTracker(); |
24 | 24 |
25 // Add |session_id| to the list of sessions being tracked. | 25 // Adds |session_id| to the list of sessions being tracked. |
26 void AddSession(const std::string& session_id); | 26 void AddSession(const std::string& session_id); |
27 | 27 |
28 // Remove |session_id| from the list of sessions being tracked. | 28 // Removes |session_id| from the list of sessions being tracked. |
29 void RemoveSession(const std::string& session_id); | 29 void RemoveSession(const std::string& session_id); |
30 | 30 |
31 // Call |session_closed_cb| on any remaining sessions in the list and then | 31 // Calls |session_closed_cb| on any remaining sessions in the list and then |
32 // clear the list. | 32 // clear the list. |
33 void CloseRemainingSessions(const SessionClosedCB& session_closed_cb); | 33 void CloseRemainingSessions(const SessionClosedCB& session_closed_cb); |
34 | 34 |
| 35 // Returns whether there are any remaining sessions being tracked. |
| 36 bool HasRemainingSessions() const; |
| 37 |
35 private: | 38 private: |
36 std::unordered_set<std::string> session_ids_; | 39 std::unordered_set<std::string> session_ids_; |
37 | 40 |
38 DISALLOW_COPY_AND_ASSIGN(CdmSessionTracker); | 41 DISALLOW_COPY_AND_ASSIGN(CdmSessionTracker); |
39 }; | 42 }; |
40 | 43 |
41 } // namespace media | 44 } // namespace media |
42 | 45 |
43 #endif // MEDIA_BASE_CDM_SESSION_TRACKER_H_ | 46 #endif // MEDIA_BASE_CDM_SESSION_TRACKER_H_ |
OLD | NEW |