Refactor WvCdmEventListener and some cleanups
Bug: 19771437 It is a merge of below CLs from Widevine CDM repo: Clean up CdmSession and PolicyEngine testing injection https://widevine-internal-review.googlesource.com/#/c/13700 Refactor WvCdmEventListener handling https://widevine-internal-review.googlesource.com/#/c/13702 Change-Id: I356b90000c056113d394926862b859aab380d305
This commit is contained in:
@@ -21,7 +21,8 @@ class WvCdmEventListener;
|
||||
|
||||
class CdmSession {
|
||||
public:
|
||||
explicit CdmSession(const CdmClientPropertySet* cdm_client_property_set);
|
||||
CdmSession(const CdmClientPropertySet* cdm_client_property_set,
|
||||
WvCdmEventListener* event_listener);
|
||||
virtual ~CdmSession();
|
||||
|
||||
virtual CdmResponseType Init();
|
||||
@@ -74,10 +75,6 @@ class CdmSession {
|
||||
|
||||
virtual bool IsKeyLoaded(const KeyId& key_id);
|
||||
|
||||
// See comments for CdmEngine::AttachEventListener/DetachEventListener.
|
||||
virtual bool AttachEventListener(WvCdmEventListener* listener);
|
||||
virtual bool DetachEventListener(WvCdmEventListener* listener);
|
||||
|
||||
// Used for notifying the Policy Engine of resolution changes
|
||||
virtual void NotifyResolution(uint32_t width, uint32_t height);
|
||||
|
||||
@@ -112,10 +109,7 @@ class CdmSession {
|
||||
bool DeleteLicense();
|
||||
|
||||
private:
|
||||
// Internal constructor
|
||||
void Create(CdmLicense* license_parser, CryptoSession* crypto_session,
|
||||
PolicyEngine* policy_engine, DeviceFiles* file_handle,
|
||||
const CdmClientPropertySet* cdm_client_property_set);
|
||||
friend class CdmSessionTest;
|
||||
|
||||
// Generate unique ID for each new session.
|
||||
CdmSessionId GenerateSessionId();
|
||||
@@ -123,9 +117,17 @@ class CdmSession {
|
||||
|
||||
CdmResponseType StoreLicense();
|
||||
bool StoreLicense(DeviceFiles::LicenseState state);
|
||||
|
||||
// These setters are for testing only. Takes ownership of the pointers.
|
||||
void set_license_parser(CdmLicense* license_parser);
|
||||
void set_crypto_session(CryptoSession* crypto_session);
|
||||
void set_policy_engine(PolicyEngine* policy_engine);
|
||||
void set_file_handle(DeviceFiles* file_handle);
|
||||
|
||||
// instance variables
|
||||
bool initialized_;
|
||||
CdmSessionId session_id_;
|
||||
WvCdmEventListener* event_listener_;
|
||||
scoped_ptr<CdmLicense> license_parser_;
|
||||
scoped_ptr<CryptoSession> crypto_session_;
|
||||
scoped_ptr<PolicyEngine> policy_engine_;
|
||||
@@ -156,18 +158,6 @@ class CdmSession {
|
||||
// license type release and offline related information
|
||||
CdmKeySetId key_set_id_;
|
||||
|
||||
std::set<WvCdmEventListener*> listeners_;
|
||||
|
||||
// For testing only
|
||||
// Takes ownership of license_parser, crypto_session, policy_engine
|
||||
// and device_files
|
||||
CdmSession(CdmLicense* license_parser, CryptoSession* crypto_session,
|
||||
PolicyEngine* policy_engine, DeviceFiles* file_handle,
|
||||
const CdmClientPropertySet* cdm_client_property_set);
|
||||
#if defined(UNIT_TEST)
|
||||
friend class CdmSessionTest;
|
||||
#endif
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(CdmSession);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user