| 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> |
| 41 | 42 |
| 42 #define MEDIA_KEYS_LOG_LEVEL 3 | 43 #define MEDIA_KEYS_LOG_LEVEL 3 |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 | 46 |
| 46 // A class holding a pending action. | 47 // A class holding a pending action. |
| 47 class MediaKeys::PendingAction final : public GarbageCollected<MediaKeys::Pendin
gAction> { | 48 class MediaKeys::PendingAction final : public GarbageCollected<MediaKeys::Pendin
gAction> { |
| 48 public: | 49 public: |
| 49 const Persistent<ContentDecryptionModuleResult> result() const | 50 const Persistent<ContentDecryptionModuleResult> result() const |
| 50 { | 51 { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 73 PendingAction(ContentDecryptionModuleResult* result, DOMArrayBuffer* data) | 74 PendingAction(ContentDecryptionModuleResult* result, DOMArrayBuffer* data) |
| 74 : m_result(result) | 75 : m_result(result) |
| 75 , m_data(data) | 76 , m_data(data) |
| 76 { | 77 { |
| 77 } | 78 } |
| 78 | 79 |
| 79 const Member<ContentDecryptionModuleResult> m_result; | 80 const Member<ContentDecryptionModuleResult> m_result; |
| 80 const Member<DOMArrayBuffer> m_data; | 81 const Member<DOMArrayBuffer> m_data; |
| 81 }; | 82 }; |
| 82 | 83 |
| 83 MediaKeys* MediaKeys::create(ExecutionContext* context, const WebVector<WebEncry
ptedMediaSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionMod
ule> cdm) | 84 MediaKeys* MediaKeys::create(ExecutionContext* context, const WebVector<WebEncry
ptedMediaSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecrypti
onModule> cdm) |
| 84 { | 85 { |
| 85 MediaKeys* mediaKeys = new MediaKeys(context, supportedSessionTypes, std::mo
ve(cdm)); | 86 MediaKeys* mediaKeys = new MediaKeys(context, supportedSessionTypes, std::mo
ve(cdm)); |
| 86 mediaKeys->suspendIfNeeded(); | 87 mediaKeys->suspendIfNeeded(); |
| 87 return mediaKeys; | 88 return mediaKeys; |
| 88 } | 89 } |
| 89 | 90 |
| 90 MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMedi
aSessionType>& supportedSessionTypes, PassOwnPtr<WebContentDecryptionModule> cdm
) | 91 MediaKeys::MediaKeys(ExecutionContext* context, const WebVector<WebEncryptedMedi
aSessionType>& supportedSessionTypes, std::unique_ptr<WebContentDecryptionModule
> cdm) |
| 91 : ActiveScriptWrappable(this) | 92 : ActiveScriptWrappable(this) |
| 92 , ActiveDOMObject(context) | 93 , ActiveDOMObject(context) |
| 93 , m_supportedSessionTypes(supportedSessionTypes) | 94 , m_supportedSessionTypes(supportedSessionTypes) |
| 94 , m_cdm(std::move(cdm)) | 95 , m_cdm(std::move(cdm)) |
| 95 , m_mediaElement(nullptr) | 96 , m_mediaElement(nullptr) |
| 96 , m_reservedForMediaElement(false) | 97 , m_reservedForMediaElement(false) |
| 97 , m_timer(this, &MediaKeys::timerFired) | 98 , m_timer(this, &MediaKeys::timerFired) |
| 98 { | 99 { |
| 99 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; | 100 DVLOG(MEDIA_KEYS_LOG_LEVEL) << __FUNCTION__ << "(" << this << ")"; |
| 100 } | 101 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 void MediaKeys::stop() | 265 void MediaKeys::stop() |
| 265 { | 266 { |
| 266 ActiveDOMObject::stop(); | 267 ActiveDOMObject::stop(); |
| 267 | 268 |
| 268 if (m_timer.isActive()) | 269 if (m_timer.isActive()) |
| 269 m_timer.stop(); | 270 m_timer.stop(); |
| 270 m_pendingActions.clear(); | 271 m_pendingActions.clear(); |
| 271 } | 272 } |
| 272 | 273 |
| 273 } // namespace blink | 274 } // namespace blink |
| OLD | NEW |