Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Unified Diff: content/renderer/media/webcontentdecryptionmodulesession_impl.h

Issue 265993002: Add Promises for EME (Chromium side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e8552e3ff19e99d76e7249ab8c1818d28bc1bf91 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 std::string& destination_url);
void OnSessionReady();
void OnSessionClosed();
- void OnSessionError(media::MediaKeys::KeyError error_code,
- uint32 system_code);
+ void OnSessionError(const std::string& error_name,
+ uint32 system_code,
+ const std::string& error_message);
private:
+ // Helpers
ddorwin 2014/05/05 18:35:42 nit: Unnecessary.
jrummell 2014/05/08 23:37:45 Done.
+ void setSessionId(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_;
+ // NOTE: Since promises will last until they are fired, keep a weak reference
ddorwin 2014/05/05 18:35:42 nits: Remove "NOTE: " s/last/live/ _they_ keep? <-
jrummell 2014/05/08 23:37:45 Comment changed.
+ // in case this class disappears before the promise actually fires.
+ base::WeakPtrFactory<WebContentDecryptionModuleSessionImpl> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(WebContentDecryptionModuleSessionImpl);
};

Powered by Google App Engine
This is Rietveld 408576698