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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // is open. | 57 // is open. |
58 // | 58 // |
59 // WeakPtr<MediaKeys> is used instead of having MediaKeys and MediaKeySession | 59 // WeakPtr<MediaKeys> is used instead of having MediaKeys and MediaKeySession |
60 // keep references to each other, and then having to inform the other object | 60 // keep references to each other, and then having to inform the other object |
61 // when it gets destroyed. | 61 // when it gets destroyed. |
62 // | 62 // |
63 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, | 63 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, |
64 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. | 64 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. |
65 // The WebContentDecryptionModuleSession has the same lifetime as this object. | 65 // The WebContentDecryptionModuleSession has the same lifetime as this object. |
66 class MediaKeySession FINAL | 66 class MediaKeySession FINAL |
67 : public RefCountedWillBeRefCountedGarbageCollected<MediaKeySession>, public
ActiveDOMObject, public ScriptWrappable, public EventTargetWithInlineData | 67 : public RefCountedGarbageCollected<MediaKeySession>, public ActiveDOMObject
, public ScriptWrappable, public EventTargetWithInlineData |
68 , private blink::WebContentDecryptionModuleSession::Client { | 68 , private blink::WebContentDecryptionModuleSession::Client { |
69 REFCOUNTED_EVENT_TARGET(MediaKeySession); | 69 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedGarbageCollected<MediaKeySession>)
; |
70 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); | 70 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); |
71 public: | 71 public: |
72 static PassRefPtrWillBeRawPtr<MediaKeySession> create(ExecutionContext*, bli
nk::WebContentDecryptionModule*, WeakPtrWillBeRawPtr<MediaKeys>); | 72 static MediaKeySession* create(ExecutionContext*, blink::WebContentDecryptio
nModule*, MediaKeys*); |
73 virtual ~MediaKeySession(); | 73 virtual ~MediaKeySession(); |
74 | 74 |
75 const String& keySystem() const { return m_keySystem; } | 75 const String& keySystem() const { return m_keySystem; } |
76 String sessionId() const; | 76 String sessionId() const; |
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 void initializeNewSession(const String& mimeType, const Uint8Array& initData
); | 81 void initializeNewSession(const String& mimeType, const Uint8Array& initData
); |
82 void update(Uint8Array* response, ExceptionState&); | 82 void update(Uint8Array* response, ExceptionState&); |
(...skipping 22 matching lines...) Expand all Loading... |
105 const RefPtr<Uint8Array> data; | 105 const RefPtr<Uint8Array> data; |
106 | 106 |
107 static PassOwnPtr<PendingAction> CreatePendingUpdate(PassRefPtr<Uint8Arr
ay> data); | 107 static PassOwnPtr<PendingAction> CreatePendingUpdate(PassRefPtr<Uint8Arr
ay> data); |
108 static PassOwnPtr<PendingAction> CreatePendingRelease(); | 108 static PassOwnPtr<PendingAction> CreatePendingRelease(); |
109 ~PendingAction(); | 109 ~PendingAction(); |
110 | 110 |
111 private: | 111 private: |
112 PendingAction(Type, PassRefPtr<Uint8Array> data); | 112 PendingAction(Type, PassRefPtr<Uint8Array> data); |
113 }; | 113 }; |
114 | 114 |
115 MediaKeySession(ExecutionContext*, blink::WebContentDecryptionModule*, WeakP
trWillBeRawPtr<MediaKeys>); | 115 MediaKeySession(ExecutionContext*, blink::WebContentDecryptionModule*, Media
Keys*); |
116 void actionTimerFired(Timer<MediaKeySession>*); | 116 void actionTimerFired(Timer<MediaKeySession>*); |
117 | 117 |
118 // blink::WebContentDecryptionModuleSession::Client | 118 // blink::WebContentDecryptionModuleSession::Client |
119 virtual void message(const unsigned char* message, size_t messageLength, con
st blink::WebURL& destinationURL) OVERRIDE; | 119 virtual void message(const unsigned char* message, size_t messageLength, con
st blink::WebURL& destinationURL) OVERRIDE; |
120 virtual void ready() OVERRIDE; | 120 virtual void ready() OVERRIDE; |
121 virtual void close() OVERRIDE; | 121 virtual void close() OVERRIDE; |
122 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; | 122 virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; |
123 | 123 |
124 String m_keySystem; | 124 String m_keySystem; |
125 RefPtr<MediaKeyError> m_error; | 125 RefPtr<MediaKeyError> m_error; |
126 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 126 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
127 OwnPtr<blink::WebContentDecryptionModuleSession> m_session; | 127 OwnPtr<blink::WebContentDecryptionModuleSession> m_session; |
128 | 128 |
129 // Used to determine if MediaKeys is still active. | 129 // Used to determine if MediaKeys is still active. |
130 WeakPtrWillBeWeakMember<MediaKeys> m_keys; | 130 WeakMember<MediaKeys> m_keys; |
131 | 131 |
132 // Is the CDM finished with this session? | 132 // Is the CDM finished with this session? |
133 bool m_isClosed; | 133 bool m_isClosed; |
134 | 134 |
135 Deque<OwnPtr<PendingAction> > m_pendingActions; | 135 Deque<OwnPtr<PendingAction> > m_pendingActions; |
136 Timer<MediaKeySession> m_actionTimer; | 136 Timer<MediaKeySession> m_actionTimer; |
137 }; | 137 }; |
138 | 138 |
139 } | 139 } |
140 | 140 |
141 #endif // MediaKeySession_h | 141 #endif // MediaKeySession_h |
OLD | NEW |