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

Unified Diff: chromecast/media/cdm/browser_cdm_cast.h

Issue 1407933010: media: Make MediaKeys ref-counted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 1 month 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
« no previous file with comments | « chromecast/browser/media/cma_message_filter_host.cc ('k') | chromecast/media/cdm/browser_cdm_cast.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/media/cdm/browser_cdm_cast.h
diff --git a/chromecast/media/cdm/browser_cdm_cast.h b/chromecast/media/cdm/browser_cdm_cast.h
index a4c80fb748a8a078d9a07cf80c9e3c6814b0f7b5..b738b009a39aa755c4198d402c28e49f36fa2273 100644
--- a/chromecast/media/cdm/browser_cdm_cast.h
+++ b/chromecast/media/cdm/browser_cdm_cast.h
@@ -14,8 +14,10 @@
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "base/sequenced_task_runner_helpers.h"
#include "base/threading/thread_checker.h"
-#include "media/base/browser_cdm.h"
+#include "media/base/media_keys.h"
+#include "media/base/player_tracker.h"
#include "media/cdm/json_web_key.h"
namespace base {
@@ -30,17 +32,17 @@ namespace chromecast {
namespace media {
class DecryptContextImpl;
-// BrowserCdmCast is an extension of BrowserCdm that provides common
+// BrowserCdmCast is an extension of MediaKeys that provides common
// functionality across CDM implementations.
// All these additional functions are synchronous so:
// - either both the CDM and the media pipeline must be running on the same
// thread,
// - or BrowserCdmCast implementations must use some locks.
//
-class BrowserCdmCast : public ::media::BrowserCdm {
+class BrowserCdmCast : public ::media::MediaKeys,
+ public ::media::PlayerTracker {
public:
BrowserCdmCast();
- ~BrowserCdmCast() override;
void Initialize(
const ::media::SessionMessageCB& session_message_cb,
@@ -49,12 +51,12 @@ class BrowserCdmCast : public ::media::BrowserCdm {
const ::media::SessionKeysChangeCB& session_keys_change_cb,
const ::media::SessionExpirationUpdateCB& session_expiration_update_cb);
- // PlayerTracker implementation.
+ // ::media::PlayerTracker implementation.
int RegisterPlayer(const base::Closure& new_key_cb,
const base::Closure& cdm_unset_cb) override;
void UnregisterPlayer(int registration_id) override;
- // ::media::BrowserCdm implementation:
+ // ::media::MediaKeys implementation:
::media::CdmContext* GetCdmContext() override;
// Returns the decryption context needed to decrypt frames encrypted with
@@ -75,6 +77,8 @@ class BrowserCdmCast : public ::media::BrowserCdm {
private:
friend class BrowserCdmCastUi;
+ ~BrowserCdmCast() override;
+
// Allow subclasses to override to provide key sysytem specific
// initialization.
virtual void InitializeInternal();
@@ -92,24 +96,20 @@ class BrowserCdmCast : public ::media::BrowserCdm {
DISALLOW_COPY_AND_ASSIGN(BrowserCdmCast);
};
-// BrowserCdm implementation that lives on the UI thread and forwards all calls
+// MediaKeys implementation that lives on the UI thread and forwards all calls
// to a BrowserCdmCast instance on the CMA thread. This is used to simplify the
// UI-CMA threading interaction.
-class BrowserCdmCastUi : public ::media::BrowserCdm {
+class BrowserCdmCastUi : public ::media::MediaKeys {
public:
BrowserCdmCastUi(
- scoped_ptr<BrowserCdmCast> browser_cdm_cast,
+ const scoped_refptr<BrowserCdmCast>& browser_cdm_cast,
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
- ~BrowserCdmCastUi() override;
-
- // PlayerTracker implementation:
- int RegisterPlayer(const base::Closure& new_key_cb,
- const base::Closure& cdm_unset_cb) override;
- void UnregisterPlayer(int registration_id) override;
BrowserCdmCast* browser_cdm_cast() const;
private:
+ ~BrowserCdmCastUi() override;
+
// ::media::MediaKeys implementation:
void SetServerCertificate(
const std::vector<uint8_t>& certificate,
@@ -131,7 +131,7 @@ class BrowserCdmCastUi : public ::media::BrowserCdm {
scoped_ptr<::media::SimpleCdmPromise> promise) override;
::media::CdmContext* GetCdmContext() override;
- scoped_ptr<BrowserCdmCast> browser_cdm_cast_;
+ scoped_refptr<BrowserCdmCast> browser_cdm_cast_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
base::ThreadChecker thread_checker_;
« no previous file with comments | « chromecast/browser/media/cma_message_filter_host.cc ('k') | chromecast/media/cdm/browser_cdm_cast.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698