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

Unified Diff: content/renderer/pepper/content_decryptor_delegate.cc

Issue 1072403009: Use std::vector<uint8_t> instead of uint8*/int for MediaKeys interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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: content/renderer/pepper/content_decryptor_delegate.cc
diff --git a/content/renderer/pepper/content_decryptor_delegate.cc b/content/renderer/pepper/content_decryptor_delegate.cc
index e8dc612953d2b1ae9ff368e67c5098775faed1f9..7df203a893c6fc086c009d2f069360d0f9c2c443 100644
--- a/content/renderer/pepper/content_decryptor_delegate.cc
+++ b/content/renderer/pepper/content_decryptor_delegate.cc
@@ -405,12 +405,10 @@ void ContentDecryptorDelegate::InstanceCrashed() {
}
void ContentDecryptorDelegate::SetServerCertificate(
- const uint8_t* certificate,
- uint32_t certificate_length,
+ const std::vector<uint8>& certificate,
scoped_ptr<media::SimpleCdmPromise> promise) {
- if (!certificate ||
- certificate_length < media::limits::kMinCertificateLength ||
- certificate_length > media::limits::kMaxCertificateLength) {
+ if (certificate.size() < media::limits::kMinCertificateLength ||
+ certificate.size() > media::limits::kMaxCertificateLength) {
promise->reject(
media::MediaKeys::INVALID_ACCESS_ERROR, 0, "Incorrect certificate.");
return;
@@ -419,7 +417,7 @@ void ContentDecryptorDelegate::SetServerCertificate(
uint32_t promise_id = cdm_promise_adapter_.SavePromise(promise.Pass());
PP_Var certificate_array =
PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
- certificate_length, certificate);
+ certificate.size(), vector_as_array(&certificate));
plugin_decryption_interface_->SetServerCertificate(
pp_instance_, promise_id, certificate_array);
}
@@ -427,13 +425,12 @@ void ContentDecryptorDelegate::SetServerCertificate(
void ContentDecryptorDelegate::CreateSessionAndGenerateRequest(
MediaKeys::SessionType session_type,
media::EmeInitDataType init_data_type,
- const uint8* init_data,
- int init_data_length,
+ const std::vector<uint8>& init_data,
scoped_ptr<NewSessionCdmPromise> promise) {
uint32_t promise_id = cdm_promise_adapter_.SavePromise(promise.Pass());
PP_Var init_data_array =
PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
- init_data_length, init_data);
+ init_data.size(), vector_as_array(&init_data));
plugin_decryption_interface_->CreateSessionAndGenerateRequest(
pp_instance_, promise_id, MediaSessionTypeToPpSessionType(session_type),
MediaInitDataTypeToPpInitDataType(init_data_type), init_data_array);
@@ -451,13 +448,12 @@ void ContentDecryptorDelegate::LoadSession(
void ContentDecryptorDelegate::UpdateSession(
const std::string& session_id,
- const uint8* response,
- int response_length,
+ const std::vector<uint8>& response,
scoped_ptr<SimpleCdmPromise> promise) {
uint32_t promise_id = cdm_promise_adapter_.SavePromise(promise.Pass());
PP_Var response_array =
PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(
- response_length, response);
+ response.size(), vector_as_array(&response));
plugin_decryption_interface_->UpdateSession(
pp_instance_, promise_id, StringVar::StringToPPVar(session_id),
response_array);

Powered by Google App Engine
This is Rietveld 408576698