Switch to using shared_ptr for Session Metrics
[ Merge from http://go/wvgerrit/71443 ] The assumption that the metrics will always outlive the CdmSession instance appears not to always hold (at least in a non-android multi-threaded solution). The shared_ptr ensures that the metrics are available even in these rare race conditions. BUG: http://b/123321465 Test: CDM unit tests. Also http://go/wvgerrit/71264 parallel tests. Change-Id: Iaa6a8f6c0fdc46a911789759d6e1228d849aa237
This commit is contained in:
@@ -174,7 +174,8 @@ class CdmSessionTest : public WvCdmTestBase {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
WvCdmTestBase::SetUp();
|
||||
cdm_session_.reset(new CdmSession(NULL, &metrics_));
|
||||
metrics_.reset(new metrics::SessionMetrics);
|
||||
cdm_session_.reset(new CdmSession(NULL, metrics_));
|
||||
// Inject testing mocks.
|
||||
license_parser_ = new MockCdmLicense(cdm_session_->session_id());
|
||||
cdm_session_->set_license_parser(license_parser_);
|
||||
@@ -192,7 +193,7 @@ class CdmSessionTest : public WvCdmTestBase {
|
||||
cdm_session_.reset();
|
||||
}
|
||||
|
||||
metrics::SessionMetrics metrics_;
|
||||
std::shared_ptr<metrics::SessionMetrics> metrics_;
|
||||
std::unique_ptr<CdmSession> cdm_session_;
|
||||
MockCdmLicense* license_parser_;
|
||||
metrics::CryptoMetrics crypto_metrics_;
|
||||
|
||||
Reference in New Issue
Block a user