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

Unified Diff: content/renderer/media/crypto/proxy_decryptor.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/crypto/proxy_decryptor.h
diff --git a/content/renderer/media/crypto/proxy_decryptor.h b/content/renderer/media/crypto/proxy_decryptor.h
index 2919ef7c71a6c40aa5ead019974f6279af9f5f89..4dba3e1fc2313e2203cc2524a09171d662834021 100644
--- a/content/renderer/media/crypto/proxy_decryptor.h
+++ b/content/renderer/media/crypto/proxy_decryptor.h
@@ -5,7 +5,6 @@
#ifndef CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_
#define CONTENT_RENDERER_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_
-#include <map>
#include <set>
#include <string>
#include <vector>
@@ -16,6 +15,7 @@
#include "base/synchronization/lock.h"
#include "media/base/decryptor.h"
#include "media/base/media_keys.h"
+#include "media/base/media_keys_session_promise.h"
ddorwin 2014/05/05 18:35:42 Not used.
jrummell 2014/05/08 23:37:45 Done.
#if defined(ENABLE_PEPPER_CDMS)
#include "content/renderer/media/crypto/pepper_cdm_wrapper.h"
@@ -33,12 +33,6 @@ class RendererMediaPlayerManager;
// A decryptor proxy that creates a real decryptor object on demand and
// forwards decryptor calls to it.
//
-// Now that the Pepper API calls use session ID to match responses with
-// requests, this class maintains a mapping between session ID and web session
-// ID. Callers of this class expect web session IDs in the responses.
-// Session IDs are internal unique references to the session. Web session IDs
-// are the CDM generated ID for the session, and are what are visible to users.
-//
// TODO(xhwang): Currently we don't support run-time switching among decryptor
// objects. Fix this when needed.
// TODO(xhwang): The ProxyDecryptor is not a Decryptor. Find a better name!
@@ -89,31 +83,23 @@ class ProxyDecryptor {
void CancelKeyRequest(const std::string& session_id);
private:
- // Session_id <-> web_session_id map.
- typedef std::map<uint32, std::string> SessionIdMap;
-
// Helper function to create MediaKeys to handle the given |key_system|.
scoped_ptr<media::MediaKeys> CreateMediaKeys(const std::string& key_system,
const GURL& security_origin);
// 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& default_url);
- void OnSessionReady(uint32 session_id);
- void OnSessionClosed(uint32 session_id);
- void OnSessionError(uint32 session_id,
- media::MediaKeys::KeyError error_code,
- uint32 system_code);
-
- // Helper function to determine session_id for the provided |web_session_id|.
- uint32 LookupSessionId(const std::string& web_session_id) const;
+ 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 to determine web_session_id for the provided |session_id|.
- // The returned web_session_id is only valid on the main thread, and should be
- // stored by copy.
- const std::string& LookupWebSessionId(uint32 session_id) const;
+ // Called when a session is actually created or loaded.
+ void SetSessionId(bool persistent, const std::string& web_session_id);
#if defined(ENABLE_PEPPER_CDMS)
// Callback to create the Pepper plugin.
@@ -131,14 +117,8 @@ class ProxyDecryptor {
KeyErrorCB key_error_cb_;
KeyMessageCB key_message_cb_;
- // Session IDs are used to uniquely track sessions so that CDM callbacks
- // can get mapped to the correct session ID. Session ID should be unique
- // per renderer process for debugging purposes.
- static uint32 next_session_id_;
-
- SessionIdMap sessions_;
-
- std::set<uint32> persistent_sessions_;
+ std::set<std::string> active_sessions_;
+ std::set<std::string> persistent_sessions_;
bool is_clear_key_;

Powered by Google App Engine
This is Rietveld 408576698