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

Side by Side Diff: media/cdm/player_tracker_impl.cc

Issue 1341883003: Prepare MediaDrmBridge to work with MediaCodecPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bug526755
Patch Set: Cleanup Created 5 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/cdm/player_tracker_impl.h" 5 #include "media/cdm/player_tracker_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 10
11 namespace media { 11 namespace media {
12 12
13 PlayerTrackerImpl::PlayerCallbacks::PlayerCallbacks( 13 PlayerTrackerImpl::PlayerCallbacks::PlayerCallbacks(
14 base::Closure new_key_cb, 14 base::Closure new_key_cb,
15 base::Closure cdm_unset_cb) 15 base::Closure cdm_unset_cb)
16 : new_key_cb(new_key_cb), cdm_unset_cb(cdm_unset_cb) { 16 : new_key_cb(new_key_cb), cdm_unset_cb(cdm_unset_cb) {
17 } 17 }
18 18
19 PlayerTrackerImpl::PlayerCallbacks::~PlayerCallbacks() { 19 PlayerTrackerImpl::PlayerCallbacks::~PlayerCallbacks() {
20 } 20 }
21 21
22 PlayerTrackerImpl::PlayerTrackerImpl() : next_registration_id_(1) {} 22 PlayerTrackerImpl::PlayerTrackerImpl() : next_registration_id_(1) {
23 thread_checker_.DetachFromThread();
24 }
23 25
24 PlayerTrackerImpl::~PlayerTrackerImpl() {} 26 PlayerTrackerImpl::~PlayerTrackerImpl() {}
25 27
26 int PlayerTrackerImpl::RegisterPlayer(const base::Closure& new_key_cb, 28 int PlayerTrackerImpl::RegisterPlayer(const base::Closure& new_key_cb,
27 const base::Closure& cdm_unset_cb) { 29 const base::Closure& cdm_unset_cb) {
28 DCHECK(thread_checker_.CalledOnValidThread()); 30 DCHECK(thread_checker_.CalledOnValidThread());
29 int registration_id = next_registration_id_++; 31 int registration_id = next_registration_id_++;
30 DCHECK(!ContainsKey(player_callbacks_map_, registration_id)); 32 DCHECK(!ContainsKey(player_callbacks_map_, registration_id));
31 player_callbacks_map_.insert(std::make_pair( 33 player_callbacks_map_.insert(std::make_pair(
32 registration_id, PlayerCallbacks(new_key_cb, cdm_unset_cb))); 34 registration_id, PlayerCallbacks(new_key_cb, cdm_unset_cb)));
(...skipping 15 matching lines...) Expand all
48 } 50 }
49 51
50 void PlayerTrackerImpl::NotifyCdmUnset() { 52 void PlayerTrackerImpl::NotifyCdmUnset() {
51 DCHECK(thread_checker_.CalledOnValidThread()); 53 DCHECK(thread_checker_.CalledOnValidThread());
52 std::map<int, PlayerCallbacks>::iterator iter = player_callbacks_map_.begin(); 54 std::map<int, PlayerCallbacks>::iterator iter = player_callbacks_map_.begin();
53 for (; iter != player_callbacks_map_.end(); ++iter) 55 for (; iter != player_callbacks_map_.end(); ++iter)
54 iter->second.cdm_unset_cb.Run(); 56 iter->second.cdm_unset_cb.Run();
55 } 57 }
56 58
57 } // namespace media 59 } // namespace media
OLDNEW
« media/base/android/media_drm_bridge.cc ('K') | « media/base/browser_cdm_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698