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:
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "license_protocol.pb.h"
|
||||
#include "max_res_engine.h"
|
||||
#include "scoped_ptr.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
namespace wvcdm {
|
||||
@@ -15,7 +16,6 @@ using video_widevine_server::sdk::LicenseIdentification;
|
||||
|
||||
class Clock;
|
||||
class CryptoSession;
|
||||
class PolicyEngineTest;
|
||||
|
||||
// This acts as an oracle that basically says "Yes(true) you may still decrypt
|
||||
// or no(false) you may not decrypt this data anymore."
|
||||
@@ -78,6 +78,8 @@ class PolicyEngine {
|
||||
bool IsLicenseForFuture() { return license_state_ == kLicenseStatePending; }
|
||||
|
||||
private:
|
||||
friend class PolicyEngineTest;
|
||||
|
||||
typedef enum {
|
||||
kLicenseStateInitial,
|
||||
kLicenseStatePending, // if license is issued for sometime in the future
|
||||
@@ -87,8 +89,6 @@ class PolicyEngine {
|
||||
kLicenseStateExpired
|
||||
} LicenseState;
|
||||
|
||||
void Init(Clock* clock);
|
||||
|
||||
int64_t GetLicenseDurationRemaining(int64_t current_time);
|
||||
int64_t GetPlaybackDurationRemaining(int64_t current_time);
|
||||
|
||||
@@ -98,6 +98,9 @@ class PolicyEngine {
|
||||
|
||||
void UpdateRenewalRequest(int64_t current_time);
|
||||
|
||||
// These setters are for testing only. Takes ownership of the pointers.
|
||||
void set_clock(Clock* clock);
|
||||
|
||||
LicenseState license_state_;
|
||||
bool can_decrypt_;
|
||||
|
||||
@@ -124,11 +127,7 @@ class PolicyEngine {
|
||||
int64_t policy_max_duration_seconds_;
|
||||
|
||||
MaxResEngine max_res_engine_;
|
||||
Clock* clock_;
|
||||
|
||||
// For testing
|
||||
friend class PolicyEngineTest;
|
||||
PolicyEngine(CryptoSession* crypto_session, Clock* clock);
|
||||
scoped_ptr<Clock> clock_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(PolicyEngine);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user