Chromium Code Reviews| 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 10 matching lines...) Expand all Loading... | |
| 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef MediaKeys_h | 26 #ifndef MediaKeys_h |
| 27 #define MediaKeys_h | 27 #define MediaKeys_h |
| 28 | 28 |
| 29 #include "bindings/v8/ScriptWrappable.h" | 29 #include "bindings/v8/ScriptWrappable.h" |
| 30 #include "core/events/EventTarget.h" | 30 #include "core/events/EventTarget.h" |
| 31 #include "heap/Handle.h" | |
| 31 #include "modules/encryptedmedia/MediaKeySession.h" | 32 #include "modules/encryptedmedia/MediaKeySession.h" |
| 32 #include "platform/Timer.h" | 33 #include "platform/Timer.h" |
| 33 #include "wtf/Deque.h" | 34 #include "wtf/Deque.h" |
| 34 #include "wtf/OwnPtr.h" | 35 #include "wtf/OwnPtr.h" |
| 35 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
| 36 #include "wtf/RefCounted.h" | 37 #include "wtf/RefCounted.h" |
| 37 #include "wtf/Uint8Array.h" | 38 #include "wtf/Uint8Array.h" |
| 38 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
| 39 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 class WebContentDecryptionModule; | 43 class WebContentDecryptionModule; |
| 43 } | 44 } |
| 44 | 45 |
| 45 namespace WebCore { | 46 namespace WebCore { |
| 46 | 47 |
| 47 class ContentDecryptionModule; | 48 class ContentDecryptionModule; |
| 48 class HTMLMediaElement; | 49 class HTMLMediaElement; |
| 49 class ExceptionState; | 50 class ExceptionState; |
| 50 | 51 |
| 51 // References are held by JS and HTMLMediaElement. | 52 // References are held by JS and HTMLMediaElement. |
| 52 // The ContentDecryptionModule has the same lifetime as this object. | 53 // The ContentDecryptionModule has the same lifetime as this object. |
| 53 // Maintains a reference to all MediaKeySessions created to ensure they live as | 54 // Maintains a reference to all MediaKeySessions created to ensure they live as |
| 54 // long as this object unless explicitly close()'d. | 55 // long as this object unless explicitly close()'d. |
| 55 class MediaKeys : public RefCounted<MediaKeys>, public ScriptWrappable { | 56 class MediaKeys : public RefCountedWillBeGarbageCollectedFinalized<MediaKeys>, p ublic ScriptWrappable { |
| 57 DECLARE_GC_INFO; | |
| 56 public: | 58 public: |
| 57 static PassRefPtr<MediaKeys> create(const String& keySystem, ExceptionState& ); | 59 static PassRefPtrWillBeRawPtr<MediaKeys> create(const String& keySystem, Exc eptionState&); |
| 58 ~MediaKeys(); | 60 ~MediaKeys(); |
| 59 | 61 |
| 60 PassRefPtr<MediaKeySession> createSession(ExecutionContext*, const String& c ontentType, Uint8Array* initData, ExceptionState&); | 62 PassRefPtrWillBeRawPtr<MediaKeySession> createSession(ExecutionContext*, con st String& contentType, Uint8Array* initData, ExceptionState&); |
| 61 | 63 |
| 62 const String& keySystem() const { return m_keySystem; } | 64 const String& keySystem() const { return m_keySystem; } |
| 63 | 65 |
| 64 void setMediaElement(HTMLMediaElement*); | 66 void setMediaElement(HTMLMediaElement*); |
| 65 | 67 |
| 66 blink::WebContentDecryptionModule* contentDecryptionModule(); | 68 blink::WebContentDecryptionModule* contentDecryptionModule(); |
| 67 | 69 |
| 70 void trace(Visitor*) { } | |
| 71 | |
| 68 protected: | 72 protected: |
| 69 MediaKeys(const String& keySystem, PassOwnPtr<ContentDecryptionModule>); | 73 MediaKeys(const String& keySystem, PassOwnPtr<ContentDecryptionModule>); |
| 70 void initializeNewSessionTimerFired(Timer<MediaKeys>*); | 74 void initializeNewSessionTimerFired(Timer<MediaKeys>*); |
| 71 | 75 |
| 72 Vector<RefPtr<MediaKeySession> > m_sessions; | 76 Vector<RefPtr<MediaKeySession> > m_sessions; |
| 73 | 77 |
| 74 HTMLMediaElement* m_mediaElement; | 78 HTMLMediaElement* m_mediaElement; |
| 75 const String m_keySystem; | 79 const String m_keySystem; |
| 76 OwnPtr<ContentDecryptionModule> m_cdm; | 80 OwnPtr<ContentDecryptionModule> m_cdm; |
| 77 | 81 |
| 78 // FIXME: Check whether |initData| can be changed by JS. Maybe we should not pass it as a pointer. | 82 // FIXME: Check whether |initData| can be changed by JS. Maybe we should not pass it as a pointer. |
| 79 struct InitializeNewSessionData { | 83 struct InitializeNewSessionData { |
| 80 InitializeNewSessionData(PassRefPtr<MediaKeySession> session, const Stri ng& contentType, PassRefPtr<Uint8Array> initData) | 84 InitializeNewSessionData(PassRefPtrWillBeRawPtr<MediaKeySession> session , const String& contentType, PassRefPtr<Uint8Array> initData) |
| 81 : session(session) | 85 : session(session) |
| 82 , contentType(contentType) | 86 , contentType(contentType) |
| 83 , initData(initData) { } | 87 , initData(initData) { } |
| 84 RefPtr<MediaKeySession> session; | 88 RefPtrWillBePersistent<MediaKeySession> session; |
|
Mads Ager (chromium)
2014/02/07 07:19:25
I think this is fine. My guess would be that this
haraken
2014/02/07 07:22:54
I'll keep the current CL since this wouldn't be pe
zerny-chromium
2014/02/07 08:30:07
I agree with Mads that this should be traced and m
Mads Ager (chromium)
2014/02/07 08:52:34
It looks like that code was not moved from the bra
| |
| 85 String contentType; | 89 String contentType; |
| 86 RefPtr<Uint8Array> initData; | 90 RefPtr<Uint8Array> initData; |
| 87 }; | 91 }; |
| 88 Deque<InitializeNewSessionData> m_pendingInitializeNewSessionData; | 92 Deque<InitializeNewSessionData> m_pendingInitializeNewSessionData; |
| 89 Timer<MediaKeys> m_initializeNewSessionTimer; | 93 Timer<MediaKeys> m_initializeNewSessionTimer; |
| 90 }; | 94 }; |
| 91 | 95 |
| 92 } | 96 } |
| 93 | 97 |
| 94 #endif // MediaKeys_h | 98 #endif // MediaKeys_h |
| OLD | NEW |