| 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*, PassOwnPtr<blink::WebContentD
ecryptionModuleSession>); | 98 MediaKeySession(ExecutionContext*, MediaKeys*, PassOwnPtr<blink::WebContentD
ecryptionModuleSession>); |
| 98 void actionTimerFired(Timer<MediaKeySession>*); | 99 void actionTimerFired(Timer<MediaKeySession>*); |
| 99 | 100 |
| 100 // blink::WebContentDecryptionModuleSession::Client | 101 // blink::WebContentDecryptionModuleSession::Client |
| 101 virtual void message(const unsigned char* message, size_t messageLength, con
st blink::WebURL& destinationURL) OVERRIDE; | 102 virtual void message(const unsigned char* message, size_t messageLength, con
st blink::WebURL& destinationURL) OVERRIDE; |
| 102 virtual void ready() OVERRIDE; | 103 virtual void ready() OVERRIDE; |
| 103 virtual void close() OVERRIDE; | 104 virtual void close() OVERRIDE; |
| 104 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; | 105 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; |
| 105 virtual void error(blink::WebContentDecryptionModuleException, unsigned long
systemCode, const blink::WebString& errorMessage) OVERRIDE; | 106 virtual void error(blink::WebContentDecryptionModuleException, unsigned long
systemCode, const blink::WebString& errorMessage) OVERRIDE; |
| 106 | 107 |
| 108 ScriptPromise updateInternal(ScriptState*, PassRefPtr<ArrayBuffer> response)
; |
| 109 |
| 107 String m_keySystem; | 110 String m_keySystem; |
| 108 RefPtrWillBeMember<MediaKeyError> m_error; | 111 RefPtrWillBeMember<MediaKeyError> m_error; |
| 109 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 112 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; |
| 110 OwnPtr<blink::WebContentDecryptionModuleSession> m_session; | 113 OwnPtr<blink::WebContentDecryptionModuleSession> m_session; |
| 111 | 114 |
| 112 // Used to determine if MediaKeys is still active. | 115 // Used to determine if MediaKeys is still active. |
| 113 WeakMember<MediaKeys> m_keys; | 116 WeakMember<MediaKeys> m_keys; |
| 114 | 117 |
| 115 // Is the CDM finished with this session? | 118 // Is the CDM finished with this session? |
| 116 bool m_isClosed; | 119 bool m_isClosed; |
| 117 | 120 |
| 118 HeapDeque<Member<PendingAction> > m_pendingActions; | 121 HeapDeque<Member<PendingAction> > m_pendingActions; |
| 119 Timer<MediaKeySession> m_actionTimer; | 122 Timer<MediaKeySession> m_actionTimer; |
| 120 }; | 123 }; |
| 121 | 124 |
| 122 } | 125 } |
| 123 | 126 |
| 124 #endif // MediaKeySession_h | 127 #endif // MediaKeySession_h |
| OLD | NEW |