Prevent race conditions between decrypt and close session

[ Merge of http://go/wvgerrit/47520 ]

Bug: 73781703
Test: WV unit/integration tests, GTS GtsMediaTestCases tests and AUPT tests.
Change-Id: I618ed8ca38855aecdb31e829a7f4041cbd505a02
This commit is contained in:
Rahul Frias
2018-04-13 01:12:16 -07:00
parent 5c71603e8c
commit 07bb4de042
6 changed files with 19 additions and 2 deletions

View File

@@ -37,7 +37,7 @@ class CdmSession {
CdmSession(FileSystem* file_system, metrics::SessionMetrics* metrics);
virtual ~CdmSession();
void Close() { closed_ = true; }
void Close();
bool IsClosed() { return closed_; }
// Initializes this instance of CdmSession with the given property set.
@@ -263,6 +263,9 @@ class CdmSession {
bool mock_license_parser_in_use_;
bool mock_policy_engine_in_use_;
// Lock to avoid race conditions between Close() and Decrypt()
Lock close_lock_;
CORE_DISALLOW_COPY_AND_ASSIGN(CdmSession);
};

View File

@@ -333,6 +333,7 @@ enum CdmResponseType {
GET_PROVISIONING_METHOD_ERROR = 289,
SESSION_NOT_FOUND_17 = 290,
SESSION_NOT_FOUND_18 = 291,
SESSION_CLOSED_1 = 292,
};
enum CdmKeyStatus {