OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "media/remoting/remoting_cdm_controller.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "base/callback_helpers.h" | |
9 #include "base/logging.h" | |
10 #include "base/threading/thread_checker.h" | |
11 | |
12 namespace media { | |
13 | |
14 RemotingCdmController::RemotingCdmController( | |
15 scoped_refptr<RemotingSourceImpl> remoting_source) | |
16 : remoting_source_(remoting_source) { | |
miu
2016/10/25 04:21:25
nit: Use std::move() here to avoid an unnecessary
xjz
2016/10/26 22:00:25
Done.
| |
17 remoting_source_->AddClient(this); | |
18 } | |
19 | |
20 RemotingCdmController::~RemotingCdmController() { | |
21 remoting_source_->RemoveClient(this); | |
miu
2016/10/25 04:21:25
DCHECK(thread_checker_...);
xjz
2016/10/26 22:00:25
Done.
| |
22 } | |
23 | |
24 void RemotingCdmController::OnStarted(bool success) { | |
25 DCHECK(thread_checker_.CalledOnValidThread()); | |
26 | |
27 base::ResetAndReturn(&cdm_check_cb_).Run(success); | |
miu
2016/10/25 04:21:25
DCHECK(!cdm_check_cb_.is_null()) before this line
xjz
2016/10/26 22:00:25
Done.
| |
28 is_remoting_ = success; | |
29 } | |
30 | |
31 void RemotingCdmController::OnSessionStateChanged() { | |
32 DCHECK(thread_checker_.CalledOnValidThread()); | |
33 | |
34 if (is_remoting_ && | |
35 remoting_source_->state() == RemotingSessionState::SESSION_STOPPING) { | |
36 remoting_source_->ShutDown(); | |
37 is_remoting_ = false; | |
38 } | |
39 } | |
40 | |
41 void RemotingCdmController::ShouldCreateRemotingCdm( | |
42 const CdmCheckCallback& cb) { | |
43 DCHECK(thread_checker_.CalledOnValidThread()); | |
44 DCHECK(!cb.is_null()); | |
45 | |
46 if (is_remoting_) { | |
47 cb.Run(true); | |
48 return; | |
49 } | |
50 | |
51 cdm_check_cb_ = cb; | |
miu
2016/10/25 04:21:25
DCHECK(cdm_check_cb_.is_null()) before this line t
xjz
2016/10/26 22:00:25
Done with DCHECK. There should be no other queries
| |
52 remoting_source_->StartRemoting(this); | |
53 } | |
54 | |
55 } // namespace media | |
OLD | NEW |