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 11 matching lines...) Expand all Loading... | |
| 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 MediaKeySession_h | 26 #ifndef MediaKeySession_h |
| 27 #define MediaKeySession_h | 27 #define MediaKeySession_h |
| 28 | 28 |
| 29 #include "bindings/v8/ScriptWrappable.h" | 29 #include "bindings/v8/ScriptWrappable.h" |
| 30 #include "core/dom/ContextLifecycleObserver.h" | 30 #include "core/dom/ContextLifecycleObserver.h" |
| 31 #include "core/events/EventTarget.h" | 31 #include "core/events/EventTarget.h" |
| 32 #include "heap/Handle.h" | |
| 32 #include "platform/Timer.h" | 33 #include "platform/Timer.h" |
| 33 #include "platform/drm/ContentDecryptionModuleSession.h" | 34 #include "platform/drm/ContentDecryptionModuleSession.h" |
| 34 #include "wtf/Deque.h" | 35 #include "wtf/Deque.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/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
| 39 | 40 |
| 40 namespace WebCore { | 41 namespace WebCore { |
| 41 | 42 |
| 42 class ContentDecryptionModule; | 43 class ContentDecryptionModule; |
| 43 class ContentDecryptionModuleSession; | 44 class ContentDecryptionModuleSession; |
| 44 class ExceptionState; | 45 class ExceptionState; |
| 45 class GenericEventQueue; | 46 class GenericEventQueue; |
| 46 class MediaKeyError; | 47 class MediaKeyError; |
| 47 class MediaKeys; | 48 class MediaKeys; |
| 48 | 49 |
| 49 // References are held by JS and MediaKeys. | 50 // References are held by JS and MediaKeys. |
| 50 // Because this object controls the lifetime of the ContentDecryptionModuleSessi on, | 51 // Because this object controls the lifetime of the ContentDecryptionModuleSessi on, |
| 51 // it may outlive any references to it as long as the MediaKeys object is alive. | 52 // it may outlive any references to it as long as the MediaKeys object is alive. |
| 52 // The ContentDecryptionModuleSession has the same lifetime as this object. | 53 // The ContentDecryptionModuleSession has the same lifetime as this object. |
| 53 class MediaKeySession FINAL | 54 class MediaKeySession FINAL |
| 54 : public RefCounted<MediaKeySession>, public ScriptWrappable, public EventTa rgetWithInlineData, public ContextLifecycleObserver | 55 : public RefCountedWillBeGarbageCollectedFinalized<MediaKeySession>, public ScriptWrappable, public EventTargetWithInlineData, public ContextLifecycleObserv er |
|
Mads Ager (chromium)
2014/02/06 12:28:47
I don't think you can move this to GarbageCollecte
| |
| 55 , private ContentDecryptionModuleSessionClient { | 56 , private ContentDecryptionModuleSessionClient { |
| 57 DECLARE_GC_INFO; | |
| 56 REFCOUNTED_EVENT_TARGET(MediaKeySession); | 58 REFCOUNTED_EVENT_TARGET(MediaKeySession); |
|
haraken
2014/02/06 12:08:40
This doesn't compile with the following error:
..
| |
| 57 public: | 59 public: |
| 58 static PassRefPtr<MediaKeySession> create(ExecutionContext*, ContentDecrypti onModule*, MediaKeys*); | 60 static PassRefPtrWillBeRawPtr<MediaKeySession> create(ExecutionContext*, Con tentDecryptionModule*, MediaKeys*); |
| 59 virtual ~MediaKeySession(); | 61 virtual ~MediaKeySession(); |
| 60 | 62 |
| 61 const String& keySystem() const { return m_keySystem; } | 63 const String& keySystem() const { return m_keySystem; } |
| 62 String sessionId() const; | 64 String sessionId() const; |
| 63 | 65 |
| 64 void setError(MediaKeyError*); | 66 void setError(MediaKeyError*); |
| 65 MediaKeyError* error() { return m_error.get(); } | 67 MediaKeyError* error() { return m_error.get(); } |
| 66 | 68 |
| 67 void initializeNewSession(const String& mimeType, const Uint8Array& initData ); | 69 void initializeNewSession(const String& mimeType, const Uint8Array& initData ); |
| 68 void update(Uint8Array* response, ExceptionState&); | 70 void update(Uint8Array* response, ExceptionState&); |
| 69 void release(ExceptionState&); | 71 void release(ExceptionState&); |
| 70 | 72 |
| 71 void enqueueEvent(PassRefPtr<Event>); | 73 void enqueueEvent(PassRefPtr<Event>); |
| 72 | 74 |
| 73 virtual const AtomicString& interfaceName() const OVERRIDE; | 75 virtual const AtomicString& interfaceName() const OVERRIDE; |
| 74 virtual ExecutionContext* executionContext() const OVERRIDE; | 76 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 75 | 77 |
| 78 void trace(Visitor*) { } | |
| 79 | |
| 76 private: | 80 private: |
| 77 MediaKeySession(ExecutionContext*, ContentDecryptionModule*, MediaKeys*); | 81 MediaKeySession(ExecutionContext*, ContentDecryptionModule*, MediaKeys*); |
| 78 void updateTimerFired(Timer<MediaKeySession>*); | 82 void updateTimerFired(Timer<MediaKeySession>*); |
| 79 | 83 |
| 80 // ContentDecryptionModuleSessionClient | 84 // ContentDecryptionModuleSessionClient |
| 81 virtual void message(const unsigned char* message, size_t messageLength, con st KURL& destinationURL) OVERRIDE; | 85 virtual void message(const unsigned char* message, size_t messageLength, con st KURL& destinationURL) OVERRIDE; |
| 82 virtual void ready() OVERRIDE; | 86 virtual void ready() OVERRIDE; |
| 83 virtual void close() OVERRIDE; | 87 virtual void close() OVERRIDE; |
| 84 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; | 88 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; |
| 85 | 89 |
| 86 String m_keySystem; | 90 String m_keySystem; |
| 87 RefPtr<MediaKeyError> m_error; | 91 RefPtr<MediaKeyError> m_error; |
| 88 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 92 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
| 89 OwnPtr<ContentDecryptionModuleSession> m_session; | 93 OwnPtr<ContentDecryptionModuleSession> m_session; |
| 90 // Used to remove the reference from the parent MediaKeys when close()'d. | 94 // Used to remove the reference from the parent MediaKeys when close()'d. |
| 91 MediaKeys* m_keys; | 95 MediaKeys* m_keys; |
| 92 | 96 |
| 93 Deque<RefPtr<Uint8Array> > m_pendingUpdates; | 97 Deque<RefPtr<Uint8Array> > m_pendingUpdates; |
| 94 Timer<MediaKeySession> m_updateTimer; | 98 Timer<MediaKeySession> m_updateTimer; |
| 95 }; | 99 }; |
| 96 | 100 |
| 97 } | 101 } |
| 98 | 102 |
| 99 #endif // MediaKeySession_h | 103 #endif // MediaKeySession_h |
| OLD | NEW |