Index: content/renderer/media/webcontentdecryptionmodulesession_impl.h |
diff --git a/content/renderer/media/webcontentdecryptionmodulesession_impl.h b/content/renderer/media/webcontentdecryptionmodulesession_impl.h |
index f61a71363c477cb8d0f98210b367a96400758fab..2333acee2d8209f914125b90601bf455c1786c3c 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,31 @@ class WebContentDecryptionModuleSessionImpl |
virtual void release(); |
// Callbacks. |
- void OnSessionCreated(const std::string& web_session_id); |
void OnSessionMessage(const std::vector<uint8>& message, |
const GURL& destination_url); |
void OnSessionReady(); |
void OnSessionClosed(); |
- void OnSessionError(media::MediaKeys::KeyError error_code, |
- uint32 system_code); |
+ void OnSessionError(media::MediaKeys::Exception exception_code, |
+ uint32 system_code, |
+ const std::string& error_message); |
private: |
+ void SessionCreated(const std::string& web_session_id); |
+ |
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); |
}; |