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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 | 134 |
135 const std::string& CdmSessionAdapter::GetKeySystemUMAPrefix() const { | 135 const std::string& CdmSessionAdapter::GetKeySystemUMAPrefix() const { |
136 DCHECK(!key_system_uma_prefix_.empty()); | 136 DCHECK(!key_system_uma_prefix_.empty()); |
137 return key_system_uma_prefix_; | 137 return key_system_uma_prefix_; |
138 } | 138 } |
139 | 139 |
140 void CdmSessionAdapter::OnCdmCreated(const std::string& key_system, | 140 void CdmSessionAdapter::OnCdmCreated(const std::string& key_system, |
141 base::TimeTicks start_time, | 141 base::TimeTicks start_time, |
142 const scoped_refptr<MediaKeys>& cdm, | 142 const scoped_refptr<MediaKeys>& cdm, |
143 const std::string& error_message) { | 143 const std::string& error_message) { |
144 DVLOG(2) << __FUNCTION__ << ": " | 144 DVLOG(2) << __func__ << ": " |
145 << (cdm ? "success" : "failure (" + error_message + ")"); | 145 << (cdm ? "success" : "failure (" + error_message + ")"); |
146 DCHECK(!cdm_); | 146 DCHECK(!cdm_); |
147 | 147 |
148 TRACE_EVENT_ASYNC_END2("media", "CdmSessionAdapter::CreateCdm", trace_id_, | 148 TRACE_EVENT_ASYNC_END2("media", "CdmSessionAdapter::CreateCdm", trace_id_, |
149 "success", (cdm ? "true" : "false"), "error_message", | 149 "success", (cdm ? "true" : "false"), "error_message", |
150 error_message); | 150 error_message); |
151 | 151 |
152 if (!cdm) { | 152 if (!cdm) { |
153 cdm_created_result_->completeWithError( | 153 cdm_created_result_->completeWithError( |
154 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, | 154 blink::WebContentDecryptionModuleExceptionNotSupportedError, 0, |
(...skipping 15 matching lines...) Expand all Loading... |
170 new WebContentDecryptionModuleImpl(this)); | 170 new WebContentDecryptionModuleImpl(this)); |
171 cdm_created_result_.reset(); | 171 cdm_created_result_.reset(); |
172 } | 172 } |
173 | 173 |
174 void CdmSessionAdapter::OnSessionMessage( | 174 void CdmSessionAdapter::OnSessionMessage( |
175 const std::string& session_id, | 175 const std::string& session_id, |
176 MediaKeys::MessageType message_type, | 176 MediaKeys::MessageType message_type, |
177 const std::vector<uint8_t>& message, | 177 const std::vector<uint8_t>& message, |
178 const GURL& /* legacy_destination_url */) { | 178 const GURL& /* legacy_destination_url */) { |
179 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); | 179 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); |
180 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 180 DLOG_IF(WARNING, !session) << __func__ << " for unknown session " |
181 << session_id; | 181 << session_id; |
182 if (session) | 182 if (session) |
183 session->OnSessionMessage(message_type, message); | 183 session->OnSessionMessage(message_type, message); |
184 } | 184 } |
185 | 185 |
186 void CdmSessionAdapter::OnSessionKeysChange(const std::string& session_id, | 186 void CdmSessionAdapter::OnSessionKeysChange(const std::string& session_id, |
187 bool has_additional_usable_key, | 187 bool has_additional_usable_key, |
188 CdmKeysInfo keys_info) { | 188 CdmKeysInfo keys_info) { |
189 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); | 189 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); |
190 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 190 DLOG_IF(WARNING, !session) << __func__ << " for unknown session " |
191 << session_id; | 191 << session_id; |
192 if (session) | 192 if (session) |
193 session->OnSessionKeysChange(has_additional_usable_key, | 193 session->OnSessionKeysChange(has_additional_usable_key, |
194 std::move(keys_info)); | 194 std::move(keys_info)); |
195 } | 195 } |
196 | 196 |
197 void CdmSessionAdapter::OnSessionExpirationUpdate( | 197 void CdmSessionAdapter::OnSessionExpirationUpdate( |
198 const std::string& session_id, | 198 const std::string& session_id, |
199 const base::Time& new_expiry_time) { | 199 const base::Time& new_expiry_time) { |
200 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); | 200 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); |
201 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 201 DLOG_IF(WARNING, !session) << __func__ << " for unknown session " |
202 << session_id; | 202 << session_id; |
203 if (session) | 203 if (session) |
204 session->OnSessionExpirationUpdate(new_expiry_time); | 204 session->OnSessionExpirationUpdate(new_expiry_time); |
205 } | 205 } |
206 | 206 |
207 void CdmSessionAdapter::OnSessionClosed(const std::string& session_id) { | 207 void CdmSessionAdapter::OnSessionClosed(const std::string& session_id) { |
208 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); | 208 WebContentDecryptionModuleSessionImpl* session = GetSession(session_id); |
209 DLOG_IF(WARNING, !session) << __FUNCTION__ << " for unknown session " | 209 DLOG_IF(WARNING, !session) << __func__ << " for unknown session " |
210 << session_id; | 210 << session_id; |
211 if (session) | 211 if (session) |
212 session->OnSessionClosed(); | 212 session->OnSessionClosed(); |
213 } | 213 } |
214 | 214 |
215 void CdmSessionAdapter::OnLegacySessionError( | 215 void CdmSessionAdapter::OnLegacySessionError( |
216 const std::string& session_id, | 216 const std::string& session_id, |
217 MediaKeys::Exception exception_code, | 217 MediaKeys::Exception exception_code, |
218 uint32_t system_code, | 218 uint32_t system_code, |
219 const std::string& error_message) { | 219 const std::string& error_message) { |
(...skipping 14 matching lines...) Expand all 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 |