diff options
author | jrummell <jrummell@chromium.org> | 2015-01-07 20:37:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-08 04:38:06 +0000 |
commit | b324bc63600f0bf8748569ce84638c080dac36aa (patch) | |
tree | 03e5df8c3793e3a45dc5ad4986379e662c3bed11 /media | |
parent | cb3ffe01fbb98ad7e023682c2aee46a36d1e3b7f (diff) | |
download | chromium_src-b324bc63600f0bf8748569ce84638c080dac36aa.zip chromium_src-b324bc63600f0bf8748569ce84638c080dac36aa.tar.gz chromium_src-b324bc63600f0bf8748569ce84638c080dac36aa.tar.bz2 |
Rename CreateSession() to CreateSessionAndGenerateRequest()
Also reorders the parameters so that |session_type| comes first.
BUG=428384
TEST=existing EME tests pass
Review URL: https://codereview.chromium.org/825533003
Cr-Commit-Position: refs/heads/master@{#310452}
Diffstat (limited to 'media')
-rw-r--r-- | media/base/media_keys.h | 11 | ||||
-rw-r--r-- | media/blink/cdm_session_adapter.cc | 8 | ||||
-rw-r--r-- | media/cdm/aes_decryptor.cc | 11 | ||||
-rw-r--r-- | media/cdm/aes_decryptor.h | 11 | ||||
-rw-r--r-- | media/cdm/aes_decryptor_unittest.cc | 40 | ||||
-rw-r--r-- | media/cdm/ppapi/external_clear_key/clear_key_cdm.cc | 17 | ||||
-rw-r--r-- | media/cdm/proxy_decryptor.cc | 8 | ||||
-rw-r--r-- | media/mojo/interfaces/content_decryption_module.mojom | 6 | ||||
-rw-r--r-- | media/mojo/services/mojo_cdm.cc | 15 | ||||
-rw-r--r-- | media/mojo/services/mojo_cdm.h | 11 | ||||
-rw-r--r-- | media/mojo/services/mojo_cdm_service.cc | 8 | ||||
-rw-r--r-- | media/mojo/services/mojo_cdm_service.h | 11 | ||||
-rw-r--r-- | media/test/pipeline_integration_test.cc | 13 |
13 files changed, 80 insertions, 90 deletions
diff --git a/media/base/media_keys.h b/media/base/media_keys.h index bdc41c5..c3caf44 100644 --- a/media/base/media_keys.h +++ b/media/base/media_keys.h @@ -83,11 +83,12 @@ class MEDIA_EXPORT MediaKeys{ // provided. // Note: UpdateSession() and ReleaseSession() should only be called after // |promise| is resolved. - virtual void CreateSession(const std::string& init_data_type, - const uint8* init_data, - int init_data_length, - SessionType session_type, - scoped_ptr<NewSessionCdmPromise> promise) = 0; + virtual void CreateSessionAndGenerateRequest( + SessionType session_type, + const std::string& init_data_type, + const uint8* init_data, + int init_data_length, + scoped_ptr<NewSessionCdmPromise> promise) = 0; // Loads a session with the |web_session_id| provided. // Note: UpdateSession() and ReleaseSession() should only be called after diff --git a/media/blink/cdm_session_adapter.cc b/media/blink/cdm_session_adapter.cc index 7897084..a5cb14e 100644 --- a/media/blink/cdm_session_adapter.cc +++ b/media/blink/cdm_session_adapter.cc @@ -76,11 +76,9 @@ void CdmSessionAdapter::InitializeNewSession( int init_data_length, MediaKeys::SessionType session_type, scoped_ptr<NewSessionCdmPromise> promise) { - media_keys_->CreateSession(init_data_type, - init_data, - init_data_length, - session_type, - promise.Pass()); + media_keys_->CreateSessionAndGenerateRequest(session_type, init_data_type, + init_data, init_data_length, + promise.Pass()); } void CdmSessionAdapter::LoadSession( diff --git a/media/cdm/aes_decryptor.cc b/media/cdm/aes_decryptor.cc index 9938bae..fe37341 100644 --- a/media/cdm/aes_decryptor.cc +++ b/media/cdm/aes_decryptor.cc @@ -245,11 +245,12 @@ void AesDecryptor::SetServerCertificate(const uint8* certificate_data, NOT_SUPPORTED_ERROR, 0, "SetServerCertificate() is not supported."); } -void AesDecryptor::CreateSession(const std::string& init_data_type, - const uint8* init_data, - int init_data_length, - SessionType session_type, - scoped_ptr<NewSessionCdmPromise> promise) { +void AesDecryptor::CreateSessionAndGenerateRequest( + SessionType session_type, + const std::string& init_data_type, + const uint8* init_data, + int init_data_length, + scoped_ptr<NewSessionCdmPromise> promise) { std::string web_session_id(base::UintToString(next_web_session_id_++)); valid_sessions_.insert(web_session_id); diff --git a/media/cdm/aes_decryptor.h b/media/cdm/aes_decryptor.h index cf89933..9324520 100644 --- a/media/cdm/aes_decryptor.h +++ b/media/cdm/aes_decryptor.h @@ -39,11 +39,12 @@ class MEDIA_EXPORT AesDecryptor : public MediaKeys, void SetServerCertificate(const uint8* certificate_data, int certificate_data_length, scoped_ptr<SimpleCdmPromise> promise) override; - void CreateSession(const std::string& init_data_type, - const uint8* init_data, - int init_data_length, - SessionType session_type, - scoped_ptr<NewSessionCdmPromise> promise) override; + void CreateSessionAndGenerateRequest( + SessionType session_type, + const std::string& init_data_type, + const uint8* init_data, + int init_data_length, + scoped_ptr<NewSessionCdmPromise> promise) override; void LoadSession(const std::string& web_session_id, scoped_ptr<NewSessionCdmPromise> promise) override; void UpdateSession(const std::string& web_session_id, diff --git a/media/cdm/aes_decryptor_unittest.cc b/media/cdm/aes_decryptor_unittest.cc index 6af82d7..fb2f299 100644 --- a/media/cdm/aes_decryptor_unittest.cc +++ b/media/cdm/aes_decryptor_unittest.cc @@ -283,11 +283,9 @@ class AesDecryptorTest : public testing::Test { EXPECT_CALL(*this, OnSessionMessage( IsNotEmpty(), IsJSONDictionary(), GURL::EmptyGURL())); - decryptor_.CreateSession(std::string(), - &key_id[0], - key_id.size(), - MediaKeys::TEMPORARY_SESSION, - CreateSessionPromise(RESOLVED)); + decryptor_.CreateSessionAndGenerateRequest( + MediaKeys::TEMPORARY_SESSION, std::string(), &key_id[0], key_id.size(), + CreateSessionPromise(RESOLVED)); // This expects the promise to be called synchronously, which is the case // for AesDecryptor. return web_session_id_; @@ -412,37 +410,29 @@ class AesDecryptorTest : public testing::Test { TEST_F(AesDecryptorTest, CreateSessionWithNullInitData) { EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), IsEmpty(), GURL::EmptyGURL())); - decryptor_.CreateSession(std::string(), - NULL, - 0, - MediaKeys::TEMPORARY_SESSION, - CreateSessionPromise(RESOLVED)); + decryptor_.CreateSessionAndGenerateRequest(MediaKeys::TEMPORARY_SESSION, + std::string(), NULL, 0, + CreateSessionPromise(RESOLVED)); } TEST_F(AesDecryptorTest, MultipleCreateSession) { EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), IsEmpty(), GURL::EmptyGURL())); - decryptor_.CreateSession(std::string(), - NULL, - 0, - MediaKeys::TEMPORARY_SESSION, - CreateSessionPromise(RESOLVED)); + decryptor_.CreateSessionAndGenerateRequest(MediaKeys::TEMPORARY_SESSION, + std::string(), NULL, 0, + CreateSessionPromise(RESOLVED)); EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), IsEmpty(), GURL::EmptyGURL())); - decryptor_.CreateSession(std::string(), - NULL, - 0, - MediaKeys::TEMPORARY_SESSION, - CreateSessionPromise(RESOLVED)); + decryptor_.CreateSessionAndGenerateRequest(MediaKeys::TEMPORARY_SESSION, + std::string(), NULL, 0, + CreateSessionPromise(RESOLVED)); EXPECT_CALL(*this, OnSessionMessage(IsNotEmpty(), IsEmpty(), GURL::EmptyGURL())); - decryptor_.CreateSession(std::string(), - NULL, - 0, - MediaKeys::TEMPORARY_SESSION, - CreateSessionPromise(RESOLVED)); + decryptor_.CreateSessionAndGenerateRequest(MediaKeys::TEMPORARY_SESSION, + std::string(), NULL, 0, + CreateSessionPromise(RESOLVED)); } TEST_F(AesDecryptorTest, NormalDecryption) { diff --git a/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc b/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc index ecb757e..62cde9c 100644 --- a/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc +++ b/media/cdm/ppapi/external_clear_key/clear_key_cdm.cc @@ -254,11 +254,10 @@ void ClearKeyCdm::CreateSession(uint32 promise_id, base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this), promise_id))); - decryptor_.CreateSession(std::string(init_data_type, init_data_type_size), - init_data, - init_data_size, - ConvertSessionType(session_type), - promise.Pass()); + decryptor_.CreateSessionAndGenerateRequest( + ConvertSessionType(session_type), + std::string(init_data_type, init_data_type_size), init_data, + init_data_size, promise.Pass()); if (key_system_ == kExternalClearKeyFileIOTestKeySystem) StartFileIOTest(); @@ -292,11 +291,9 @@ void ClearKeyCdm::LoadSession(uint32 promise_id, base::Bind(&ClearKeyCdm::OnPromiseFailed, base::Unretained(this), promise_id))); - decryptor_.CreateSession(std::string(kLoadableSessionContentType), - NULL, - 0, - MediaKeys::TEMPORARY_SESSION, - promise.Pass()); + decryptor_.CreateSessionAndGenerateRequest( + MediaKeys::TEMPORARY_SESSION, std::string(kLoadableSessionContentType), + NULL, 0, promise.Pass()); } void ClearKeyCdm::UpdateSession(uint32 promise_id, diff --git a/media/cdm/proxy_decryptor.cc b/media/cdm/proxy_decryptor.cc index 85e863a..80778df 100644 --- a/media/cdm/proxy_decryptor.cc +++ b/media/cdm/proxy_decryptor.cc @@ -115,11 +115,9 @@ bool ProxyDecryptor::GenerateKeyRequest(const std::string& init_data_type, ? MediaKeys::PERSISTENT_SESSION : MediaKeys::TEMPORARY_SESSION; - media_keys_->CreateSession(init_data_type, - init_data_vector_data, - init_data_vector.size(), - session_type, - promise.Pass()); + media_keys_->CreateSessionAndGenerateRequest( + session_type, init_data_type, init_data_vector_data, + init_data_vector.size(), promise.Pass()); return true; } diff --git a/media/mojo/interfaces/content_decryption_module.mojom b/media/mojo/interfaces/content_decryption_module.mojom index 9dbc824..e462f7a 100644 --- a/media/mojo/interfaces/content_decryption_module.mojom +++ b/media/mojo/interfaces/content_decryption_module.mojom @@ -49,9 +49,9 @@ interface ContentDecryptionModule { // Creates a session with the |init_data_type|, |init_data| and |session_type| // provided. If |result.success| is false, the output |session_id| will be // null. - CreateSession(string init_data_type, - array<uint8> init_data, - SessionType session_type) + CreateSessionAndGenerateRequest(SessionType session_type, + string init_data_type, + array<uint8> init_data) => (CdmPromiseResult result, string? session_id); // Loads the session associated with |session_id|. Combinations of diff --git a/media/mojo/services/mojo_cdm.cc b/media/mojo/services/mojo_cdm.cc index 7822700..a857afe2 100644 --- a/media/mojo/services/mojo_cdm.cc +++ b/media/mojo/services/mojo_cdm.cc @@ -66,14 +66,15 @@ void MojoCdm::SetServerCertificate(const uint8_t* certificate_data, base::Passed(&promise))); } -void MojoCdm::CreateSession(const std::string& init_data_type, - const uint8_t* init_data, - int init_data_length, - SessionType session_type, - scoped_ptr<NewSessionCdmPromise> promise) { - remote_cdm_->CreateSession( - init_data_type, CreateMojoArray(init_data, init_data_length), +void MojoCdm::CreateSessionAndGenerateRequest( + SessionType session_type, + const std::string& init_data_type, + const uint8_t* init_data, + int init_data_length, + scoped_ptr<NewSessionCdmPromise> promise) { + remote_cdm_->CreateSessionAndGenerateRequest( static_cast<mojo::ContentDecryptionModule::SessionType>(session_type), + init_data_type, CreateMojoArray(init_data, init_data_length), base::Bind(&MojoCdm::OnPromiseResult<std::string>, weak_factory_.GetWeakPtr(), base::Passed(&promise))); } diff --git a/media/mojo/services/mojo_cdm.h b/media/mojo/services/mojo_cdm.h index 1f66b05..b644dd9 100644 --- a/media/mojo/services/mojo_cdm.h +++ b/media/mojo/services/mojo_cdm.h @@ -36,11 +36,12 @@ class MojoCdm : public MediaKeys, public mojo::ContentDecryptionModuleClient { void SetServerCertificate(const uint8_t* certificate_data, int certificate_data_length, scoped_ptr<SimpleCdmPromise> promise) final; - void CreateSession(const std::string& init_data_type, - const uint8_t* init_data, - int init_data_length, - SessionType session_type, - scoped_ptr<NewSessionCdmPromise> promise) final; + void CreateSessionAndGenerateRequest( + SessionType session_type, + const std::string& init_data_type, + const uint8_t* init_data, + int init_data_length, + scoped_ptr<NewSessionCdmPromise> promise) final; void LoadSession(const std::string& session_id, scoped_ptr<NewSessionCdmPromise> promise) final; void UpdateSession(const std::string& session_id, diff --git a/media/mojo/services/mojo_cdm_service.cc b/media/mojo/services/mojo_cdm_service.cc index 8b6673b..3f83c39 100644 --- a/media/mojo/services/mojo_cdm_service.cc +++ b/media/mojo/services/mojo_cdm_service.cc @@ -45,18 +45,18 @@ void MojoCdmService::SetServerCertificate( scoped_ptr<SimpleCdmPromise>(new SimpleMojoCdmPromise(callback))); } -void MojoCdmService::CreateSession( +void MojoCdmService::CreateSessionAndGenerateRequest( + mojo::ContentDecryptionModule::SessionType session_type, const mojo::String& init_data_type, mojo::Array<uint8_t> init_data, - mojo::ContentDecryptionModule::SessionType session_type, const mojo::Callback<void(mojo::CdmPromiseResultPtr, mojo::String)>& callback) { const std::vector<uint8_t>& init_data_vector = init_data.storage(); - cdm_->CreateSession( + cdm_->CreateSessionAndGenerateRequest( + static_cast<MediaKeys::SessionType>(session_type), init_data_type.To<std::string>(), init_data_vector.empty() ? nullptr : &init_data_vector[0], init_data_vector.size(), - static_cast<MediaKeys::SessionType>(session_type), scoped_ptr<NewSessionCdmPromise>(new NewSessionMojoCdmPromise(callback))); } diff --git a/media/mojo/services/mojo_cdm_service.h b/media/mojo/services/mojo_cdm_service.h index 7bb7869..17356c9 100644 --- a/media/mojo/services/mojo_cdm_service.h +++ b/media/mojo/services/mojo_cdm_service.h @@ -26,11 +26,12 @@ class MojoCdmService void SetServerCertificate( mojo::Array<uint8_t> certificate_data, const mojo::Callback<void(mojo::CdmPromiseResultPtr)>& callback) final; - void CreateSession(const mojo::String& init_data_type, - mojo::Array<uint8_t> init_data, - mojo::ContentDecryptionModule::SessionType session_type, - const mojo::Callback<void(mojo::CdmPromiseResultPtr, - mojo::String)>& callback) final; + void CreateSessionAndGenerateRequest( + mojo::ContentDecryptionModule::SessionType session_type, + const mojo::String& init_data_type, + mojo::Array<uint8_t> init_data, + const mojo::Callback<void(mojo::CdmPromiseResultPtr, mojo::String)>& + callback) final; void LoadSession(const mojo::String& session_id, const mojo::Callback<void(mojo::CdmPromiseResultPtr, mojo::String)>& callback) final; diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc index aa61f3a..7292b16 100644 --- a/media/test/pipeline_integration_test.cc +++ b/media/test/pipeline_integration_test.cc @@ -296,9 +296,9 @@ class KeyProvidingApp : public FakeEncryptedMedia::AppBase { const std::vector<uint8>& init_data, AesDecryptor* decryptor) override { if (current_session_id_.empty()) { - decryptor->CreateSession(init_data_type, kInitData, arraysize(kInitData), - MediaKeys::TEMPORARY_SESSION, - CreateSessionPromise(RESOLVED)); + decryptor->CreateSessionAndGenerateRequest( + MediaKeys::TEMPORARY_SESSION, init_data_type, kInitData, + arraysize(kInitData), CreateSessionPromise(RESOLVED)); EXPECT_FALSE(current_session_id_.empty()); } @@ -342,9 +342,10 @@ class RotatingKeyProvidingApp : public KeyProvidingApp { prev_init_data_ = init_data; ++num_distint_need_key_calls_; - decryptor->CreateSession(init_data_type, vector_as_array(&init_data), - init_data.size(), MediaKeys::TEMPORARY_SESSION, - CreateSessionPromise(RESOLVED)); + decryptor->CreateSessionAndGenerateRequest( + MediaKeys::TEMPORARY_SESSION, init_data_type, + vector_as_array(&init_data), init_data.size(), + CreateSessionPromise(RESOLVED)); std::vector<uint8> key_id; std::vector<uint8> key; |