Source release v3.3.0
This commit is contained in:
52
core/include/cdm_session_map.h
Normal file
52
core/include/cdm_session_map.h
Normal file
@@ -0,0 +1,52 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
|
||||
#ifndef WVCDM_CORE_CDM_SESSION_MAP_H_
|
||||
#define WVCDM_CORE_CDM_SESSION_MAP_H_
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "lock.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
class CdmSession;
|
||||
|
||||
typedef std::list<std::shared_ptr<CdmSession> > CdmSessionList;
|
||||
|
||||
class CdmSessionMap {
|
||||
public:
|
||||
CdmSessionMap() {}
|
||||
virtual ~CdmSessionMap();
|
||||
|
||||
void Add(const std::string& id, CdmSession* session);
|
||||
|
||||
bool CloseSession(const std::string& id);
|
||||
|
||||
bool Exists(const std::string& id);
|
||||
|
||||
size_t Size() const { return sessions_.size(); }
|
||||
|
||||
bool FindSession(const CdmSessionId& id,
|
||||
std::shared_ptr<CdmSession>& session);
|
||||
|
||||
void GetSessionList(CdmSessionList& sessions);
|
||||
|
||||
private:
|
||||
typedef std::map<CdmSessionId, std::shared_ptr<CdmSession> >
|
||||
CdmIdToSessionMap;
|
||||
|
||||
bool FindSessionNoLock(const CdmSessionId& session_id,
|
||||
std::shared_ptr<CdmSession>& session);
|
||||
|
||||
Lock lock_;
|
||||
CdmIdToSessionMap sessions_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(CdmSessionMap);
|
||||
};
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // WVCDM_CORE_CDM_SESSION_MAP_H_
|
||||
Reference in New Issue
Block a user