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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 public: | 67 public: |
68 static MediaKeySession* create(ScriptState*, MediaKeys*, const String& sessi onType); | 68 static MediaKeySession* create(ScriptState*, MediaKeys*, const String& sessi onType); |
69 virtual ~MediaKeySession(); | 69 virtual ~MediaKeySession(); |
70 | 70 |
71 const String& keySystem() const { return m_keySystem; } | 71 const String& keySystem() const { return m_keySystem; } |
72 String sessionId() const; | 72 String sessionId() const; |
73 ScriptPromise closed(ScriptState*); | 73 ScriptPromise closed(ScriptState*); |
74 | 74 |
75 ScriptPromise generateRequest(ScriptState*, const String& initDataType, Arra yBuffer* initData); | 75 ScriptPromise generateRequest(ScriptState*, const String& initDataType, Arra yBuffer* initData); |
76 ScriptPromise generateRequest(ScriptState*, const String& initDataType, Arra yBufferView* initData); | 76 ScriptPromise generateRequest(ScriptState*, const String& initDataType, Arra yBufferView* initData); |
77 ScriptPromise load(ScriptState*, const String& sessionId); | |
77 | 78 |
78 void setError(MediaKeyError*); | 79 void setError(MediaKeyError*); |
79 MediaKeyError* error() { return m_error.get(); } | 80 MediaKeyError* error() { return m_error.get(); } |
80 | 81 |
81 ScriptPromise update(ScriptState*, ArrayBuffer* response); | 82 ScriptPromise update(ScriptState*, ArrayBuffer* response); |
82 ScriptPromise update(ScriptState*, ArrayBufferView* response); | 83 ScriptPromise update(ScriptState*, ArrayBufferView* response); |
83 ScriptPromise release(ScriptState*); | 84 ScriptPromise release(ScriptState*); |
84 | 85 |
85 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 86 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); |
86 | 87 |
87 // EventTarget | 88 // EventTarget |
88 virtual const AtomicString& interfaceName() const OVERRIDE; | 89 virtual const AtomicString& interfaceName() const OVERRIDE; |
89 virtual ExecutionContext* executionContext() const OVERRIDE; | 90 virtual ExecutionContext* executionContext() const OVERRIDE; |
90 | 91 |
91 // ActiveDOMObject | 92 // ActiveDOMObject |
92 virtual bool hasPendingActivity() const OVERRIDE; | 93 virtual bool hasPendingActivity() const OVERRIDE; |
93 virtual void stop() OVERRIDE; | 94 virtual void stop() OVERRIDE; |
94 | 95 |
95 virtual void trace(Visitor*) OVERRIDE; | 96 virtual void trace(Visitor*) OVERRIDE; |
96 | 97 |
97 private: | 98 private: |
98 class PendingAction; | 99 class PendingAction; |
99 friend class NewSessionResult; | 100 friend class NewSessionResult; |
101 friend class LoadSessionResult; | |
100 | 102 |
101 MediaKeySession(ScriptState*, MediaKeys*, const String& sessionType); | 103 MediaKeySession(ScriptState*, MediaKeys*, const String& sessionType); |
102 | 104 |
103 void actionTimerFired(Timer<MediaKeySession>*); | 105 void actionTimerFired(Timer<MediaKeySession>*); |
104 | 106 |
105 // WebContentDecryptionModuleSession::Client | 107 // WebContentDecryptionModuleSession::Client |
106 virtual void message(const unsigned char* message, size_t messageLength, con st WebURL& destinationURL) OVERRIDE; | 108 virtual void message(const unsigned char* message, size_t messageLength, con st WebURL& destinationURL) OVERRIDE; |
107 virtual void ready() OVERRIDE; | 109 virtual void ready() OVERRIDE; |
108 virtual void close() OVERRIDE; | 110 virtual void close() OVERRIDE; |
109 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; | 111 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; |
110 virtual void error(WebContentDecryptionModuleException, unsigned long system Code, const WebString& errorMessage) OVERRIDE; | 112 virtual void error(WebContentDecryptionModuleException, unsigned long system Code, const WebString& errorMessage) OVERRIDE; |
111 | 113 |
112 ScriptPromise generateRequestInternal(ScriptState*, const String& initDataTy pe, PassRefPtr<ArrayBuffer> initData); | 114 ScriptPromise generateRequestInternal(ScriptState*, const String& initDataTy pe, PassRefPtr<ArrayBuffer> initData); |
113 ScriptPromise updateInternal(ScriptState*, PassRefPtr<ArrayBuffer> response) ; | 115 ScriptPromise updateInternal(ScriptState*, PassRefPtr<ArrayBuffer> response) ; |
114 | 116 |
115 // Called by NewSessionResult when the new sesison has been created. | 117 // Called by NewSessionResult when the new session has been created. |
116 void finishGenerateRequest(); | 118 void finishGenerateRequest(); |
117 | 119 |
120 // Called by LoadSessionResult when the session has been loaded. | |
121 void finishLoadSession(); | |
sandersd (OOO until July 31)
2014/10/08 18:18:22
finishLoad() to be consistent?
jrummell
2014/10/08 21:13:20
Done.
| |
122 | |
118 String m_keySystem; | 123 String m_keySystem; |
119 RefPtrWillBeMember<MediaKeyError> m_error; | 124 RefPtrWillBeMember<MediaKeyError> m_error; |
120 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 125 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; |
121 OwnPtr<WebContentDecryptionModuleSession> m_session; | 126 OwnPtr<WebContentDecryptionModuleSession> m_session; |
122 | 127 |
123 // Used to determine if MediaKeys is still active. | 128 // Used to determine if MediaKeys is still active. |
124 WeakMember<MediaKeys> m_mediaKeys; | 129 WeakMember<MediaKeys> m_mediaKeys; |
125 | 130 |
126 // Session properties. | 131 // Session properties. |
127 String m_sessionType; | 132 String m_sessionType; |
128 | 133 |
129 // Session states. | 134 // Session states. |
130 bool m_isUninitialized; | 135 bool m_isUninitialized; |
131 bool m_isCallable; | 136 bool m_isCallable; |
132 bool m_isClosed; // Is the CDM finished with this session? | 137 bool m_isClosed; // Is the CDM finished with this session? |
133 | 138 |
134 // Keep track of the closed promise. | 139 // Keep track of the closed promise. |
135 typedef ScriptPromiseProperty<Member<MediaKeySession>, V8UndefinedType, RefP trWillBeMember<DOMException> > ClosedPromise; | 140 typedef ScriptPromiseProperty<Member<MediaKeySession>, V8UndefinedType, RefP trWillBeMember<DOMException> > ClosedPromise; |
136 Member<ClosedPromise> m_closedPromise; | 141 Member<ClosedPromise> m_closedPromise; |
137 | 142 |
138 HeapDeque<Member<PendingAction> > m_pendingActions; | 143 HeapDeque<Member<PendingAction> > m_pendingActions; |
139 Timer<MediaKeySession> m_actionTimer; | 144 Timer<MediaKeySession> m_actionTimer; |
140 }; | 145 }; |
141 | 146 |
142 } // namespace blink | 147 } // namespace blink |
143 | 148 |
144 #endif // MediaKeySession_h | 149 #endif // MediaKeySession_h |
OLD | NEW |