Change from custom Lock to std::mutex.

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

Now that we can use C++11, we should use the cross-platform std::mutex
type, not the custom pthread version.

Bug: 111850982
Test: WV unit/integration tests
Change-Id: If2fde2836826c5184609e6b1f3a6511206bd4594
This commit is contained in:
Rahul Frias
2018-12-13 10:07:21 -08:00
parent 65c64292b7
commit 0e28104cff
22 changed files with 151 additions and 163 deletions

View File

@@ -6,6 +6,7 @@
#define WVCDM_CORE_CDM_ENGINE_H_
#include <memory>
#include <mutex>
#include <string>
#include <vector>
@@ -16,7 +17,6 @@
#include "disallow_copy_and_assign.h"
#include "file_store.h"
#include "initialization_data.h"
#include "lock.h"
#include "metrics_collections.h"
#include "oemcrypto_adapter.h"
#include "service_certificate.h"
@@ -338,7 +338,7 @@ class CdmEngine {
int64_t last_usage_information_update_time_;
// Protect release_key_sets_ from non-thread-safe operations.
Lock release_key_sets_lock_;
std::mutex release_key_sets_lock_;
// TODO(rfrias): Replace with two sets of locks, one to protect
// the CdmSessionMap and a per-session lock to control access to
@@ -349,7 +349,7 @@ class CdmEngine {
// The layer above the CDM implementation is expected to handle thread
// synchronization to make sure other functions that access sessions do not
// occur simultaneously with OpenSession or CloseSession.
Lock session_map_lock_;
std::mutex session_map_lock_;
CORE_DISALLOW_COPY_AND_ASSIGN(CdmEngine);
};

View File

@@ -11,7 +11,6 @@
#include "cdm_session.h"
#include "disallow_copy_and_assign.h"
#include "lock.h"
#include "wv_cdm_types.h"
namespace wvcdm {

View File

@@ -7,13 +7,13 @@
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include <vector>
#include "OEMCryptoCENC.h"
#include "disallow_copy_and_assign.h"
#include "key_session.h"
#include "lock.h"
#include "metrics_collections.h"
#include "oemcrypto_adapter.h"
#include "timer_metric.h"
@@ -278,7 +278,7 @@ class CryptoSession {
static const size_t kAes128BlockSize = 16; // Block size for AES_CBC_128
static const size_t kSignatureSize = 32; // size for HMAC-SHA256 signature
static Lock crypto_lock_;
static std::mutex crypto_lock_;
static bool initialized_;
static int session_count_;

View File

@@ -11,7 +11,6 @@
#include "cdm_client_property_set.h"
#include "disallow_copy_and_assign.h"
#include "lock.h"
#include "wv_cdm_types.h"
#if defined(UNIT_TEST)

View File

@@ -6,6 +6,7 @@
#define WVCDM_CORE_USAGE_TABLE_HEADER_H_
#include <memory>
#include <mutex>
#include <string>
#include <vector>
@@ -13,7 +14,6 @@
#include "device_files.h"
#include "disallow_copy_and_assign.h"
#include "file_store.h"
#include "lock.h"
#include "metrics_collections.h"
#include "wv_cdm_types.h"
@@ -123,7 +123,7 @@ class UsageTableHeader {
// Synchonizes access to the Usage Table Header and bookkeeping
// data-structures
Lock usage_table_header_lock_;
std::mutex usage_table_header_lock_;
metrics::CryptoMetrics alternate_crypto_metrics_;