OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2013 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 | 126 |
127 MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMedi
aSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule
> cdm) | 127 MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMedi
aSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule
> cdm) |
128 : ActiveScriptWrappable(this) | 128 : ActiveScriptWrappable(this) |
129 , ActiveDOMObject(context) | 129 , ActiveDOMObject(context) |
130 , m_supportedSessionTypes(supportedSessionTypes) | 130 , m_supportedSessionTypes(supportedSessionTypes) |
131 , m_cdm(std::move(cdm)) | 131 , m_cdm(std::move(cdm)) |
132 , m_mediaElement(nullptr) | 132 , m_mediaElement(nullptr) |
133 , m_reservedForMediaElement(false) | 133 , m_reservedForMediaElement(false) |
134 , m_timer(this, &MediaKeys::timerFired) | 134 , m_timer(this, &MediaKeys::timerFired) |
135 { | 135 { |
136 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; | 136 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ")"; |
137 } | 137 } |
138 | 138 |
139 MediaKeys::~MediaKeys() | 139 MediaKeys::~MediaKeys() |
140 { | 140 { |
141 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; | 141 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ")"; |
142 } | 142 } |
143 | 143 |
144 MediaKeySession* MediaKeys::createSession(ScriptState* scriptState, const String
& sessionTypeString, ExceptionState& exceptionState) | 144 MediaKeySession* MediaKeys::createSession(ScriptState* scriptState, const String
& sessionTypeString, ExceptionState& exceptionState) |
145 { | 145 { |
146 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") " << sessio
nTypeString; | 146 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ") " << sessionTyp
eString; |
147 | 147 |
148 // From http://w3c.github.io/encrypted-media/#createSession | 148 // From http://w3c.github.io/encrypted-media/#createSession |
149 | 149 |
150 // When this method is invoked, the user agent must run the following steps: | 150 // When this method is invoked, the user agent must run the following steps: |
151 // 1. If this object's persistent state allowed value is false and | 151 // 1. If this object's persistent state allowed value is false and |
152 // sessionType is not "temporary", throw a new DOMException whose name is | 152 // sessionType is not "temporary", throw a new DOMException whose name is |
153 // NotSupportedError. | 153 // NotSupportedError. |
154 // (Chromium ensures that only session types supported by the | 154 // (Chromium ensures that only session types supported by the |
155 // configuration are listed in supportedSessionTypes.) | 155 // configuration are listed in supportedSessionTypes.) |
156 // 2. If the Key System implementation represented by this object's cdm | 156 // 2. If the Key System implementation represented by this object's cdm |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 { | 246 { |
247 DCHECK(m_pendingActions.size()); | 247 DCHECK(m_pendingActions.size()); |
248 | 248 |
249 // Swap the queue to a local copy to avoid problems if resolving promises | 249 // Swap the queue to a local copy to avoid problems if resolving promises |
250 // run synchronously. | 250 // run synchronously. |
251 HeapDeque<Member<PendingAction>> pendingActions; | 251 HeapDeque<Member<PendingAction>> pendingActions; |
252 pendingActions.swap(m_pendingActions); | 252 pendingActions.swap(m_pendingActions); |
253 | 253 |
254 while (!pendingActions.isEmpty()) { | 254 while (!pendingActions.isEmpty()) { |
255 PendingAction* action = pendingActions.takeFirst(); | 255 PendingAction* action = pendingActions.takeFirst(); |
256 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __FUNCTION__ << "(" << this << ") Certifi
cate"; | 256 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ") Certificate
"; |
257 | 257 |
258 // 5.1 Let cdm be the cdm during the initialization of this object. | 258 // 5.1 Let cdm be the cdm during the initialization of this object. |
259 WebContentDecryptionModule* cdm = contentDecryptionModule(); | 259 WebContentDecryptionModule* cdm = contentDecryptionModule(); |
260 | 260 |
261 // 5.2 Use the cdm to process certificate. | 261 // 5.2 Use the cdm to process certificate. |
262 cdm->setServerCertificate(static_cast<unsigned char*>(action->data()->da
ta()), action->data()->byteLength(), action->result()->result()); | 262 cdm->setServerCertificate(static_cast<unsigned char*>(action->data()->da
ta()), action->data()->byteLength(), action->result()->result()); |
263 // 5.3 If any of the preceding steps failed, reject promise with a | 263 // 5.3 If any of the preceding steps failed, reject promise with a |
264 // new DOMException whose name is the appropriate error name. | 264 // new DOMException whose name is the appropriate error name. |
265 // 5.4 Resolve promise. | 265 // 5.4 Resolve promise. |
266 // (These are handled by Chromium and the CDM.) | 266 // (These are handled by Chromium and the CDM.) |
(...skipping 17 matching lines...) Expand all Loading... |
284 ActiveDOMObject::contextDestroyed(); | 284 ActiveDOMObject::contextDestroyed(); |
285 | 285 |
286 // We don't need the CDM anymore. Only destroyed after all related | 286 // We don't need the CDM anymore. Only destroyed after all related |
287 // ActiveDOMObjects have been stopped. | 287 // ActiveDOMObjects have been stopped. |
288 m_cdm.reset(); | 288 m_cdm.reset(); |
289 } | 289 } |
290 | 290 |
291 bool MediaKeys::hasPendingActivity() const | 291 bool MediaKeys::hasPendingActivity() const |
292 { | 292 { |
293 // Remain around if there are pending events. | 293 // Remain around if there are pending events. |
294 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")" | 294 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ")" |
295 << (!m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "") | 295 << (!m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "") |
296 << (m_reservedForMediaElement ? " m_reservedForMediaElement" : ""); | 296 << (m_reservedForMediaElement ? " m_reservedForMediaElement" : ""); |
297 | 297 |
298 return !m_pendingActions.isEmpty() || m_reservedForMediaElement; | 298 return !m_pendingActions.isEmpty() || m_reservedForMediaElement; |
299 } | 299 } |
300 | 300 |
301 void MediaKeys::stop() | 301 void MediaKeys::stop() |
302 { | 302 { |
303 ActiveDOMObject::stop(); | 303 ActiveDOMObject::stop(); |
304 | 304 |
305 if (m_timer.isActive()) | 305 if (m_timer.isActive()) |
306 m_timer.stop(); | 306 m_timer.stop(); |
307 m_pendingActions.clear(); | 307 m_pendingActions.clear(); |
308 } | 308 } |
309 | 309 |
310 } // namespace blink | 310 } // namespace blink |
OLD | NEW |