This CL updates has several changes. The document WidevineModularDRMSecurityIntegrationGuideforCENC_v14.pdf had an incorrect definition of the PST_Report structure. The header file had the correct definition. This has been updated and the version number of the document was rolled to 14.1 The unit tests TwoHundredEntries has been modifed to make sure that if the usage table is full, then OEMCrypto will return the error OEMCrypto_ERROR_INSUFFICIENT_RESOURCES. This is important for the CDM layer to correctly delete old licenses and secure stops when this happens. Several other unit tests covering corner cases have been added. The reference code has been cleaned up a bit. Some logging that might be dangerous has been removed.
54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine Master
|
|
// License Agreement.
|
|
//
|
|
// Lock - Platform independent interface for a Mutex class
|
|
//
|
|
#ifndef WVCDM_UTIL_LOCK_H_
|
|
#define WVCDM_UTIL_LOCK_H_
|
|
|
|
#include "disallow_copy_and_assign.h"
|
|
|
|
namespace wvcdm {
|
|
|
|
// Simple lock class. The implementation is platform dependent.
|
|
//
|
|
// The lock must be unlocked by the thread that locked it.
|
|
// The lock is also not recursive (ie. cannot be taken multiple times).
|
|
class Lock {
|
|
public:
|
|
Lock();
|
|
~Lock();
|
|
|
|
void Acquire();
|
|
void Release();
|
|
|
|
friend class AutoLock;
|
|
|
|
private:
|
|
class Impl;
|
|
Impl* impl_;
|
|
|
|
CORE_DISALLOW_COPY_AND_ASSIGN(Lock);
|
|
};
|
|
|
|
// Manages the lock automatically. It will be locked when AutoLock
|
|
// is constructed and release when AutoLock goes out of scope.
|
|
class AutoLock {
|
|
public:
|
|
explicit AutoLock(Lock& lock) : lock_(&lock) { lock_->Acquire(); }
|
|
|
|
explicit AutoLock(Lock* lock) : lock_(lock) { lock_->Acquire(); }
|
|
|
|
~AutoLock() { lock_->Release(); }
|
|
|
|
private:
|
|
Lock* lock_;
|
|
|
|
CORE_DISALLOW_COPY_AND_ASSIGN(AutoLock);
|
|
};
|
|
|
|
} // namespace wvcdm
|
|
|
|
#endif // WVCDM_UTIL_LOCK_H_
|