Source release 15.0.0

This commit is contained in:
John W. Bruce
2019-02-28 16:25:30 -08:00
parent f51edaba5a
commit 66628486b5
2672 changed files with 260431 additions and 762489 deletions

View File

@@ -6,12 +6,12 @@
#define WVCDM_CORE_PROPERTIES_H_
#include <map>
#include <memory>
#include <mutex>
#include <string>
#include "cdm_client_property_set.h"
#include "disallow_copy_and_assign.h"
#include "lock.h"
#include "scoped_ptr.h"
#include "wv_cdm_types.h"
#if defined(UNIT_TEST)
@@ -31,11 +31,14 @@ typedef std::map<CdmSessionId, CdmClientPropertySet*>
// Setter methods are provided but their only planned use is for testing.
class Properties {
public:
// Called at least once before any properties are used. Depending on the
// platform, this function may be called multiple times. It is called each
// time a CdmEngine is created, and when running unit tests it is called in
// many tests' SetUp function.
static void Init();
static void Init() {
std::unique_lock<std::mutex> lock(init_mutex_);
if (!is_initialized_) {
InitOnce();
is_initialized_ = true;
}
}
static inline bool oem_crypto_use_secure_buffers() {
return oem_crypto_use_secure_buffers_;
@@ -64,6 +67,7 @@ class Properties {
std::string* base_path);
static bool GetFactoryKeyboxPath(std::string* keybox);
static bool GetOEMCryptoPath(std::string* library_name);
static bool GetSandboxId(std::string *sandbox_id);
static bool AlwaysUseKeySetIds();
static bool UseProviderIdInProvisioningRequest();
@@ -81,6 +85,21 @@ class Properties {
CdmClientPropertySet* property_set);
static bool RemoveSessionPropertySet(const CdmSessionId& session_id);
protected:
// This function always runs the code in |Init()| (and subsequently
// |InitOnce()|) even if Properties have already been initialized. This is
// needed by certain tests that are dependent on controlling the mutable state
// of Properties. Should not be used in general, as most tests rely on
// Properties' normal guarantee about |Init()| being safe to call multiple
// times without destroying mutable state.
static void ForceReinit() {
{
std::unique_lock<std::mutex> lock(init_mutex_);
is_initialized_ = false;
}
Init();
}
private:
static CdmClientPropertySet* GetCdmClientPropertySet(
const CdmSessionId& session_id);
@@ -105,17 +124,20 @@ class Properties {
FRIEND_TEST(CdmSessionTest, InitFailCryptoError);
FRIEND_TEST(CdmSessionTest, InitNeedsProvisioning);
FRIEND_TEST(CdmLicenseTest, PrepareKeyRequestValidation);
FRIEND_TEST(SubLicenseTest, VerifySubSessionData);
#endif
private:
// Called at least once before any properties are used.
static void InitOnce();
static std::mutex init_mutex_;
static bool is_initialized_;
static bool oem_crypto_use_secure_buffers_;
static bool oem_crypto_use_fifo_;
static bool oem_crypto_use_userspace_buffers_;
static bool use_certificates_as_identification_;
static bool provisioning_messages_are_binary_;
static bool allow_service_certificate_requests_;
static scoped_ptr<CdmClientPropertySetMap> session_property_set_;
static std::unique_ptr<CdmClientPropertySetMap> session_property_set_;
CORE_DISALLOW_COPY_AND_ASSIGN(Properties);
};