Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Unified Diff: media/cdm/aes_decryptor.cc

Issue 2371783002: Remove stl_util's deletion functions from media/. (Closed)
Patch Set: wolenetz Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/cast/test/end2end_unittest.cc ('k') | media/filters/chunk_demuxer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/cdm/aes_decryptor.cc
diff --git a/media/cdm/aes_decryptor.cc b/media/cdm/aes_decryptor.cc
index 7e93f4a53fab02f506d8898989b218f7a0d3109b..37dc4172450f36e5b7f5bdadf28c4abdd49bfbab 100644
--- a/media/cdm/aes_decryptor.cc
+++ b/media/cdm/aes_decryptor.cc
@@ -11,7 +11,6 @@
#include "base/logging.h"
#include "base/macros.h"
-#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "crypto/encryptor.h"
#include "crypto/symmetric_key.h"
@@ -38,11 +37,12 @@ class AesDecryptor::SessionIdDecryptionKeyMap {
// Use a std::list to actually hold the data. Insertion is always done
// at the front, so the "latest" decryption key is always the first one
// in the list.
- typedef std::list<std::pair<std::string, DecryptionKey*> > KeyList;
+ using KeyList =
+ std::list<std::pair<std::string, std::unique_ptr<DecryptionKey>>>;
public:
SessionIdDecryptionKeyMap() {}
- ~SessionIdDecryptionKeyMap() { base::STLDeleteValues(&key_list_); }
+ ~SessionIdDecryptionKeyMap() {}
// Replaces value if |session_id| is already present, or adds it if not.
// This |decryption_key| becomes the latest until another insertion or
@@ -59,7 +59,7 @@ class AesDecryptor::SessionIdDecryptionKeyMap {
// Returns the last inserted DecryptionKey.
DecryptionKey* LatestDecryptionKey() {
DCHECK(!key_list_.empty());
- return key_list_.begin()->second;
+ return key_list_.begin()->second.get();
}
bool Contains(const std::string& session_id) {
@@ -84,8 +84,7 @@ void AesDecryptor::SessionIdDecryptionKeyMap::Insert(
KeyList::iterator it = Find(session_id);
if (it != key_list_.end())
Erase(it);
- DecryptionKey* raw_ptr = decryption_key.release();
- key_list_.push_front(std::make_pair(session_id, raw_ptr));
+ key_list_.push_front(std::make_pair(session_id, std::move(decryption_key)));
}
void AesDecryptor::SessionIdDecryptionKeyMap::Erase(
@@ -108,7 +107,6 @@ AesDecryptor::SessionIdDecryptionKeyMap::Find(const std::string& session_id) {
void AesDecryptor::SessionIdDecryptionKeyMap::Erase(
KeyList::iterator position) {
DCHECK(position->second);
- delete position->second;
key_list_.erase(position);
}
« no previous file with comments | « media/cast/test/end2end_unittest.cc ('k') | media/filters/chunk_demuxer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698