| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 new MediaKeys(context, supportedSessionTypes, std::move(cdm)); | 133 new MediaKeys(context, supportedSessionTypes, std::move(cdm)); |
| 134 mediaKeys->suspendIfNeeded(); | 134 mediaKeys->suspendIfNeeded(); |
| 135 return mediaKeys; | 135 return mediaKeys; |
| 136 } | 136 } |
| 137 | 137 |
| 138 MediaKeys::MediaKeys( | 138 MediaKeys::MediaKeys( |
| 139 ExecutionContext* context, | 139 ExecutionContext* context, |
| 140 const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, | 140 const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, |
| 141 std::unique_ptr<WebContentDecryptionModule> cdm) | 141 std::unique_ptr<WebContentDecryptionModule> cdm) |
| 142 : ActiveScriptWrappable(this), | 142 : ActiveScriptWrappable(this), |
| 143 ActiveDOMObject(context), | 143 SuspendableObject(context), |
| 144 m_supportedSessionTypes(supportedSessionTypes), | 144 m_supportedSessionTypes(supportedSessionTypes), |
| 145 m_cdm(std::move(cdm)), | 145 m_cdm(std::move(cdm)), |
| 146 m_mediaElement(nullptr), | 146 m_mediaElement(nullptr), |
| 147 m_reservedForMediaElement(false), | 147 m_reservedForMediaElement(false), |
| 148 m_timer(this, &MediaKeys::timerFired) { | 148 m_timer(this, &MediaKeys::timerFired) { |
| 149 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ")"; | 149 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ")"; |
| 150 } | 150 } |
| 151 | 151 |
| 152 MediaKeys::~MediaKeys() { | 152 MediaKeys::~MediaKeys() { |
| 153 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ")"; | 153 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ")"; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 | 288 |
| 289 WebContentDecryptionModule* MediaKeys::contentDecryptionModule() { | 289 WebContentDecryptionModule* MediaKeys::contentDecryptionModule() { |
| 290 return m_cdm.get(); | 290 return m_cdm.get(); |
| 291 } | 291 } |
| 292 | 292 |
| 293 DEFINE_TRACE(MediaKeys) { | 293 DEFINE_TRACE(MediaKeys) { |
| 294 visitor->trace(m_pendingActions); | 294 visitor->trace(m_pendingActions); |
| 295 visitor->trace(m_mediaElement); | 295 visitor->trace(m_mediaElement); |
| 296 ActiveDOMObject::trace(visitor); | 296 SuspendableObject::trace(visitor); |
| 297 } | 297 } |
| 298 | 298 |
| 299 void MediaKeys::contextDestroyed() { | 299 void MediaKeys::contextDestroyed() { |
| 300 m_timer.stop(); | 300 m_timer.stop(); |
| 301 m_pendingActions.clear(); | 301 m_pendingActions.clear(); |
| 302 | 302 |
| 303 // We don't need the CDM anymore. Only destroyed after all related | 303 // We don't need the CDM anymore. Only destroyed after all related |
| 304 // ActiveDOMObjects have been stopped. | 304 // SuspendableObjects have been stopped. |
| 305 m_cdm.reset(); | 305 m_cdm.reset(); |
| 306 } | 306 } |
| 307 | 307 |
| 308 bool MediaKeys::hasPendingActivity() const { | 308 bool MediaKeys::hasPendingActivity() const { |
| 309 // Remain around if there are pending events. | 309 // Remain around if there are pending events. |
| 310 DVLOG(MEDIA_KEYS_LOG_LEVEL) | 310 DVLOG(MEDIA_KEYS_LOG_LEVEL) |
| 311 << __func__ << "(" << this << ")" | 311 << __func__ << "(" << this << ")" |
| 312 << (!m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "") | 312 << (!m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "") |
| 313 << (m_reservedForMediaElement ? " m_reservedForMediaElement" : ""); | 313 << (m_reservedForMediaElement ? " m_reservedForMediaElement" : ""); |
| 314 | 314 |
| 315 return !m_pendingActions.isEmpty() || m_reservedForMediaElement; | 315 return !m_pendingActions.isEmpty() || m_reservedForMediaElement; |
| 316 } | 316 } |
| 317 | 317 |
| 318 } // namespace blink | 318 } // namespace blink |
| OLD | NEW |