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

Unified Diff: media/crypto/aes_decryptor.cc

Issue 10447035: Introducing DecoderBuffer and general Buffer cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fix! Created 8 years, 7 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
Index: media/crypto/aes_decryptor.cc
diff --git a/media/crypto/aes_decryptor.cc b/media/crypto/aes_decryptor.cc
index 8d56d76393df2b2b33404abb4999f9d3e75edf5e..424804b0fc6c3d3c988bc974ba7c879137707d83 100644
--- a/media/crypto/aes_decryptor.cc
+++ b/media/crypto/aes_decryptor.cc
@@ -9,8 +9,7 @@
#include "base/string_piece.h"
#include "crypto/encryptor.h"
#include "crypto/symmetric_key.h"
-#include "media/base/buffers.h"
-#include "media/base/data_buffer.h"
+#include "media/base/decoder_buffer.h"
#include "media/base/decrypt_config.h"
namespace media {
@@ -19,10 +18,10 @@ namespace media {
static const char kInitialCounter[] = "0000000000000000";
// Decrypt |input| using |key|.
-// Return a scoped_refptr to a Buffer object with the decrypted data on success.
-// Return a scoped_refptr to NULL if the data could not be decrypted.
-static scoped_refptr<Buffer> DecryptData(const Buffer& input,
- crypto::SymmetricKey* key) {
+// Return a DecoderBuffer with the decrypted data if decryption succeeded.
+// Return NULL if decryption failed.
+static scoped_refptr<DecoderBuffer> DecryptData(const DecoderBuffer& input,
+ crypto::SymmetricKey* key) {
CHECK(input.GetDataSize());
CHECK(key);
@@ -43,9 +42,7 @@ static scoped_refptr<Buffer> DecryptData(const Buffer& input,
return NULL;
}
- // TODO(xhwang): Implement a string based Buffer implementation to avoid
Ami GONE FROM CHROMIUM 2012/05/30 05:19:27 Why drop the spirit of this TODO?
DaleCurtis 2012/05/30 17:33:47 Good point. Changed.
- // data copying.
- return DataBuffer::CopyFrom(
+ return DecoderBuffer::CopyFrom(
reinterpret_cast<const uint8*>(decrypted_text.data()),
decrypted_text.size());
}
@@ -81,8 +78,8 @@ void AesDecryptor::AddKey(const uint8* key_id, int key_id_size,
key_map_[key_id_string] = symmetric_key;
}
-scoped_refptr<Buffer> AesDecryptor::Decrypt(
- const scoped_refptr<Buffer>& encrypted) {
+scoped_refptr<DecoderBuffer> AesDecryptor::Decrypt(
+ const scoped_refptr<DecoderBuffer>& encrypted) {
CHECK(encrypted->GetDecryptConfig());
const uint8* key_id = encrypted->GetDecryptConfig()->key_id();
const int key_id_size = encrypted->GetDecryptConfig()->key_id_size();
@@ -101,7 +98,7 @@ scoped_refptr<Buffer> AesDecryptor::Decrypt(
key = found->second;
}
- scoped_refptr<Buffer> decrypted = DecryptData(*encrypted, key);
+ scoped_refptr<DecoderBuffer> decrypted = DecryptData(*encrypted, key);
if (decrypted) {
decrypted->SetTimestamp(encrypted->GetTimestamp());

Powered by Google App Engine
This is Rietveld 408576698