Refactored metrics to support pull model.
MetricsGroup split into 3 groups, session, engine, and crypto. MetricsFrontEnd and Report removed. This is a merge from wvgerrit/28420 Bug: 36217927 Test: Added unit tests to cover modified code. Change-Id: I2f39f99ce88cc2229d6d1aa9459c67c5b86ccef4
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "file_store.h"
|
||||
#include "initialization_data.h"
|
||||
#include "lock.h"
|
||||
#include "metrics_collections.h"
|
||||
#include "oemcrypto_adapter.h"
|
||||
#include "scoped_ptr.h"
|
||||
#include "timer_metric.h"
|
||||
@@ -241,7 +242,7 @@ class CdmEngine {
|
||||
// dead lock.
|
||||
virtual void OnTimerEvent();
|
||||
|
||||
virtual metrics::MetricsGroup* GetMetrics() { return &metrics_; }
|
||||
virtual metrics::EngineMetrics* GetMetrics() { return &metrics_; }
|
||||
|
||||
private:
|
||||
// private methods
|
||||
@@ -273,7 +274,7 @@ class CdmEngine {
|
||||
* ensure that all data has been properly recorded in the group before
|
||||
* it is published.
|
||||
*/
|
||||
metrics::MetricsGroup metrics_;
|
||||
metrics::EngineMetrics metrics_;
|
||||
metrics::TimerMetric life_span_;
|
||||
|
||||
CdmSessionMap sessions_;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "file_store.h"
|
||||
#include "initialization_data.h"
|
||||
#include "license.h"
|
||||
#include "metrics_group.h"
|
||||
#include "metrics_collections.h"
|
||||
#include "oemcrypto_adapter.h"
|
||||
#include "policy_engine.h"
|
||||
#include "scoped_ptr.h"
|
||||
@@ -27,10 +27,24 @@ class UsageTableHeader;
|
||||
|
||||
class CdmSession {
|
||||
public:
|
||||
CdmSession(FileSystem* file_system);
|
||||
// Creates a new instance of the CdmSession with the given |file_system|
|
||||
// and |metrics| parameters. Both parameters are owned by the caller and
|
||||
// must remain in scope througout the scope of the new instance.
|
||||
CdmSession(FileSystem* file_system, metrics::SessionMetrics* metrics);
|
||||
virtual ~CdmSession();
|
||||
|
||||
// Initializes this instance of CdmSession with the given property set.
|
||||
// |cdm_client_property_set| MAY be null, is owned by the caller,
|
||||
// and must remain in scope throughout the scope of this session.
|
||||
virtual CdmResponseType Init(CdmClientPropertySet* cdm_client_property_set);
|
||||
|
||||
// Initializes this instance of CdmSession with the given parmeters.
|
||||
// All parameters are owned by the caller.
|
||||
// |cdm_client_property_set| is caller owned, may be null, but must be
|
||||
// in scope as long as the session is in scope.
|
||||
// |forced_session_id| is caller owned and may be null.
|
||||
// |event_listener| is caller owned, may be null, but must be in scope
|
||||
// as long as the session is in scope.
|
||||
virtual CdmResponseType Init(CdmClientPropertySet* cdm_client_property_set,
|
||||
const CdmSessionId* forced_session_id,
|
||||
WvCdmEventListener* event_listener);
|
||||
@@ -166,7 +180,7 @@ class CdmSession {
|
||||
CdmSigningAlgorithm algorithm,
|
||||
const std::string& signature);
|
||||
|
||||
virtual metrics::MetricsGroup* GetMetrics() { return &metrics_; }
|
||||
virtual metrics::SessionMetrics* GetMetrics() { return metrics_; }
|
||||
|
||||
private:
|
||||
friend class CdmSessionTest;
|
||||
@@ -185,19 +199,13 @@ class CdmSession {
|
||||
void set_file_handle(DeviceFiles* file_handle);
|
||||
|
||||
// instance variables
|
||||
|
||||
/*
|
||||
* The metrics group must be the first variable declared to ensure
|
||||
* that it is the last member destroyed so that no child members
|
||||
* try to use a reference to it after it is destroyed. This will
|
||||
* ensure that all data has been properly recorded in the group before
|
||||
* it is published.
|
||||
*/
|
||||
metrics::MetricsGroup metrics_;
|
||||
metrics::SessionMetrics* metrics_;
|
||||
metrics::CryptoMetrics* crypto_metrics_;
|
||||
metrics::TimerMetric life_span_;
|
||||
|
||||
bool initialized_;
|
||||
CdmSessionId session_id_;
|
||||
FileSystem* file_system_;
|
||||
scoped_ptr<CdmLicense> license_parser_;
|
||||
scoped_ptr<CryptoSession> crypto_session_;
|
||||
scoped_ptr<PolicyEngine> policy_engine_;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "crypto_session.h"
|
||||
#include "metrics_group.h"
|
||||
#include "metrics_collections.h"
|
||||
#include "oemcrypto_adapter.h"
|
||||
#include "service_certificate.h"
|
||||
#include "wv_cdm_types.h"
|
||||
@@ -18,7 +18,7 @@ class FileSystem;
|
||||
|
||||
class CertificateProvisioning {
|
||||
public:
|
||||
CertificateProvisioning(metrics::MetricsGroup* metrics) :
|
||||
CertificateProvisioning(metrics::CryptoMetrics* metrics) :
|
||||
crypto_session_(metrics),
|
||||
cert_type_(kCertificateWidevine),
|
||||
service_certificate_(NULL) {};
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "OEMCryptoCENC.h"
|
||||
#include "lock.h"
|
||||
#include "metrics_group.h"
|
||||
#include "metrics_collections.h"
|
||||
#include "oemcrypto_adapter.h"
|
||||
#include "timer_metric.h"
|
||||
#include "wv_cdm_types.h"
|
||||
@@ -36,7 +36,10 @@ class CryptoSession {
|
||||
bool rsa_cast;
|
||||
};
|
||||
|
||||
CryptoSession(metrics::MetricsGroup* metrics);
|
||||
// Creates an instance of CryptoSession with the given |crypto_metrics|.
|
||||
// |crypto_metrics| is owned by the caller, must NOT be null, and must
|
||||
// exist as long as the new CryptoSession exists.
|
||||
CryptoSession(metrics::CryptoMetrics* crypto_metrics);
|
||||
virtual ~CryptoSession();
|
||||
|
||||
virtual bool GetClientToken(std::string* client_token);
|
||||
@@ -206,7 +209,7 @@ class CryptoSession {
|
||||
static bool initialized_;
|
||||
static int session_count_;
|
||||
|
||||
metrics::MetricsGroup* metrics_;
|
||||
metrics::CryptoMetrics* metrics_;
|
||||
metrics::TimerMetric life_span_;
|
||||
|
||||
bool open_;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "device_files.h"
|
||||
#include "file_store.h"
|
||||
#include "lock.h"
|
||||
#include "metrics_group.h"
|
||||
#include "metrics_collections.h"
|
||||
#include "scoped_ptr.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
@@ -66,29 +66,29 @@ class UsageTableHeader {
|
||||
// should not be in use by any open CryptoSession objects when calls
|
||||
// to DeleteEntry and MoveEntry are made.
|
||||
CdmResponseType DeleteEntry(uint32_t usage_entry_number, DeviceFiles* handle,
|
||||
metrics::MetricsGroup* metrics);
|
||||
metrics::CryptoMetrics* metrics);
|
||||
|
||||
private:
|
||||
CdmResponseType MoveEntry(uint32_t from /* usage entry number */,
|
||||
const CdmUsageEntry& from_usage_entry,
|
||||
uint32_t to /* usage entry number */,
|
||||
DeviceFiles* handle,
|
||||
metrics::MetricsGroup* metrics);
|
||||
metrics::CryptoMetrics* metrics);
|
||||
|
||||
CdmResponseType GetEntry(uint32_t usage_entry_number, DeviceFiles* handle,
|
||||
CdmUsageEntry* usage_entry);
|
||||
CdmResponseType StoreEntry(uint32_t usage_entry_number, DeviceFiles* handle,
|
||||
const CdmUsageEntry& usage_entry);
|
||||
|
||||
CdmResponseType Shrink(metrics::MetricsGroup* metrics,
|
||||
CdmResponseType Shrink(metrics::CryptoMetrics* metrics,
|
||||
uint32_t number_of_usage_entries_to_delete);
|
||||
|
||||
CdmResponseType UpgradeFromUsageTable(DeviceFiles* handle,
|
||||
metrics::MetricsGroup* metrics);
|
||||
metrics::CryptoMetrics* metrics);
|
||||
bool UpgradeLicensesFromUsageTable(DeviceFiles* handle,
|
||||
metrics::MetricsGroup* metrics);
|
||||
metrics::CryptoMetrics* metrics);
|
||||
bool UpgradeUsageInfoFromUsageTable(DeviceFiles* handle,
|
||||
metrics::MetricsGroup* metrics);
|
||||
metrics::CryptoMetrics* metrics);
|
||||
|
||||
virtual bool is_inited() { return is_inited_; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user