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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 if (session) | 205 if (session) |
206 session->OnSessionClosed(); | 206 session->OnSessionClosed(); |
207 } | 207 } |
208 | 208 |
209 void CdmSessionAdapter::OnLegacySessionError( | 209 void CdmSessionAdapter::OnLegacySessionError( |
210 const std::string& session_id, | 210 const std::string& session_id, |
211 MediaKeys::Exception exception_code, | 211 MediaKeys::Exception exception_code, |
212 uint32_t system_code, | 212 uint32_t system_code, |
213 const std::string& error_message) { | 213 const std::string& error_message) { |
214 // Error events not used by unprefixed EME. | 214 // Error events not used by unprefixed EME. |
215 // TODO(jrummell): Remove when prefixed EME removed. | 215 // TODO(jrummell): Remove when prefixed EME removed. https://crbug.com/249976 |
216 } | 216 } |
217 | 217 |
218 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( | 218 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( |
219 const std::string& session_id) { | 219 const std::string& session_id) { |
220 // Since session objects may get garbage collected, it is possible that there | 220 // Since session objects may get garbage collected, it is possible that there |
221 // are events coming back from the CDM and the session has been unregistered. | 221 // are events coming back from the CDM and the session has been unregistered. |
222 // We can not tell if the CDM is firing events at sessions that never existed. | 222 // We can not tell if the CDM is firing events at sessions that never existed. |
223 SessionMap::iterator session = sessions_.find(session_id); | 223 SessionMap::iterator session = sessions_.find(session_id); |
224 return (session != sessions_.end()) ? session->second.get() : NULL; | 224 return (session != sessions_.end()) ? session->second.get() : NULL; |
225 } | 225 } |
226 | 226 |
227 void CdmSessionAdapter::ReportTimeToCreateCdmUMA(base::TimeDelta time) const { | 227 void CdmSessionAdapter::ReportTimeToCreateCdmUMA(base::TimeDelta time) const { |
228 // Note: This leaks memory, which is expected behavior. | 228 // Note: This leaks memory, which is expected behavior. |
229 base::HistogramBase* histogram = base::Histogram::FactoryTimeGet( | 229 base::HistogramBase* histogram = base::Histogram::FactoryTimeGet( |
230 GetKeySystemUMAPrefix() + kTimeToCreateCdmUMAName, | 230 GetKeySystemUMAPrefix() + kTimeToCreateCdmUMAName, |
231 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(10), | 231 base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromSeconds(10), |
232 50, base::HistogramBase::kUmaTargetedHistogramFlag); | 232 50, base::HistogramBase::kUmaTargetedHistogramFlag); |
233 | 233 |
234 histogram->AddTime(time); | 234 histogram->AddTime(time); |
235 } | 235 } |
236 | 236 |
237 } // namespace media | 237 } // namespace media |
OLD | NEW |