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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<MediaKeyS
ession>, public ActiveDOMObject, public EventTargetWithInlineData | 60 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<MediaKeyS
ession>, public ActiveDOMObject, public EventTargetWithInlineData |
61 , private WebContentDecryptionModuleSession::Client { | 61 , private WebContentDecryptionModuleSession::Client { |
62 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M
ediaKeySession>); | 62 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M
ediaKeySession>); |
63 DEFINE_WRAPPERTYPEINFO(); | 63 DEFINE_WRAPPERTYPEINFO(); |
64 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); | 64 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); |
65 public: | 65 public: |
66 static MediaKeySession* create(ScriptState*, MediaKeys*, const String& sessi
onType); | 66 static MediaKeySession* create(ScriptState*, MediaKeys*, const String& sessi
onType); |
67 static bool isValidSessionType(const String& sessionType); | 67 static bool isValidSessionType(const String& sessionType); |
68 virtual ~MediaKeySession(); | 68 virtual ~MediaKeySession(); |
69 | 69 |
70 const String& keySystem() const { return m_keySystem; } | |
71 String sessionId() const; | 70 String sessionId() const; |
72 double expiration() const { return m_expiration; } | 71 double expiration() const { return m_expiration; } |
73 ScriptPromise closed(ScriptState*); | 72 ScriptPromise closed(ScriptState*); |
74 | 73 |
75 ScriptPromise generateRequest(ScriptState*, const String& initDataType, DOMA
rrayBuffer* initData); | 74 ScriptPromise generateRequest(ScriptState*, const String& initDataType, DOMA
rrayBuffer* initData); |
76 ScriptPromise generateRequest(ScriptState*, const String& initDataType, DOMA
rrayBufferView* initData); | 75 ScriptPromise generateRequest(ScriptState*, const String& initDataType, DOMA
rrayBufferView* initData); |
77 ScriptPromise load(ScriptState*, const String& sessionId); | 76 ScriptPromise load(ScriptState*, const String& sessionId); |
78 | 77 |
79 void setError(MediaKeyError*); | |
80 MediaKeyError* error() { return m_error.get(); } | |
81 | |
82 ScriptPromise update(ScriptState*, DOMArrayBuffer* response); | 78 ScriptPromise update(ScriptState*, DOMArrayBuffer* response); |
83 ScriptPromise update(ScriptState*, DOMArrayBufferView* response); | 79 ScriptPromise update(ScriptState*, DOMArrayBufferView* response); |
84 ScriptPromise close(ScriptState*); | 80 ScriptPromise close(ScriptState*); |
85 ScriptPromise remove(ScriptState*); | 81 ScriptPromise remove(ScriptState*); |
86 | 82 |
87 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 83 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); |
88 | 84 |
89 // EventTarget | 85 // EventTarget |
90 virtual const AtomicString& interfaceName() const override; | 86 virtual const AtomicString& interfaceName() const override; |
91 virtual ExecutionContext* executionContext() const override; | 87 virtual ExecutionContext* executionContext() const override; |
(...skipping 24 matching lines...) Expand all Loading... |
116 ScriptPromise generateRequestInternal(ScriptState*, const String& initDataTy
pe, PassRefPtr<ArrayBuffer> initData); | 112 ScriptPromise generateRequestInternal(ScriptState*, const String& initDataTy
pe, PassRefPtr<ArrayBuffer> initData); |
117 ScriptPromise updateInternal(ScriptState*, PassRefPtr<ArrayBuffer> response)
; | 113 ScriptPromise updateInternal(ScriptState*, PassRefPtr<ArrayBuffer> response)
; |
118 | 114 |
119 // Called by NewSessionResult when the new session has been created. | 115 // Called by NewSessionResult when the new session has been created. |
120 void finishGenerateRequest(); | 116 void finishGenerateRequest(); |
121 | 117 |
122 // Called by LoadSessionResult when the session has been loaded. | 118 // Called by LoadSessionResult when the session has been loaded. |
123 void finishLoad(); | 119 void finishLoad(); |
124 | 120 |
125 String m_keySystem; | 121 String m_keySystem; |
126 RefPtrWillBeMember<MediaKeyError> m_error; | |
127 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 122 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; |
128 OwnPtr<WebContentDecryptionModuleSession> m_session; | 123 OwnPtr<WebContentDecryptionModuleSession> m_session; |
129 | 124 |
130 // Used to determine if MediaKeys is still active. | 125 // Used to determine if MediaKeys is still active. |
131 WeakMember<MediaKeys> m_mediaKeys; | 126 WeakMember<MediaKeys> m_mediaKeys; |
132 | 127 |
133 // Session properties. | 128 // Session properties. |
134 String m_sessionType; | 129 String m_sessionType; |
135 double m_expiration; | 130 double m_expiration; |
136 | 131 |
137 // Session states. | 132 // Session states. |
138 bool m_isUninitialized; | 133 bool m_isUninitialized; |
139 bool m_isCallable; | 134 bool m_isCallable; |
140 bool m_isClosed; // Is the CDM finished with this session? | 135 bool m_isClosed; // Is the CDM finished with this session? |
141 | 136 |
142 // Keep track of the closed promise. | 137 // Keep track of the closed promise. |
143 typedef ScriptPromiseProperty<Member<MediaKeySession>, V8UndefinedType, RefP
trWillBeMember<DOMException> > ClosedPromise; | 138 typedef ScriptPromiseProperty<Member<MediaKeySession>, V8UndefinedType, RefP
trWillBeMember<DOMException> > ClosedPromise; |
144 Member<ClosedPromise> m_closedPromise; | 139 Member<ClosedPromise> m_closedPromise; |
145 | 140 |
146 HeapDeque<Member<PendingAction> > m_pendingActions; | 141 HeapDeque<Member<PendingAction> > m_pendingActions; |
147 Timer<MediaKeySession> m_actionTimer; | 142 Timer<MediaKeySession> m_actionTimer; |
148 }; | 143 }; |
149 | 144 |
150 } // namespace blink | 145 } // namespace blink |
151 | 146 |
152 #endif // MediaKeySession_h | 147 #endif // MediaKeySession_h |
OLD | NEW |