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 // The WebContentDecryptionModuleSession has the same lifetime as this object. | 60 // The WebContentDecryptionModuleSession has the same lifetime as this object. |
61 class MediaKeySession final | 61 class MediaKeySession final |
62 : public RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession
> | 62 : public RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession
> |
63 , public ActiveDOMObject | 63 , public ActiveDOMObject |
64 , private WebContentDecryptionModuleSession::Client { | 64 , private WebContentDecryptionModuleSession::Client { |
65 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MediaKeySession); | 65 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MediaKeySession); |
66 DEFINE_WRAPPERTYPEINFO(); | 66 DEFINE_WRAPPERTYPEINFO(); |
67 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); | 67 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); |
68 public: | 68 public: |
69 static MediaKeySession* create(ScriptState*, MediaKeys*, WebEncryptedMediaSe
ssionType); | 69 static MediaKeySession* create(ScriptState*, MediaKeys*, WebEncryptedMediaSe
ssionType); |
70 virtual ~MediaKeySession(); | 70 ~MediaKeySession() override; |
71 | 71 |
72 String sessionId() const; | 72 String sessionId() const; |
73 double expiration() const { return m_expiration; } | 73 double expiration() const { return m_expiration; } |
74 ScriptPromise closed(ScriptState*); | 74 ScriptPromise closed(ScriptState*); |
75 MediaKeyStatusMap* keyStatuses(); | 75 MediaKeyStatusMap* keyStatuses(); |
76 | 76 |
77 ScriptPromise generateRequest(ScriptState*, const String& initDataType, cons
t DOMArrayPiece& initData); | 77 ScriptPromise generateRequest(ScriptState*, const String& initDataType, cons
t DOMArrayPiece& initData); |
78 ScriptPromise load(ScriptState*, const String& sessionId); | 78 ScriptPromise load(ScriptState*, const String& sessionId); |
79 | 79 |
80 ScriptPromise update(ScriptState*, const DOMArrayPiece& response); | 80 ScriptPromise update(ScriptState*, const DOMArrayPiece& response); |
81 ScriptPromise close(ScriptState*); | 81 ScriptPromise close(ScriptState*); |
82 ScriptPromise remove(ScriptState*); | 82 ScriptPromise remove(ScriptState*); |
83 | 83 |
84 // EventTarget | 84 // EventTarget |
85 virtual const AtomicString& interfaceName() const override; | 85 const AtomicString& interfaceName() const override; |
86 virtual ExecutionContext* executionContext() const override; | 86 ExecutionContext* executionContext() const override; |
87 | 87 |
88 // ActiveDOMObject | 88 // ActiveDOMObject |
89 virtual bool hasPendingActivity() const override; | 89 bool hasPendingActivity() const override; |
90 virtual void stop() override; | 90 void stop() override; |
91 | 91 |
92 // Oilpan: eagerly release owned m_session, which in turn | 92 // Oilpan: eagerly release owned m_session, which in turn |
93 // drops the client reference back to this MediaKeySession object. | 93 // drops the client reference back to this MediaKeySession object. |
94 EAGERLY_FINALIZE(); | 94 EAGERLY_FINALIZE(); |
95 DECLARE_VIRTUAL_TRACE(); | 95 DECLARE_VIRTUAL_TRACE(); |
96 | 96 |
97 private: | 97 private: |
98 class PendingAction; | 98 class PendingAction; |
99 friend class NewSessionResultPromise; | 99 friend class NewSessionResultPromise; |
100 friend class LoadSessionResultPromise; | 100 friend class LoadSessionResultPromise; |
101 | 101 |
102 MediaKeySession(ScriptState*, MediaKeys*, WebEncryptedMediaSessionType); | 102 MediaKeySession(ScriptState*, MediaKeys*, WebEncryptedMediaSessionType); |
103 | 103 |
104 void actionTimerFired(Timer<MediaKeySession>*); | 104 void actionTimerFired(Timer<MediaKeySession>*); |
105 | 105 |
106 // WebContentDecryptionModuleSession::Client | 106 // WebContentDecryptionModuleSession::Client |
107 virtual void message(MessageType, const unsigned char* message, size_t messa
geLength) override; | 107 void message(MessageType, const unsigned char* message, size_t messageLength
) override; |
108 virtual void close() override; | 108 void close() override; |
109 virtual void expirationChanged(double updatedExpiryTimeInMS) override; | 109 void expirationChanged(double updatedExpiryTimeInMS) override; |
110 virtual void keysStatusesChange(const WebVector<WebEncryptedMediaKeyInformat
ion>&, bool hasAdditionalUsableKey) override; | 110 void keysStatusesChange(const WebVector<WebEncryptedMediaKeyInformation>&, b
ool hasAdditionalUsableKey) override; |
111 | 111 |
112 // Called by NewSessionResult when the new session has been created. | 112 // Called by NewSessionResult when the new session has been created. |
113 void finishGenerateRequest(); | 113 void finishGenerateRequest(); |
114 | 114 |
115 // Called by LoadSessionResult when the session has been loaded. | 115 // Called by LoadSessionResult when the session has been loaded. |
116 void finishLoad(); | 116 void finishLoad(); |
117 | 117 |
118 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 118 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; |
119 OwnPtr<WebContentDecryptionModuleSession> m_session; | 119 OwnPtr<WebContentDecryptionModuleSession> m_session; |
120 | 120 |
(...skipping 14 matching lines...) Expand all Loading... |
135 typedef ScriptPromiseProperty<Member<MediaKeySession>, ToV8UndefinedGenerato
r, Member<DOMException>> ClosedPromise; | 135 typedef ScriptPromiseProperty<Member<MediaKeySession>, ToV8UndefinedGenerato
r, Member<DOMException>> ClosedPromise; |
136 Member<ClosedPromise> m_closedPromise; | 136 Member<ClosedPromise> m_closedPromise; |
137 | 137 |
138 HeapDeque<Member<PendingAction>> m_pendingActions; | 138 HeapDeque<Member<PendingAction>> m_pendingActions; |
139 Timer<MediaKeySession> m_actionTimer; | 139 Timer<MediaKeySession> m_actionTimer; |
140 }; | 140 }; |
141 | 141 |
142 } // namespace blink | 142 } // namespace blink |
143 | 143 |
144 #endif // MediaKeySession_h | 144 #endif // MediaKeySession_h |
OLD | NEW |