| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 void CdmSessionAdapter::OnSessionKeysChange(const std::string& session_id, | 192 void CdmSessionAdapter::OnSessionKeysChange(const std::string& session_id, |
| 193 bool has_additional_usable_key, | 193 bool has_additional_usable_key, |
| 194 CdmKeysInfo keys_info) { | 194 CdmKeysInfo keys_info) { |
| 195 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); | 195 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); |
| 196 DLOG_IF(WARNING, !session) << __func__ << " for unknown session " | 196 DLOG_IF(WARNING, !session) << __func__ << " for unknown session " |
| 197 << session_id; | 197 << session_id; |
| 198 if (session) { | 198 if (session) { |
| 199 DVLOG(2) << __func__ << ": session_id = " << session_id; | 199 DVLOG(2) << __func__ << ": session_id = " << session_id; |
| 200 DVLOG(2) << " - has_additional_usable_key = " << has_additional_usable_key; | 200 DVLOG(2) << " - has_additional_usable_key = " << has_additional_usable_key; |
| 201 for (const auto& info : keys_info) | 201 for (const CdmKeyInformation* info : keys_info) |
| 202 DVLOG(2) << " - " << *(info.get()); | 202 DVLOG(2) << " - " << *info; |
| 203 | 203 |
| 204 session->OnSessionKeysChange(has_additional_usable_key, | 204 session->OnSessionKeysChange(has_additional_usable_key, |
| 205 std::move(keys_info)); | 205 std::move(keys_info)); |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 void CdmSessionAdapter::OnSessionExpirationUpdate(const std::string& session_id, | 209 void CdmSessionAdapter::OnSessionExpirationUpdate(const std::string& session_id, |
| 210 base::Time new_expiry_time) { | 210 base::Time new_expiry_time) { |
| 211 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); | 211 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); |
| 212 DLOG_IF(WARNING, !session) << __func__ << " for unknown session " | 212 DLOG_IF(WARNING, !session) << __func__ << " for unknown session " |
| (...skipping 22 matching lines...) Expand all Loading... |
| 235 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( | 235 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( |
| 236 const std::string& session_id) { | 236 const std::string& session_id) { |
| 237 // Since session objects may get garbage collected, it is possible that there | 237 // Since session objects may get garbage collected, it is possible that there |
| 238 // are events coming back from the CDM and the session has been unregistered. | 238 // are events coming back from the CDM and the session has been unregistered. |
| 239 // We can not tell if the CDM is firing events at sessions that never existed. | 239 // We can not tell if the CDM is firing events at sessions that never existed. |
| 240 SessionMap::iterator session = sessions_.find(session_id); | 240 SessionMap::iterator session = sessions_.find(session_id); |
| 241 return (session != sessions_.end()) ? session->second.get() : NULL; | 241 return (session != sessions_.end()) ? session->second.get() : NULL; |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace media | 244 } // namespace media |
| OLD | NEW |