| 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 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 #include "modules/encryptedmedia/MediaKeys.h" | 26 #include "modules/encryptedmedia/MediaKeys.h" |
| 27 | 27 |
| 28 #include "bindings/core/v8/ScriptPromise.h" | 28 #include "bindings/core/v8/ScriptPromise.h" |
| 29 #include "bindings/core/v8/ScriptState.h" | 29 #include "bindings/core/v8/ScriptState.h" |
| 30 #include "bindings/core/v8/V8ThrowException.h" | 30 #include "bindings/core/v8/V8ThrowException.h" |
| 31 #include "core/dom/DOMArrayBuffer.h" | 31 #include "core/dom/DOMArrayBuffer.h" |
| 32 #include "core/dom/DOMException.h" | 32 #include "core/dom/DOMException.h" |
| 33 #include "core/dom/ExceptionCode.h" | 33 #include "core/dom/ExceptionCode.h" |
| 34 #include "core/dom/ExecutionContext.h" | 34 #include "core/dom/ExecutionContext.h" |
| 35 #include "core/dom/TaskRunnerHelper.h" |
| 35 #include "core/html/HTMLMediaElement.h" | 36 #include "core/html/HTMLMediaElement.h" |
| 36 #include "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h" | 37 #include "modules/encryptedmedia/ContentDecryptionModuleResultPromise.h" |
| 37 #include "modules/encryptedmedia/EncryptedMediaUtils.h" | 38 #include "modules/encryptedmedia/EncryptedMediaUtils.h" |
| 38 #include "modules/encryptedmedia/MediaKeySession.h" | 39 #include "modules/encryptedmedia/MediaKeySession.h" |
| 39 #include "platform/InstanceCounters.h" | 40 #include "platform/InstanceCounters.h" |
| 40 #include "platform/Timer.h" | 41 #include "platform/Timer.h" |
| 41 #include "public/platform/WebContentDecryptionModule.h" | 42 #include "public/platform/WebContentDecryptionModule.h" |
| 42 #include "wtf/RefPtr.h" | 43 #include "wtf/RefPtr.h" |
| 43 #include <memory> | 44 #include <memory> |
| 44 | 45 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 136 |
| 136 MediaKeys::MediaKeys( | 137 MediaKeys::MediaKeys( |
| 137 ExecutionContext* context, | 138 ExecutionContext* context, |
| 138 const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, | 139 const WebVector<WebEncryptedMediaSessionType>& supportedSessionTypes, |
| 139 std::unique_ptr<WebContentDecryptionModule> cdm) | 140 std::unique_ptr<WebContentDecryptionModule> cdm) |
| 140 : ContextLifecycleObserver(context), | 141 : ContextLifecycleObserver(context), |
| 141 m_supportedSessionTypes(supportedSessionTypes), | 142 m_supportedSessionTypes(supportedSessionTypes), |
| 142 m_cdm(std::move(cdm)), | 143 m_cdm(std::move(cdm)), |
| 143 m_mediaElement(nullptr), | 144 m_mediaElement(nullptr), |
| 144 m_reservedForMediaElement(false), | 145 m_reservedForMediaElement(false), |
| 145 m_timer(this, &MediaKeys::timerFired) { | 146 m_timer(TaskRunnerHelper::get(TaskType::MiscPlatformAPI, context), |
| 147 this, |
| 148 &MediaKeys::timerFired) { |
| 146 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ")"; | 149 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ")"; |
| 147 InstanceCounters::incrementCounter(InstanceCounters::MediaKeysCounter); | 150 InstanceCounters::incrementCounter(InstanceCounters::MediaKeysCounter); |
| 148 } | 151 } |
| 149 | 152 |
| 150 MediaKeys::~MediaKeys() { | 153 MediaKeys::~MediaKeys() { |
| 151 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ")"; | 154 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __func__ << "(" << this << ")"; |
| 152 InstanceCounters::decrementCounter(InstanceCounters::MediaKeysCounter); | 155 InstanceCounters::decrementCounter(InstanceCounters::MediaKeysCounter); |
| 153 } | 156 } |
| 154 | 157 |
| 155 MediaKeySession* MediaKeys::createSession(ScriptState* scriptState, | 158 MediaKeySession* MediaKeys::createSession(ScriptState* scriptState, |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // Remain around if there are pending events. | 311 // Remain around if there are pending events. |
| 309 DVLOG(MEDIA_KEYS_LOG_LEVEL) | 312 DVLOG(MEDIA_KEYS_LOG_LEVEL) |
| 310 << __func__ << "(" << this << ")" | 313 << __func__ << "(" << this << ")" |
| 311 << (!m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "") | 314 << (!m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "") |
| 312 << (m_reservedForMediaElement ? " m_reservedForMediaElement" : ""); | 315 << (m_reservedForMediaElement ? " m_reservedForMediaElement" : ""); |
| 313 | 316 |
| 314 return !m_pendingActions.isEmpty() || m_reservedForMediaElement; | 317 return !m_pendingActions.isEmpty() || m_reservedForMediaElement; |
| 315 } | 318 } |
| 316 | 319 |
| 317 } // namespace blink | 320 } // namespace blink |
| OLD | NEW |