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