| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // is open. | 57 // is open. |
| 58 // | 58 // |
| 59 // WeakPtr<MediaKeys> is used instead of having MediaKeys and MediaKeySession | 59 // WeakPtr<MediaKeys> is used instead of having MediaKeys and MediaKeySession |
| 60 // keep references to each other, and then having to inform the other object | 60 // keep references to each other, and then having to inform the other object |
| 61 // when it gets destroyed. | 61 // when it gets destroyed. |
| 62 // | 62 // |
| 63 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, | 63 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, |
| 64 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. | 64 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. |
| 65 // The WebContentDecryptionModuleSession has the same lifetime as this object. | 65 // The WebContentDecryptionModuleSession has the same lifetime as this object. |
| 66 class MediaKeySession FINAL | 66 class MediaKeySession FINAL |
| 67 : public RefCountedWillBeRefCountedGarbageCollected<MediaKeySession>, public
ActiveDOMObject, public ScriptWrappable, public EventTargetWithInlineData | 67 : public RefCountedGarbageCollected<MediaKeySession>, public ActiveDOMObject
, public ScriptWrappable, public EventTargetWithInlineData |
| 68 , private blink::WebContentDecryptionModuleSession::Client { | 68 , private blink::WebContentDecryptionModuleSession::Client { |
| 69 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<M
ediaKeySession>); | 69 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedGarbageCollected<MediaKeySession>)
; |
| 70 public: | 70 public: |
| 71 static PassRefPtrWillBeRawPtr<MediaKeySession> create(ExecutionContext*, bli
nk::WebContentDecryptionModule*, WeakPtrWillBeRawPtr<MediaKeys>); | 71 static MediaKeySession* create(ExecutionContext*, blink::WebContentDecryptio
nModule*, MediaKeys*); |
| 72 virtual ~MediaKeySession(); | 72 virtual ~MediaKeySession(); |
| 73 | 73 |
| 74 const String& keySystem() const { return m_keySystem; } | 74 const String& keySystem() const { return m_keySystem; } |
| 75 String sessionId() const; | 75 String sessionId() const; |
| 76 | 76 |
| 77 void setError(MediaKeyError*); | 77 void setError(MediaKeyError*); |
| 78 MediaKeyError* error() { return m_error.get(); } | 78 MediaKeyError* error() { return m_error.get(); } |
| 79 | 79 |
| 80 void initializeNewSession(const String& mimeType, const Uint8Array& initData
); | 80 void initializeNewSession(const String& mimeType, const Uint8Array& initData
); |
| 81 void update(Uint8Array* response, ExceptionState&); | 81 void update(Uint8Array* response, ExceptionState&); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 104 const RefPtr<Uint8Array> data; | 104 const RefPtr<Uint8Array> data; |
| 105 | 105 |
| 106 static PassOwnPtr<PendingAction> CreatePendingUpdate(PassRefPtr<Uint8Arr
ay> data); | 106 static PassOwnPtr<PendingAction> CreatePendingUpdate(PassRefPtr<Uint8Arr
ay> data); |
| 107 static PassOwnPtr<PendingAction> CreatePendingRelease(); | 107 static PassOwnPtr<PendingAction> CreatePendingRelease(); |
| 108 ~PendingAction(); | 108 ~PendingAction(); |
| 109 | 109 |
| 110 private: | 110 private: |
| 111 PendingAction(Type, PassRefPtr<Uint8Array> data); | 111 PendingAction(Type, PassRefPtr<Uint8Array> data); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 MediaKeySession(ExecutionContext*, blink::WebContentDecryptionModule*, WeakP
trWillBeRawPtr<MediaKeys>); | 114 MediaKeySession(ExecutionContext*, blink::WebContentDecryptionModule*, Media
Keys*); |
| 115 void actionTimerFired(Timer<MediaKeySession>*); | 115 void actionTimerFired(Timer<MediaKeySession>*); |
| 116 | 116 |
| 117 // blink::WebContentDecryptionModuleSession::Client | 117 // blink::WebContentDecryptionModuleSession::Client |
| 118 virtual void message(const unsigned char* message, size_t messageLength, con
st blink::WebURL& destinationURL) OVERRIDE; | 118 virtual void message(const unsigned char* message, size_t messageLength, con
st blink::WebURL& destinationURL) OVERRIDE; |
| 119 virtual void ready() OVERRIDE; | 119 virtual void ready() OVERRIDE; |
| 120 virtual void close() OVERRIDE; | 120 virtual void close() OVERRIDE; |
| 121 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; | 121 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; |
| 122 | 122 |
| 123 String m_keySystem; | 123 String m_keySystem; |
| 124 RefPtr<MediaKeyError> m_error; | 124 RefPtr<MediaKeyError> m_error; |
| 125 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 125 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
| 126 OwnPtr<blink::WebContentDecryptionModuleSession> m_session; | 126 OwnPtr<blink::WebContentDecryptionModuleSession> m_session; |
| 127 | 127 |
| 128 // Used to determine if MediaKeys is still active. | 128 // Used to determine if MediaKeys is still active. |
| 129 WeakPtrWillBeWeakMember<MediaKeys> m_keys; | 129 WeakMember<MediaKeys> m_keys; |
| 130 | 130 |
| 131 // Is the CDM finished with this session? | 131 // Is the CDM finished with this session? |
| 132 bool m_isClosed; | 132 bool m_isClosed; |
| 133 | 133 |
| 134 Deque<OwnPtr<PendingAction> > m_pendingActions; | 134 Deque<OwnPtr<PendingAction> > m_pendingActions; |
| 135 Timer<MediaKeySession> m_actionTimer; | 135 Timer<MediaKeySession> m_actionTimer; |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 } | 138 } |
| 139 | 139 |
| 140 #endif // MediaKeySession_h | 140 #endif // MediaKeySession_h |
| OLD | NEW |