OLD | NEW |
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/blink/cdm_session_adapter.h" | 5 #include "media/blink/cdm_session_adapter.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::CreateSession() { | 72 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::CreateSession() { |
73 return new WebContentDecryptionModuleSessionImpl(this); | 73 return new WebContentDecryptionModuleSessionImpl(this); |
74 } | 74 } |
75 | 75 |
76 bool CdmSessionAdapter::RegisterSession( | 76 bool CdmSessionAdapter::RegisterSession( |
77 const std::string& session_id, | 77 const std::string& session_id, |
78 base::WeakPtr<WebContentDecryptionModuleSessionImpl> session) { | 78 base::WeakPtr<WebContentDecryptionModuleSessionImpl> session) { |
79 // If this session ID is already registered, don't register it again. | 79 // If this session ID is already registered, don't register it again. |
80 if (ContainsKey(sessions_, session_id)) | 80 if (base::ContainsKey(sessions_, session_id)) |
81 return false; | 81 return false; |
82 | 82 |
83 sessions_[session_id] = session; | 83 sessions_[session_id] = session; |
84 return true; | 84 return true; |
85 } | 85 } |
86 | 86 |
87 void CdmSessionAdapter::UnregisterSession(const std::string& session_id) { | 87 void CdmSessionAdapter::UnregisterSession(const std::string& session_id) { |
88 DCHECK(ContainsKey(sessions_, session_id)); | 88 DCHECK(base::ContainsKey(sessions_, session_id)); |
89 sessions_.erase(session_id); | 89 sessions_.erase(session_id); |
90 } | 90 } |
91 | 91 |
92 void CdmSessionAdapter::InitializeNewSession( | 92 void CdmSessionAdapter::InitializeNewSession( |
93 EmeInitDataType init_data_type, | 93 EmeInitDataType init_data_type, |
94 const std::vector<uint8_t>& init_data, | 94 const std::vector<uint8_t>& init_data, |
95 MediaKeys::SessionType session_type, | 95 MediaKeys::SessionType session_type, |
96 std::unique_ptr<NewSessionCdmPromise> promise) { | 96 std::unique_ptr<NewSessionCdmPromise> promise) { |
97 cdm_->CreateSessionAndGenerateRequest(session_type, init_data_type, init_data, | 97 cdm_->CreateSessionAndGenerateRequest(session_type, init_data_type, init_data, |
98 std::move(promise)); | 98 std::move(promise)); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 // Note: This leaks memory, which is expected behavior. | 234 // Note: This leaks memory, which is expected behavior. |
235 base::HistogramBase* histogram = base::Histogram::FactoryTimeGet( | 235 base::HistogramBase* histogram = base::Histogram::FactoryTimeGet( |
236 GetKeySystemUMAPrefix() + kTimeToCreateCdmUMAName, | 236 GetKeySystemUMAPrefix() + kTimeToCreateCdmUMAName, |
237 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(10), | 237 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(10), |
238 50, base::HistogramBase::kUmaTargetedHistogramFlag); | 238 50, base::HistogramBase::kUmaTargetedHistogramFlag); |
239 | 239 |
240 histogram->AddTime(time); | 240 histogram->AddTime(time); |
241 } | 241 } |
242 | 242 |
243 } // namespace media | 243 } // namespace media |
OLD | NEW |