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

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: Fixed MediaDrmBridgeTest unit tests Created 5 years, 2 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
« no previous file with comments | « media/base/browser_cdm_factory.cc ('k') | media/media.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Enable PlayerTrackerImpl to be created on another thread than it will be
24 // later exclusively used.
25 thread_checker_.DetachFromThread();
26 }
23 27
24 PlayerTrackerImpl::~PlayerTrackerImpl() {} 28 PlayerTrackerImpl::~PlayerTrackerImpl() {}
25 29
26 int PlayerTrackerImpl::RegisterPlayer(const base::Closure& new_key_cb, 30 int PlayerTrackerImpl::RegisterPlayer(const base::Closure& new_key_cb,
27 const base::Closure& cdm_unset_cb) { 31 const base::Closure& cdm_unset_cb) {
28 DCHECK(thread_checker_.CalledOnValidThread()); 32 DCHECK(thread_checker_.CalledOnValidThread());
29 int registration_id = next_registration_id_++; 33 int registration_id = next_registration_id_++;
30 DCHECK(!ContainsKey(player_callbacks_map_, registration_id)); 34 DCHECK(!ContainsKey(player_callbacks_map_, registration_id));
31 player_callbacks_map_.insert(std::make_pair( 35 player_callbacks_map_.insert(std::make_pair(
32 registration_id, PlayerCallbacks(new_key_cb, cdm_unset_cb))); 36 registration_id, PlayerCallbacks(new_key_cb, cdm_unset_cb)));
(...skipping 15 matching lines...) Expand all
48 } 52 }
49 53
50 void PlayerTrackerImpl::NotifyCdmUnset() { 54 void PlayerTrackerImpl::NotifyCdmUnset() {
51 DCHECK(thread_checker_.CalledOnValidThread()); 55 DCHECK(thread_checker_.CalledOnValidThread());
52 std::map<int, PlayerCallbacks>::iterator iter = player_callbacks_map_.begin(); 56 std::map<int, PlayerCallbacks>::iterator iter = player_callbacks_map_.begin();
53 for (; iter != player_callbacks_map_.end(); ++iter) 57 for (; iter != player_callbacks_map_.end(); ++iter)
54 iter->second.cdm_unset_cb.Run(); 58 iter->second.cdm_unset_cb.Run();
55 } 59 }
56 60
57 } // namespace media 61 } // namespace media
OLDNEW
« no previous file with comments | « media/base/browser_cdm_factory.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698