Chromium Code Reviews| Index: content/renderer/media/cdm_session_adapter.h |
| diff --git a/content/renderer/media/cdm_session_adapter.h b/content/renderer/media/cdm_session_adapter.h |
| index 1756054a86d217ad56eeaaff0174389f513874cf..873f5a2f1387c4e1e966fcdfc09a94ed16101bd9 100644 |
| --- a/content/renderer/media/cdm_session_adapter.h |
| +++ b/content/renderer/media/cdm_session_adapter.h |
| @@ -11,6 +11,7 @@ |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/weak_ptr.h" |
| #include "media/base/media_keys.h" |
| +#include "media/base/media_keys_session_promise.h" |
| #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h" |
| #if defined(ENABLE_PEPPER_CDMS) |
| @@ -40,27 +41,38 @@ class CdmSessionAdapter : public base::RefCounted<CdmSessionAdapter> { |
| const GURL& security_origin); |
| // Creates a new session and adds it to the internal map. The caller owns the |
| - // created session. RemoveSession() must be called when destroying it. |
| + // created session. |
|
ddorwin
2014/05/05 18:35:42
Why was the following removed? Is it no longer tru
jrummell
2014/05/08 23:37:45
Added back (with explanation).
|
| WebContentDecryptionModuleSessionImpl* CreateSession( |
| blink::WebContentDecryptionModuleSession::Client* client); |
| + // Adds a session to the internal map. Called once the session is successfully |
| + // initialized. |
| + void RegisterSession( |
| + const std::string& web_session_id, |
| + base::WeakPtr<WebContentDecryptionModuleSessionImpl> session); |
| + |
| // Removes a session from the internal map. |
| - void RemoveSession(uint32 session_id); |
| + void RemoveSession(const std::string& web_session_id); |
| - // Initializes the session specified by |session_id| with the |content_type| |
| - // and |init_data| provided. |
| - void InitializeNewSession(uint32 session_id, |
| - const std::string& content_type, |
| + // Initializes a session with the |init_data_type|, |init_data| and |
| + // |session_type| provided. Takes ownership of |promise|. |
| + void InitializeNewSession(const std::string& init_data_type, |
| const uint8* init_data, |
| - int init_data_length); |
| + int init_data_length, |
| + media::MediaKeys::SessionType session_type, |
| + scoped_ptr<media::MediaKeysSessionPromise> promise); |
| - // Updates the session specified by |session_id| with |response|. |
| - void UpdateSession(uint32 session_id, |
| + // Updates the session specified by |web_session_id| with |response|. |
| + // Takes ownership of |promise|. |
| + void UpdateSession(const std::string& web_session_id, |
| const uint8* response, |
| - int response_length); |
| + int response_length, |
| + scoped_ptr<media::MediaKeysSessionPromise> promise); |
| - // Releases the session specified by |session_id|. |
| - void ReleaseSession(uint32 session_id); |
| + // Releases the session specified by |web_session_id|. |
| + // Takes ownership of |promise|. |
| + void ReleaseSession(const std::string& web_session_id, |
| + scoped_ptr<media::MediaKeysSessionPromise> promise); |
| // Returns the Decryptor associated with this CDM. May be NULL if no |
| // Decryptor is associated with the MediaKeys object. |
| @@ -76,26 +88,26 @@ class CdmSessionAdapter : public base::RefCounted<CdmSessionAdapter> { |
| private: |
| friend class base::RefCounted<CdmSessionAdapter>; |
| - typedef std::map<uint32, WebContentDecryptionModuleSessionImpl*> SessionMap; |
| + typedef std::map<std::string, |
|
xhwang
2014/05/05 20:46:42
Since the key is now a string, we should use hash_
jrummell
2014/05/08 23:37:45
Done.
|
| + base::WeakPtr<WebContentDecryptionModuleSessionImpl> > |
| + SessionMap; |
| ~CdmSessionAdapter(); |
| // Callbacks for firing session events. |
| - void OnSessionCreated(uint32 session_id, const std::string& web_session_id); |
| - void OnSessionMessage(uint32 session_id, |
| + void OnSessionMessage(const std::string& web_session_id, |
| const std::vector<uint8>& message, |
| const std::string& destination_url); |
| - void OnSessionReady(uint32 session_id); |
| - void OnSessionClosed(uint32 session_id); |
| - void OnSessionError(uint32 session_id, |
| - media::MediaKeys::KeyError error_code, |
| - uint32 system_code); |
| + void OnSessionReady(const std::string& web_session_id); |
| + void OnSessionClosed(const std::string& web_session_id); |
| + void OnSessionError(const std::string& web_session_id, |
| + const std::string& error_name, |
| + uint32 system_code, |
| + const std::string& error_message); |
| // Helper function of the callbacks. |
| - WebContentDecryptionModuleSessionImpl* GetSession(uint32 session_id); |
| - |
| - // Session ID should be unique per renderer process for debugging purposes. |
| - static uint32 next_session_id_; |
| + WebContentDecryptionModuleSessionImpl* GetSession( |
| + const std::string& web_session_id); |
| scoped_ptr<media::MediaKeys> media_keys_; |