Replace scoped_ptr With std::unique_ptr

(This is a merge of http://go/wvgerrit/65782)

We have had our own scoped_ptr implementation that is used throughout
the codebase. Now that we support C++11, we can replace these with
std::unique_ptr.

Doing this replacement exposed a few places where the two were not
interchangeable. OEMCrypto Ref was doing some unsafe things with passing
scoped_ptrs to functions and has been updated to use move semantics. And
a few constructors were explicitly constructing a scoped_ptr with NULL,
which is ambiguous with std::unique_ptr. These have been replaced with
default constructor calls.

Bug: 111851141
Test: CE CDM Unit Tests
Test: Android Unit Tests
Change-Id: I37d6d7aad4906709381c74f0c5439f826d2be768
This commit is contained in:
John W. Bruce
2018-11-14 10:49:53 -08:00
parent fb4d53bae6
commit b182a7445e
35 changed files with 100 additions and 208 deletions

View File

@@ -5,12 +5,12 @@
#ifndef WVCDM_CORE_LICENSE_H_
#define WVCDM_CORE_LICENSE_H_
#include <memory>
#include <set>
#include "disallow_copy_and_assign.h"
#include "initialization_data.h"
#include "license_protocol.pb.h"
#include "scoped_ptr.h"
#include "service_certificate.h"
#include "wv_cdm_types.h"
@@ -121,7 +121,7 @@ class CdmLicense {
CdmClientTokenType client_token_type_;
std::string device_id_;
const CdmSessionId session_id_;
scoped_ptr<InitializationData> stored_init_data_;
std::unique_ptr<InitializationData> stored_init_data_;
bool initialized_;
std::set<KeyId> loaded_keys_;
std::string provider_session_token_;
@@ -135,7 +135,7 @@ class CdmLicense {
// Used for certificate based licensing
CdmKeyMessage key_request_;
scoped_ptr<Clock> clock_;
std::unique_ptr<Clock> clock_;
// For testing
// CdmLicense takes ownership of the clock.