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

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

Issue 835963005: Chromecast: use PlayerTrackerImpl in BrowserCdmCast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 5 years, 11 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
« no previous file with comments | « chromecast/media/cdm/browser_cdm_cast.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/media/cdm/browser_cdm_cast.cc
diff --git a/chromecast/media/cdm/browser_cdm_cast.cc b/chromecast/media/cdm/browser_cdm_cast.cc
index 33502f2aeb952c1d90fa70fa475ad9e281eff981..a1eeb44dea753468d67773dc56a87f267083d491 100644
--- a/chromecast/media/cdm/browser_cdm_cast.cc
+++ b/chromecast/media/cdm/browser_cdm_cast.cc
@@ -4,53 +4,32 @@
#include "chromecast/media/cdm/browser_cdm_cast.h"
+#include "base/bind.h"
#include "base/callback.h"
#include "base/location.h"
-#include "base/message_loop/message_loop_proxy.h"
#include "base/stl_util.h"
lcwu1 2015/01/08 18:42:59 I think both location.h and stil_util.h are not ne
gunsch 2015/01/08 18:58:32 Done: Looks like none of these are needed with now
namespace chromecast {
namespace media {
-BrowserCdmCast::BrowserCdmCast()
- : next_registration_id_(1) {
+BrowserCdmCast::BrowserCdmCast() {
}
BrowserCdmCast::~BrowserCdmCast() {
- // Call unset callbacks synchronously.
- for (std::map<uint32_t, base::Closure>::const_iterator it =
- cdm_unset_callbacks_.begin(); it != cdm_unset_callbacks_.end(); ++it) {
- it->second.Run();
- }
-
- new_key_callbacks_.clear();
- cdm_unset_callbacks_.clear();
+ player_tracker_.NotifyCdmUnset();
}
int BrowserCdmCast::RegisterPlayer(const base::Closure& new_key_cb,
const base::Closure& cdm_unset_cb) {
- int registration_id = next_registration_id_++;
- DCHECK(!new_key_cb.is_null());
- DCHECK(!cdm_unset_cb.is_null());
- DCHECK(!ContainsKey(new_key_callbacks_, registration_id));
- DCHECK(!ContainsKey(cdm_unset_callbacks_, registration_id));
- new_key_callbacks_[registration_id] = new_key_cb;
- cdm_unset_callbacks_[registration_id] = cdm_unset_cb;
- return registration_id;
+ return player_tracker_.RegisterPlayer(new_key_cb, cdm_unset_cb);
}
void BrowserCdmCast::UnregisterPlayer(int registration_id) {
- DCHECK(ContainsKey(new_key_callbacks_, registration_id));
- DCHECK(ContainsKey(cdm_unset_callbacks_, registration_id));
- new_key_callbacks_.erase(registration_id);
- cdm_unset_callbacks_.erase(registration_id);
+ player_tracker_.UnregisterPlayer(registration_id);
}
-void BrowserCdmCast::NotifyKeyAdded() const {
- for (std::map<uint32_t, base::Closure>::const_iterator it =
- new_key_callbacks_.begin(); it != new_key_callbacks_.end(); ++it) {
- base::MessageLoopProxy::current()->PostTask(FROM_HERE, it->second);
- }
+void BrowserCdmCast::NotifyKeyAdded() {
+ player_tracker_.NotifyNewKey();
}
} // namespace media
« no previous file with comments | « chromecast/media/cdm/browser_cdm_cast.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698