| 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 20 matching lines...) Expand all Loading... |
| 31 #include "core/dom/ExceptionCode.h" | 31 #include "core/dom/ExceptionCode.h" |
| 32 #include "core/dom/ExecutionContext.h" | 32 #include "core/dom/ExecutionContext.h" |
| 33 #include "core/html/HTMLMediaElement.h" | 33 #include "core/html/HTMLMediaElement.h" |
| 34 #include "modules/encryptedmedia/EncryptedMediaUtils.h" | 34 #include "modules/encryptedmedia/EncryptedMediaUtils.h" |
| 35 #include "modules/encryptedmedia/MediaKeySession.h" | 35 #include "modules/encryptedmedia/MediaKeySession.h" |
| 36 #include "modules/encryptedmedia/SimpleContentDecryptionModuleResultPromise.h" | 36 #include "modules/encryptedmedia/SimpleContentDecryptionModuleResultPromise.h" |
| 37 #include "platform/Logging.h" | 37 #include "platform/Logging.h" |
| 38 #include "platform/Timer.h" | 38 #include "platform/Timer.h" |
| 39 #include "public/platform/WebContentDecryptionModule.h" | 39 #include "public/platform/WebContentDecryptionModule.h" |
| 40 #include "wtf/RefPtr.h" | 40 #include "wtf/RefPtr.h" |
| 41 #include <memory> | |
| 42 | 41 |
| 43 #define MEDIA_KEYS_LOG_LEVEL 3 | 42 #define MEDIA_KEYS_LOG_LEVEL 3 |
| 44 | 43 |
| 45 namespace blink { | 44 namespace blink { |
| 46 | 45 |
| 47 // A class holding a pending action. | 46 // A class holding a pending action. |
| 48 class MediaKeys::PendingAction final : public GarbageCollected<MediaKeys::Pendin
gAction> { | 47 class MediaKeys::PendingAction final : public GarbageCollected<MediaKeys::Pendin
gAction> { |
| 49 public: | 48 public: |
| 50 const Persistent<ContentDecryptionModuleResult> result() const | 49 const Persistent<ContentDecryptionModuleResult> result() const |
| 51 { | 50 { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // false." So convert any NOTSUPPORTEDERROR into resolving with false. | 109 // false." So convert any NOTSUPPORTEDERROR into resolving with false. |
| 111 if (exceptionCode == WebContentDecryptionModuleExceptionNotSupportedErro
r) { | 110 if (exceptionCode == WebContentDecryptionModuleExceptionNotSupportedErro
r) { |
| 112 resolve(false); | 111 resolve(false); |
| 113 return; | 112 return; |
| 114 } | 113 } |
| 115 | 114 |
| 116 ContentDecryptionModuleResultPromise::completeWithError(exceptionCode, s
ystemCode, errorMessage); | 115 ContentDecryptionModuleResultPromise::completeWithError(exceptionCode, s
ystemCode, errorMessage); |
| 117 } | 116 } |
| 118 }; | 117 }; |
| 119 | 118 |
| 120 MediaKeys* MediaKeys::create(ExecutionContext* context, const WebVector<WebEncry
ptedMediaSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecrypti
onModule> cdm) | 119 MediaKeys* MediaKeys::create(ExecutionContext* context, const WebVector<WebEncry
ptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionMod
ule> cdm) |
| 121 { | 120 { |
| 122 MediaKeys* mediaKeys = new MediaKeys(context, supportedSessionTypes, std::mo
ve(cdm)); | 121 MediaKeys* mediaKeys = new MediaKeys(context, supportedSessionTypes, std::mo
ve(cdm)); |
| 123 mediaKeys->suspendIfNeeded(); | 122 mediaKeys->suspendIfNeeded(); |
| 124 return mediaKeys; | 123 return mediaKeys; |
| 125 } | 124 } |
| 126 | 125 |
| 127 MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMedi
aSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule
> cdm) | 126 MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMedi
aSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule> cdm
) |
| 128 : ActiveScriptWrappable(this) | 127 : ActiveScriptWrappable(this) |
| 129 , ActiveDOMObject(context) | 128 , ActiveDOMObject(context) |
| 130 , m_supportedSessionTypes(supportedSessionTypes) | 129 , m_supportedSessionTypes(supportedSessionTypes) |
| 131 , m_cdm(std::move(cdm)) | 130 , m_cdm(std::move(cdm)) |
| 132 , m_mediaElement(nullptr) | 131 , m_mediaElement(nullptr) |
| 133 , m_reservedForMediaElement(false) | 132 , m_reservedForMediaElement(false) |
| 134 , m_timer(this, &MediaKeys::timerFired) | 133 , m_timer(this, &MediaKeys::timerFired) |
| 135 { | 134 { |
| 136 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; | 135 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; |
| 137 } | 136 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 void MediaKeys::stop() | 300 void MediaKeys::stop() |
| 302 { | 301 { |
| 303 ActiveDOMObject::stop(); | 302 ActiveDOMObject::stop(); |
| 304 | 303 |
| 305 if (m_timer.isActive()) | 304 if (m_timer.isActive()) |
| 306 m_timer.stop(); | 305 m_timer.stop(); |
| 307 m_pendingActions.clear(); | 306 m_pendingActions.clear(); |
| 308 } | 307 } |
| 309 | 308 |
| 310 } // namespace blink | 309 } // namespace blink |
| OLD | NEW |