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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // | 59 // |
60 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, | 60 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, |
61 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. | 61 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. |
62 // The WebContentDecryptionModuleSession has the same lifetime as this object. | 62 // The WebContentDecryptionModuleSession has the same lifetime as this object. |
63 class MediaKeySession FINAL | 63 class MediaKeySession FINAL |
64 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<MediaKeyS
ession>, public ActiveDOMObject, public EventTargetWithInlineData | 64 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<MediaKeyS
ession>, public ActiveDOMObject, public EventTargetWithInlineData |
65 , private blink::WebContentDecryptionModuleSession::Client { | 65 , private blink::WebContentDecryptionModuleSession::Client { |
66 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M
ediaKeySession>); | 66 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M
ediaKeySession>); |
67 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); | 67 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); |
68 public: | 68 public: |
69 static ScriptPromise create(ScriptState*, MediaKeys*, const String& initData
Type, PassRefPtr<Uint8Array> initData, const String& sessionType); | 69 static ScriptPromise create(ScriptState*, MediaKeys*, const String& initData
Type, PassRefPtr<ArrayBuffer> initData, const String& sessionType); |
70 virtual ~MediaKeySession(); | 70 virtual ~MediaKeySession(); |
71 | 71 |
72 const String& keySystem() const { return m_keySystem; } | 72 const String& keySystem() const { return m_keySystem; } |
73 String sessionId() const; | 73 String sessionId() const; |
74 | 74 |
75 void setError(MediaKeyError*); | 75 void setError(MediaKeyError*); |
76 MediaKeyError* error() { return m_error.get(); } | 76 MediaKeyError* error() { return m_error.get(); } |
77 | 77 |
78 ScriptPromise update(ScriptState*, Uint8Array* response); | 78 ScriptPromise update(ScriptState*, ArrayBuffer* response); |
| 79 ScriptPromise update(ScriptState*, ArrayBufferView* response); |
79 ScriptPromise release(ScriptState*); | 80 ScriptPromise release(ScriptState*); |
80 | 81 |
81 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 82 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); |
82 | 83 |
83 // EventTarget | 84 // EventTarget |
84 virtual const AtomicString& interfaceName() const OVERRIDE; | 85 virtual const AtomicString& interfaceName() const OVERRIDE; |
85 virtual ExecutionContext* executionContext() const OVERRIDE; | 86 virtual ExecutionContext* executionContext() const OVERRIDE; |
86 | 87 |
87 // ActiveDOMObject | 88 // ActiveDOMObject |
88 virtual bool hasPendingActivity() const OVERRIDE; | 89 virtual bool hasPendingActivity() const OVERRIDE; |
89 virtual void stop() OVERRIDE; | 90 virtual void stop() OVERRIDE; |
90 | 91 |
91 virtual void trace(Visitor*) OVERRIDE; | 92 virtual void trace(Visitor*) OVERRIDE; |
92 | 93 |
93 private: | 94 private: |
94 class PendingAction; | 95 class PendingAction; |
95 friend class MediaKeySessionInitializer; | 96 friend class MediaKeySessionInitializer; |
96 | 97 |
97 MediaKeySession(ExecutionContext*, MediaKeys*); | 98 MediaKeySession(ExecutionContext*, MediaKeys*); |
98 void actionTimerFired(Timer<MediaKeySession>*); | 99 void actionTimerFired(Timer<MediaKeySession>*); |
99 void finishInitialization(PassOwnPtr<blink::WebContentDecryptionModuleSessio
n>); | 100 void finishInitialization(PassOwnPtr<blink::WebContentDecryptionModuleSessio
n>); |
100 | 101 |
101 // blink::WebContentDecryptionModuleSession::Client | 102 // blink::WebContentDecryptionModuleSession::Client |
102 virtual void message(const unsigned char* message, size_t messageLength, con
st blink::WebURL& destinationURL) OVERRIDE; | 103 virtual void message(const unsigned char* message, size_t messageLength, con
st blink::WebURL& destinationURL) OVERRIDE; |
103 virtual void ready() OVERRIDE; | 104 virtual void ready() OVERRIDE; |
104 virtual void close() OVERRIDE; | 105 virtual void close() OVERRIDE; |
105 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; | 106 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; |
106 virtual void error(blink::WebContentDecryptionModuleException, unsigned long
systemCode, const blink::WebString& errorMessage) OVERRIDE; | 107 virtual void error(blink::WebContentDecryptionModuleException, unsigned long
systemCode, const blink::WebString& errorMessage) OVERRIDE; |
107 | 108 |
| 109 ScriptPromise updateInternal(ScriptState*, PassRefPtr<ArrayBuffer> response)
; |
| 110 |
108 String m_keySystem; | 111 String m_keySystem; |
109 RefPtrWillBeMember<MediaKeyError> m_error; | 112 RefPtrWillBeMember<MediaKeyError> m_error; |
110 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 113 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; |
111 OwnPtr<blink::WebContentDecryptionModuleSession> m_session; | 114 OwnPtr<blink::WebContentDecryptionModuleSession> m_session; |
112 | 115 |
113 // Used to determine if MediaKeys is still active. | 116 // Used to determine if MediaKeys is still active. |
114 WeakMember<MediaKeys> m_keys; | 117 WeakMember<MediaKeys> m_keys; |
115 | 118 |
116 // Is the CDM finished with this session? | 119 // Is the CDM finished with this session? |
117 bool m_isClosed; | 120 bool m_isClosed; |
118 | 121 |
119 HeapDeque<Member<PendingAction> > m_pendingActions; | 122 HeapDeque<Member<PendingAction> > m_pendingActions; |
120 Timer<MediaKeySession> m_actionTimer; | 123 Timer<MediaKeySession> m_actionTimer; |
121 }; | 124 }; |
122 | 125 |
123 } | 126 } |
124 | 127 |
125 #endif // MediaKeySession_h | 128 #endif // MediaKeySession_h |
OLD | NEW |