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

Unified Diff: media/base/android/media_drm_bridge.h

Issue 2823513002: [Clank] Load origin id before create MediaDrmBridge (Closed)
Patch Set: Test Created 3 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: media/base/android/media_drm_bridge.h
diff --git a/media/base/android/media_drm_bridge.h b/media/base/android/media_drm_bridge.h
index 6dc26a4574cf3b89cf0d906dc9410adcd1746004..f249bc387f0e185adc08f7049055f59700acd76a 100644
--- a/media/base/android/media_drm_bridge.h
+++ b/media/base/android/media_drm_bridge.h
@@ -67,6 +67,9 @@ class MEDIA_EXPORT MediaDrmBridge : public ContentDecryptionModule,
using MediaCryptoReadyCB = base::Callback<void(JavaObjectPtr media_crypto,
bool needs_protected_surface)>;
+ using MediaDrmCreatedCB =
xhwang 2017/05/03 06:00:55 nit: how about just CreationCB? Or it needs to be
yucliu1 2017/05/10 20:41:38 Done.
+ base::OnceCallback<void(scoped_refptr<MediaDrmBridge>)>;
+
// Checks whether MediaDRM is available and usable, including for decoding.
// All other static methods check IsAvailable() or equivalent internally.
// There is no need to check IsAvailable() explicitly before calling them.
@@ -92,7 +95,7 @@ class MEDIA_EXPORT MediaDrmBridge : public ContentDecryptionModule,
// Returns a MediaDrmBridge instance if |key_system| and |security_level| are
// supported, and nullptr otherwise. The default security level will be used
// if |security_level| is SECURITY_LEVEL_DEFAULT.
- static scoped_refptr<MediaDrmBridge> Create(
+ static void Create(
const std::string& key_system,
const GURL& security_origin,
SecurityLevel security_level,
@@ -101,16 +104,18 @@ class MEDIA_EXPORT MediaDrmBridge : public ContentDecryptionModule,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const SessionKeysChangeCB& session_keys_change_cb,
- const SessionExpirationUpdateCB& session_expiration_update_cb);
+ const SessionExpirationUpdateCB& session_expiration_update_cb,
+ MediaDrmCreatedCB bound_cdm_created_cb);
xhwang 2017/05/03 06:00:56 ditto, just "CreationCB creation_cb"? "bound" is r
yucliu1 2017/05/10 20:41:38 Done.
// Same as Create() except that no session callbacks are provided. This is
// used when we need to use MediaDrmBridge without creating any sessions.
// TODO(yucliu): Pass |security_origin| here to clear per-origin certs and
// licenses.
- static scoped_refptr<MediaDrmBridge> CreateWithoutSessionSupport(
+ static void CreateWithoutSessionSupport(
const std::string& key_system,
SecurityLevel security_level,
- const CreateFetcherCB& create_fetcher_cb);
+ const CreateFetcherCB& create_fetcher_cb,
+ MediaDrmCreatedCB media_drm_created_cb);
// ContentDecryptionModule implementation.
void SetServerCertificate(
@@ -245,26 +250,25 @@ class MEDIA_EXPORT MediaDrmBridge : public ContentDecryptionModule,
// For DeleteSoon() in DeleteOnCorrectThread().
friend class base::DeleteHelper<MediaDrmBridge>;
- static scoped_refptr<MediaDrmBridge> CreateInternal(
- const std::string& key_system,
- const GURL& security_origin,
+ static void CreateInternal(
+ const std::vector<uint8_t>& scheme_uuid,
SecurityLevel security_level,
+ std::unique_ptr<MediaDrmStorageBridge> storage,
const CreateFetcherCB& create_fetcher_cb,
- const CreateStorageCB& create_storage_cb,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const SessionKeysChangeCB& session_keys_change_cb,
- const SessionExpirationUpdateCB& session_expiration_update_cb);
+ const SessionExpirationUpdateCB& session_expiration_update_cb,
+ MediaDrmCreatedCB bound_cdm_created_cb);
// Constructs a MediaDrmBridge for |scheme_uuid| and |security_level|. The
// default security level will be used if |security_level| is
// SECURITY_LEVEL_DEFAULT. Sessions should not be created if session callbacks
// are null.
MediaDrmBridge(const std::vector<uint8_t>& scheme_uuid,
- const GURL& security_origin,
SecurityLevel security_level,
+ std::unique_ptr<MediaDrmStorageBridge> storage,
const CreateFetcherCB& create_fetcher_cb,
- const CreateStorageCB& create_storage_cb,
const SessionMessageCB& session_message_cb,
const SessionClosedCB& session_closed_cb,
const SessionKeysChangeCB& session_keys_change_cb,
@@ -293,8 +297,9 @@ class MEDIA_EXPORT MediaDrmBridge : public ContentDecryptionModule,
// UUID of the key system.
std::vector<uint8_t> scheme_uuid_;
- // Persistent storage for session ID map.
- MediaDrmStorageBridge storage_;
+ // Persistent storage for session ID map. It may or may not be bound to an
+ // origin.
+ std::unique_ptr<MediaDrmStorageBridge> storage_;
// Java MediaDrm instance.
base::android::ScopedJavaGlobalRef<jobject> j_media_drm_;

Powered by Google App Engine
This is Rietveld 408576698