| Index: content/renderer/media/webcontentdecryptionmodulesession_impl.h
|
| diff --git a/content/renderer/media/webcontentdecryptionmodulesession_impl.h b/content/renderer/media/webcontentdecryptionmodulesession_impl.h
|
| index add26cab2334da9029629707db1d9b9ea089bc79..26b22f052023dc30eeb796d87b6bc4f7d55b23d8 100644
|
| --- a/content/renderer/media/webcontentdecryptionmodulesession_impl.h
|
| +++ b/content/renderer/media/webcontentdecryptionmodulesession_impl.h
|
| @@ -11,6 +11,7 @@
|
| #include "base/basictypes.h"
|
| #include "base/callback.h"
|
| #include "base/memory/ref_counted.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "media/base/media_keys.h"
|
| #include "third_party/WebKit/public/platform/WebContentDecryptionModuleSession.h"
|
| #include "third_party/WebKit/public/platform/WebString.h"
|
| @@ -26,7 +27,6 @@ class WebContentDecryptionModuleSessionImpl
|
| : public blink::WebContentDecryptionModuleSession {
|
| public:
|
| WebContentDecryptionModuleSessionImpl(
|
| - uint32 session_id,
|
| Client* client,
|
| const scoped_refptr<CdmSessionAdapter>& adapter);
|
| virtual ~WebContentDecryptionModuleSessionImpl();
|
| @@ -40,27 +40,42 @@ class WebContentDecryptionModuleSessionImpl
|
| virtual void release();
|
|
|
| // Callbacks.
|
| - void OnSessionCreated(const std::string& web_session_id);
|
| void OnSessionMessage(const std::vector<uint8>& message,
|
| const std::string& destination_url);
|
| void OnSessionReady();
|
| void OnSessionClosed();
|
| - void OnSessionError(media::MediaKeys::KeyError error_code,
|
| - uint32 system_code);
|
| + void OnSessionError(media::MediaKeys::MediaKeysException exception_code,
|
| + uint32 system_code,
|
| + const std::string& error_message);
|
|
|
| private:
|
| + void SessionCreated(const std::string& web_session_id);
|
| + void SessionCreateFailed(media::MediaKeys::MediaKeysException exception_code,
|
| + uint32 system_code,
|
| + const std::string& error_message);
|
| + void SessionUpdated();
|
| + void SessionUpdateFailed(media::MediaKeys::MediaKeysException exception_code,
|
| + uint32 system_code,
|
| + const std::string& error_message);
|
| + void SessionReleased();
|
| + void SessionReleaseFailed(media::MediaKeys::MediaKeysException exception_code,
|
| + uint32 system_code,
|
| + const std::string& error_message);
|
| +
|
| scoped_refptr<CdmSessionAdapter> adapter_;
|
|
|
| // Non-owned pointer.
|
| Client* client_;
|
|
|
| // Web session ID is the app visible ID for this session generated by the CDM.
|
| - // This value is not set until the CDM calls OnSessionCreated().
|
| - blink::WebString web_session_id_;
|
| + // This value is not set until the CDM resolves the initializeNewSession()
|
| + // promise.
|
| + std::string web_session_id_;
|
|
|
| - // Session ID is used to uniquely track this object so that CDM callbacks
|
| - // can get routed to the correct object.
|
| - const uint32 session_id_;
|
| + // Since promises will live until they are fired, use a weak reference when
|
| + // creating a promise in case this class disappears before the promise
|
| + // actually fires.
|
| + base::WeakPtrFactory<WebContentDecryptionModuleSessionImpl> weak_ptr_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl);
|
| };
|
|
|