| Index: content/renderer/pepper/content_decryptor_delegate.h
|
| diff --git a/content/renderer/pepper/content_decryptor_delegate.h b/content/renderer/pepper/content_decryptor_delegate.h
|
| index 3fb1ee4db40e9db3764ce9255e076d94002616eb..bedf189c9740f2367219ade1e661d07fdbdce4b5 100644
|
| --- a/content/renderer/pepper/content_decryptor_delegate.h
|
| +++ b/content/renderer/pepper/content_decryptor_delegate.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_
|
| #define CONTENT_RENDERER_PEPPER_CONTENT_DECRYPTOR_DELEGATE_H_
|
|
|
| +#include <map>
|
| #include <queue>
|
| #include <string>
|
|
|
| @@ -43,7 +44,6 @@ class ContentDecryptorDelegate {
|
|
|
| // This object should not be accessed after |fatal_plugin_error_cb| is called.
|
| void Initialize(const std::string& key_system,
|
| - const media::SessionCreatedCB& session_created_cb,
|
| const media::SessionMessageCB& session_message_cb,
|
| const media::SessionReadyCB& session_ready_cb,
|
| const media::SessionClosedCB& session_closed_cb,
|
| @@ -53,15 +53,19 @@ class ContentDecryptorDelegate {
|
| void InstanceCrashed();
|
|
|
| // Provides access to PPP_ContentDecryptor_Private.
|
| - bool CreateSession(uint32 session_id,
|
| - const std::string& content_type,
|
| + void CreateSession(const std::string& init_data_type,
|
| const uint8* init_data,
|
| - int init_data_length);
|
| - void LoadSession(uint32 session_id, const std::string& web_session_id);
|
| - bool UpdateSession(uint32 session_id,
|
| + int init_data_length,
|
| + media::MediaKeys::SessionType session_type,
|
| + scoped_ptr<media::CdmPromise<std::string> > promise);
|
| + void LoadSession(const std::string& web_session_id,
|
| + scoped_ptr<media::CdmPromise<std::string> > promise);
|
| + void UpdateSession(const std::string& web_session_id,
|
| const uint8* response,
|
| - int response_length);
|
| - bool ReleaseSession(uint32 session_id);
|
| + int response_length,
|
| + scoped_ptr<media::CdmPromise<void> > promise);
|
| + void ReleaseSession(const std::string& web_session_id,
|
| + scoped_ptr<media::CdmPromise<void> > promise);
|
| bool Decrypt(media::Decryptor::StreamType stream_type,
|
| const scoped_refptr<media::DecoderBuffer>& encrypted_buffer,
|
| const media::Decryptor::DecryptCB& decrypt_cb);
|
| @@ -85,15 +89,22 @@ class ContentDecryptorDelegate {
|
| const media::Decryptor::VideoDecodeCB& video_decode_cb);
|
|
|
| // PPB_ContentDecryptor_Private dispatching methods.
|
| - void OnSessionCreated(uint32 session_id, PP_Var web_session_id_var);
|
| - void OnSessionMessage(uint32 session_id,
|
| - PP_Var message,
|
| - PP_Var destination_url);
|
| - void OnSessionReady(uint32 session_id);
|
| - void OnSessionClosed(uint32 session_id);
|
| - void OnSessionError(uint32 session_id,
|
| - int32_t media_error,
|
| - uint32_t system_code);
|
| + void OnPromiseResolved(uint32 promise_id);
|
| + void OnPromiseResolvedWithSession(uint32 promise_id,
|
| + PP_Var web_session_id_var);
|
| + void OnPromiseRejected(uint32 promise_id,
|
| + PP_ExceptionCodeType exception_code,
|
| + uint32 system_code,
|
| + PP_Var error_description_var);
|
| + void OnSessionMessage(PP_Var web_session_id_var,
|
| + PP_Var message_var,
|
| + PP_Var destination_url_var);
|
| + void OnSessionReady(PP_Var web_session_id_var);
|
| + void OnSessionClosed(PP_Var web_session_id_var);
|
| + void OnSessionError(PP_Var web_session_id_var,
|
| + PP_ExceptionCodeType exception_code,
|
| + uint32 system_code,
|
| + PP_Var error_description_var);
|
| void DeliverBlock(PP_Resource decrypted_block,
|
| const PP_DecryptedBlockInfo* block_info);
|
| void DecoderInitializeDone(PP_DecryptorStreamType decoder_type,
|
| @@ -171,6 +182,18 @@ class ContentDecryptorDelegate {
|
|
|
| void SatisfyAllPendingCallbacksOnError();
|
|
|
| + // Takes ownership of |promise| and returns an identifier to be passed via
|
| + // Pepper.
|
| + uint32_t SaveVoidPromise(scoped_ptr<media::CdmPromise<void> > promise);
|
| + uint32_t SaveSessionPromise(
|
| + scoped_ptr<media::CdmPromise<std::string> > promise);
|
| +
|
| + // Find the promise for a specified |promise_id|. Caller is responsible to
|
| + // delete the CdmPromise<> once done with it.
|
| + scoped_ptr<media::CdmPromise<void> > RetrieveVoidPromise(uint32_t promise_id);
|
| + scoped_ptr<media::CdmPromise<std::string> > RetrieveSessionPromise(
|
| + uint32_t promise_id);
|
| +
|
| const PP_Instance pp_instance_;
|
| const PPP_ContentDecryptor_Private* const plugin_decryption_interface_;
|
|
|
| @@ -178,7 +201,6 @@ class ContentDecryptorDelegate {
|
| std::string key_system_;
|
|
|
| // Callbacks for firing session events.
|
| - media::SessionCreatedCB session_created_cb_;
|
| media::SessionMessageCB session_message_cb_;
|
| media::SessionReadyCB session_ready_cb_;
|
| media::SessionClosedCB session_closed_cb_;
|
| @@ -214,6 +236,12 @@ class ContentDecryptorDelegate {
|
| int audio_channel_count_;
|
| media::ChannelLayout audio_channel_layout_;
|
|
|
| + // Keep track of outstanding promises. |promises_| has ownership of the
|
| + // promise.
|
| + uint32_t next_promise_id_;
|
| + std::map<uint32_t, media::CdmPromise<void>*> void_promises_;
|
| + std::map<uint32_t, media::CdmPromise<std::string>*> session_promises_;
|
| +
|
| base::WeakPtr<ContentDecryptorDelegate> weak_this_;
|
| base::WeakPtrFactory<ContentDecryptorDelegate> weak_ptr_factory_;
|
|
|
|
|