| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // the CDM to continue to fire events for this session, as long as the session | 51 // the CDM to continue to fire events for this session, as long as the session |
| 52 // is open. | 52 // is open. |
| 53 // | 53 // |
| 54 // WeakPtr<MediaKeys> is used instead of having MediaKeys and MediaKeySession | 54 // WeakPtr<MediaKeys> is used instead of having MediaKeys and MediaKeySession |
| 55 // keep references to each other, and then having to inform the other object | 55 // keep references to each other, and then having to inform the other object |
| 56 // when it gets destroyed. | 56 // when it gets destroyed. |
| 57 // | 57 // |
| 58 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, | 58 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, |
| 59 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. | 59 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. |
| 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 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 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 | 77 |
| 78 void setError(MediaKeyError*); | 78 void setError(MediaKeyError*); |
| 79 MediaKeyError* error() { return m_error.get(); } | 79 MediaKeyError* error() { return m_error.get(); } |
| 80 | 80 |
| 81 ScriptPromise update(ScriptState*, ArrayBuffer* response); | 81 ScriptPromise update(ScriptState*, ArrayBuffer* response); |
| 82 ScriptPromise update(ScriptState*, ArrayBufferView* response); | 82 ScriptPromise update(ScriptState*, ArrayBufferView* response); |
| 83 ScriptPromise release(ScriptState*); | 83 ScriptPromise release(ScriptState*); |
| 84 | 84 |
| 85 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); | 85 void enqueueEvent(PassRefPtrWillBeRawPtr<Event>); |
| 86 | 86 |
| 87 // EventTarget | 87 // EventTarget |
| 88 virtual const AtomicString& interfaceName() const OVERRIDE; | 88 virtual const AtomicString& interfaceName() const override; |
| 89 virtual ExecutionContext* executionContext() const OVERRIDE; | 89 virtual ExecutionContext* executionContext() const override; |
| 90 | 90 |
| 91 // ActiveDOMObject | 91 // ActiveDOMObject |
| 92 virtual bool hasPendingActivity() const OVERRIDE; | 92 virtual bool hasPendingActivity() const override; |
| 93 virtual void stop() OVERRIDE; | 93 virtual void stop() override; |
| 94 | 94 |
| 95 virtual void trace(Visitor*) OVERRIDE; | 95 virtual void trace(Visitor*) override; |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 class PendingAction; | 98 class PendingAction; |
| 99 friend class NewSessionResult; | 99 friend class NewSessionResult; |
| 100 | 100 |
| 101 MediaKeySession(ScriptState*, MediaKeys*, const String& sessionType); | 101 MediaKeySession(ScriptState*, MediaKeys*, const String& sessionType); |
| 102 | 102 |
| 103 void actionTimerFired(Timer<MediaKeySession>*); | 103 void actionTimerFired(Timer<MediaKeySession>*); |
| 104 | 104 |
| 105 // WebContentDecryptionModuleSession::Client | 105 // WebContentDecryptionModuleSession::Client |
| 106 virtual void message(const unsigned char* message, size_t messageLength, con
st WebURL& destinationURL) OVERRIDE; | 106 virtual void message(const unsigned char* message, size_t messageLength, con
st WebURL& destinationURL) override; |
| 107 virtual void ready() OVERRIDE; | 107 virtual void ready() override; |
| 108 virtual void close() OVERRIDE; | 108 virtual void close() override; |
| 109 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; | 109 virtual void error(MediaKeyErrorCode, unsigned long systemCode) override; |
| 110 virtual void error(WebContentDecryptionModuleException, unsigned long system
Code, const WebString& errorMessage) OVERRIDE; | 110 virtual void error(WebContentDecryptionModuleException, unsigned long system
Code, const WebString& errorMessage) override; |
| 111 | 111 |
| 112 ScriptPromise generateRequestInternal(ScriptState*, const String& initDataTy
pe, PassRefPtr<ArrayBuffer> initData); | 112 ScriptPromise generateRequestInternal(ScriptState*, const String& initDataTy
pe, PassRefPtr<ArrayBuffer> initData); |
| 113 ScriptPromise updateInternal(ScriptState*, PassRefPtr<ArrayBuffer> response)
; | 113 ScriptPromise updateInternal(ScriptState*, PassRefPtr<ArrayBuffer> response)
; |
| 114 | 114 |
| 115 // Called by NewSessionResult when the new sesison has been created. | 115 // Called by NewSessionResult when the new sesison has been created. |
| 116 void finishGenerateRequest(); | 116 void finishGenerateRequest(); |
| 117 | 117 |
| 118 String m_keySystem; | 118 String m_keySystem; |
| 119 RefPtrWillBeMember<MediaKeyError> m_error; | 119 RefPtrWillBeMember<MediaKeyError> m_error; |
| 120 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 120 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 135 typedef ScriptPromiseProperty<Member<MediaKeySession>, V8UndefinedType, RefP
trWillBeMember<DOMException> > ClosedPromise; | 135 typedef ScriptPromiseProperty<Member<MediaKeySession>, V8UndefinedType, RefP
trWillBeMember<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 |