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 "content/renderer/media/cdm_session_adapter.h" | 5 #include "content/renderer/media/cdm_session_adapter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "content/renderer/media/crypto/content_decryption_module_factory.h" | 10 #include "content/renderer/media/crypto/content_decryption_module_factory.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const std::string& web_session_id) { | 105 const std::string& web_session_id) { |
106 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); | 106 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); |
107 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 107 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " |
108 << session_id; | 108 << session_id; |
109 if (session) | 109 if (session) |
110 session->OnSessionCreated(web_session_id); | 110 session->OnSessionCreated(web_session_id); |
111 } | 111 } |
112 | 112 |
113 void CdmSessionAdapter::OnSessionMessage(uint32 session_id, | 113 void CdmSessionAdapter::OnSessionMessage(uint32 session_id, |
114 const std::vector<uint8>& message, | 114 const std::vector<uint8>& message, |
115 const std::string& destination_url) { | 115 const GURL& destination_url) { |
116 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); | 116 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); |
117 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 117 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " |
118 << session_id; | 118 << session_id; |
119 if (session) | 119 if (session) |
120 session->OnSessionMessage(message, destination_url); | 120 session->OnSessionMessage(message, destination_url); |
121 } | 121 } |
122 | 122 |
123 void CdmSessionAdapter::OnSessionReady(uint32 session_id) { | 123 void CdmSessionAdapter::OnSessionReady(uint32 session_id) { |
124 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); | 124 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); |
125 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 125 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " |
(...skipping 23 matching lines...) Expand all Loading... |
149 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( | 149 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( |
150 uint32 session_id) { | 150 uint32 session_id) { |
151 // Since session objects may get garbage collected, it is possible that there | 151 // Since session objects may get garbage collected, it is possible that there |
152 // are events coming back from the CDM and the session has been unregistered. | 152 // are events coming back from the CDM and the session has been unregistered. |
153 // We can not tell if the CDM is firing events at sessions that never existed. | 153 // We can not tell if the CDM is firing events at sessions that never existed. |
154 SessionMap::iterator session = sessions_.find(session_id); | 154 SessionMap::iterator session = sessions_.find(session_id); |
155 return (session != sessions_.end()) ? session->second : NULL; | 155 return (session != sessions_.end()) ? session->second : NULL; |
156 } | 156 } |
157 | 157 |
158 } // namespace content | 158 } // namespace content |
OLD | NEW |