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

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: Buffer Bonanza! 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..7f37f2a9bae9013583d0a117e7961bff838ff855 100644
--- a/media/crypto/aes_decryptor.cc
+++ b/media/crypto/aes_decryptor.cc
@@ -9,8 +9,6 @@
#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/decrypt_config.h"
namespace media {
@@ -21,8 +19,8 @@ static const char kInitialCounter[] = "0000000000000000";
// Decrypt |input| using |key|.
// Return a scoped_refptr to a Buffer object with the decrypted data on success.
scherkus (not reviewing) 2012/05/26 01:36:32 docs also I'd drop the "scoped_reptr" mentions
DaleCurtis 2012/05/29 21:17:01 Done.
// Return a scoped_refptr to NULL if the data could not be decrypted.
-static scoped_refptr<Buffer> DecryptData(const Buffer& input,
- crypto::SymmetricKey* key) {
+static scoped_refptr<DecoderBuffer> DecryptData(const DecoderBuffer& input,
+ crypto::SymmetricKey* key) {
CHECK(input.GetDataSize());
CHECK(key);
@@ -43,9 +41,7 @@ static scoped_refptr<Buffer> DecryptData(const Buffer& input,
return NULL;
}
- // TODO(xhwang): Implement a string based Buffer implementation to avoid
- // data copying.
- return DataBuffer::CopyFrom(
+ return DecoderBuffer::CopyFrom(
reinterpret_cast<const uint8*>(decrypted_text.data()),
decrypted_text.size());
}
@@ -81,8 +77,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 +97,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