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 27 matching lines...) Expand all Loading... |
38 #include "modules/encryptedmedia/MediaKeys.h" | 38 #include "modules/encryptedmedia/MediaKeys.h" |
39 #include "modules/encryptedmedia/SimpleContentDecryptionModuleResult.h" | 39 #include "modules/encryptedmedia/SimpleContentDecryptionModuleResult.h" |
40 #include "platform/ContentDecryptionModuleResult.h" | 40 #include "platform/ContentDecryptionModuleResult.h" |
41 #include "platform/Logging.h" | 41 #include "platform/Logging.h" |
42 #include "platform/Timer.h" | 42 #include "platform/Timer.h" |
43 #include "public/platform/WebContentDecryptionModule.h" | 43 #include "public/platform/WebContentDecryptionModule.h" |
44 #include "public/platform/WebContentDecryptionModuleException.h" | 44 #include "public/platform/WebContentDecryptionModuleException.h" |
45 #include "public/platform/WebContentDecryptionModuleSession.h" | 45 #include "public/platform/WebContentDecryptionModuleSession.h" |
46 #include "public/platform/WebString.h" | 46 #include "public/platform/WebString.h" |
47 #include "public/platform/WebURL.h" | 47 #include "public/platform/WebURL.h" |
48 #include "wtf/Uint8Array.h" | 48 #include "wtf/ArrayBuffer.h" |
| 49 #include "wtf/ArrayBufferView.h" |
49 | 50 |
50 namespace blink { | 51 namespace blink { |
51 | 52 |
52 // A class holding a pending action. | 53 // A class holding a pending action. |
53 class MediaKeySession::PendingAction : public GarbageCollectedFinalized<MediaKey
Session::PendingAction> { | 54 class MediaKeySession::PendingAction : public GarbageCollectedFinalized<MediaKey
Session::PendingAction> { |
54 public: | 55 public: |
55 enum Type { | 56 enum Type { |
56 Update, | 57 Update, |
57 Release | 58 Release |
58 }; | 59 }; |
59 | 60 |
60 Type type() const { return m_type; } | 61 Type type() const { return m_type; } |
61 const Persistent<ContentDecryptionModuleResult> result() const { return m_re
sult; } | 62 const Persistent<ContentDecryptionModuleResult> result() const { return m_re
sult; } |
62 // |data| is only valid for Update types. | 63 // |data| is only valid for Update types. |
63 const RefPtr<Uint8Array> data() const { return m_data; } | 64 const RefPtr<ArrayBuffer> data() const { return m_data; } |
64 | 65 |
65 static PendingAction* CreatePendingUpdate(ContentDecryptionModuleResult* res
ult, PassRefPtr<Uint8Array> data) | 66 static PendingAction* CreatePendingUpdate(ContentDecryptionModuleResult* res
ult, PassRefPtr<ArrayBuffer> data) |
66 { | 67 { |
67 ASSERT(result); | 68 ASSERT(result); |
68 ASSERT(data); | 69 ASSERT(data); |
69 return new PendingAction(Update, result, data); | 70 return new PendingAction(Update, result, data); |
70 } | 71 } |
71 | 72 |
72 static PendingAction* CreatePendingRelease(ContentDecryptionModuleResult* re
sult) | 73 static PendingAction* CreatePendingRelease(ContentDecryptionModuleResult* re
sult) |
73 { | 74 { |
74 ASSERT(result); | 75 ASSERT(result); |
75 return new PendingAction(Release, result, PassRefPtr<Uint8Array>()); | 76 return new PendingAction(Release, result, PassRefPtr<ArrayBuffer>()); |
76 } | 77 } |
77 | 78 |
78 ~PendingAction() | 79 ~PendingAction() |
79 { | 80 { |
80 } | 81 } |
81 | 82 |
82 void trace(Visitor* visitor) | 83 void trace(Visitor* visitor) |
83 { | 84 { |
84 visitor->trace(m_result); | 85 visitor->trace(m_result); |
85 } | 86 } |
86 | 87 |
87 private: | 88 private: |
88 PendingAction(Type type, ContentDecryptionModuleResult* result, PassRefPtr<U
int8Array> data) | 89 PendingAction(Type type, ContentDecryptionModuleResult* result, PassRefPtr<A
rrayBuffer> data) |
89 : m_type(type) | 90 : m_type(type) |
90 , m_result(result) | 91 , m_result(result) |
91 , m_data(data) | 92 , m_data(data) |
92 { | 93 { |
93 } | 94 } |
94 | 95 |
95 const Type m_type; | 96 const Type m_type; |
96 const Member<ContentDecryptionModuleResult> m_result; | 97 const Member<ContentDecryptionModuleResult> m_result; |
97 const RefPtr<Uint8Array> m_data; | 98 const RefPtr<ArrayBuffer> m_data; |
98 }; | 99 }; |
99 | 100 |
100 // This class allows a MediaKeySession object to be created asynchronously. | 101 // This class allows a MediaKeySession object to be created asynchronously. |
101 class MediaKeySessionInitializer : public ScriptPromiseResolver { | 102 class MediaKeySessionInitializer : public ScriptPromiseResolver { |
102 WTF_MAKE_NONCOPYABLE(MediaKeySessionInitializer); | 103 WTF_MAKE_NONCOPYABLE(MediaKeySessionInitializer); |
103 | 104 |
104 public: | 105 public: |
105 static ScriptPromise create(ScriptState*, MediaKeys*, const String& initData
Type, PassRefPtr<Uint8Array> initData, const String& sessionType); | 106 static ScriptPromise create(ScriptState*, MediaKeys*, const String& initData
Type, PassRefPtr<ArrayBuffer> initData, const String& sessionType); |
106 virtual ~MediaKeySessionInitializer(); | 107 virtual ~MediaKeySessionInitializer(); |
107 | 108 |
108 void completeWithSession(blink::WebContentDecryptionModuleResult::SessionSta
tus); | 109 void completeWithSession(blink::WebContentDecryptionModuleResult::SessionSta
tus); |
109 void completeWithDOMException(ExceptionCode, const String& errorMessage); | 110 void completeWithDOMException(ExceptionCode, const String& errorMessage); |
110 | 111 |
111 private: | 112 private: |
112 MediaKeySessionInitializer(ScriptState*, MediaKeys*, const String& initDataT
ype, PassRefPtr<Uint8Array> initData, const String& sessionType); | 113 MediaKeySessionInitializer(ScriptState*, MediaKeys*, const String& initDataT
ype, PassRefPtr<ArrayBuffer> initData, const String& sessionType); |
113 void timerFired(Timer<MediaKeySessionInitializer>*); | 114 void timerFired(Timer<MediaKeySessionInitializer>*); |
114 | 115 |
115 Persistent<MediaKeys> m_mediaKeys; | 116 Persistent<MediaKeys> m_mediaKeys; |
116 OwnPtr<blink::WebContentDecryptionModuleSession> m_cdmSession; | 117 OwnPtr<blink::WebContentDecryptionModuleSession> m_cdmSession; |
117 | 118 |
118 // The next 3 values are simply the initialization data saved so that the | 119 // The next 3 values are simply the initialization data saved so that the |
119 // asynchronous creation has the data needed. | 120 // asynchronous creation has the data needed. |
120 String m_initDataType; | 121 String m_initDataType; |
121 RefPtr<Uint8Array> m_initData; | 122 RefPtr<ArrayBuffer> m_initData; |
122 String m_sessionType; | 123 String m_sessionType; |
123 | 124 |
124 Timer<MediaKeySessionInitializer> m_timer; | 125 Timer<MediaKeySessionInitializer> m_timer; |
125 }; | 126 }; |
126 | 127 |
127 // Represents the result used when a new WebContentDecryptionModuleSession | 128 // Represents the result used when a new WebContentDecryptionModuleSession |
128 // object has been created. Needed as MediaKeySessionInitializer can't be both | 129 // object has been created. Needed as MediaKeySessionInitializer can't be both |
129 // a ScriptPromiseResolver and ContentDecryptionModuleResult at the same time. | 130 // a ScriptPromiseResolver and ContentDecryptionModuleResult at the same time. |
130 class NewMediaKeySessionResult FINAL : public ContentDecryptionModuleResult { | 131 class NewMediaKeySessionResult FINAL : public ContentDecryptionModuleResult { |
131 public: | 132 public: |
(...skipping 16 matching lines...) Expand all Loading... |
148 | 149 |
149 virtual void completeWithError(blink::WebContentDecryptionModuleException co
de, unsigned long systemCode, const blink::WebString& message) OVERRIDE | 150 virtual void completeWithError(blink::WebContentDecryptionModuleException co
de, unsigned long systemCode, const blink::WebString& message) OVERRIDE |
150 { | 151 { |
151 m_initializer->completeWithDOMException(WebCdmExceptionToExceptionCode(c
ode), message); | 152 m_initializer->completeWithDOMException(WebCdmExceptionToExceptionCode(c
ode), message); |
152 } | 153 } |
153 | 154 |
154 private: | 155 private: |
155 MediaKeySessionInitializer* m_initializer; | 156 MediaKeySessionInitializer* m_initializer; |
156 }; | 157 }; |
157 | 158 |
158 ScriptPromise MediaKeySessionInitializer::create(ScriptState* scriptState, Media
Keys* mediaKeys, const String& initDataType, PassRefPtr<Uint8Array> initData, co
nst String& sessionType) | 159 ScriptPromise MediaKeySessionInitializer::create(ScriptState* scriptState, Media
Keys* mediaKeys, const String& initDataType, PassRefPtr<ArrayBuffer> initData, c
onst String& sessionType) |
159 { | 160 { |
160 RefPtr<MediaKeySessionInitializer> initializer = adoptRef(new MediaKeySessio
nInitializer(scriptState, mediaKeys, initDataType, initData, sessionType)); | 161 RefPtr<MediaKeySessionInitializer> initializer = adoptRef(new MediaKeySessio
nInitializer(scriptState, mediaKeys, initDataType, initData, sessionType)); |
161 initializer->suspendIfNeeded(); | 162 initializer->suspendIfNeeded(); |
162 initializer->keepAliveWhilePending(); | 163 initializer->keepAliveWhilePending(); |
163 return initializer->promise(); | 164 return initializer->promise(); |
164 } | 165 } |
165 | 166 |
166 MediaKeySessionInitializer::MediaKeySessionInitializer(ScriptState* scriptState,
MediaKeys* mediaKeys, const String& initDataType, PassRefPtr<Uint8Array> initDa
ta, const String& sessionType) | 167 MediaKeySessionInitializer::MediaKeySessionInitializer(ScriptState* scriptState,
MediaKeys* mediaKeys, const String& initDataType, PassRefPtr<ArrayBuffer> initD
ata, const String& sessionType) |
167 : ScriptPromiseResolver(scriptState) | 168 : ScriptPromiseResolver(scriptState) |
168 , m_mediaKeys(mediaKeys) | 169 , m_mediaKeys(mediaKeys) |
169 , m_initDataType(initDataType) | 170 , m_initDataType(initDataType) |
170 , m_initData(initData) | 171 , m_initData(initData) |
171 , m_sessionType(sessionType) | 172 , m_sessionType(sessionType) |
172 , m_timer(this, &MediaKeySessionInitializer::timerFired) | 173 , m_timer(this, &MediaKeySessionInitializer::timerFired) |
173 { | 174 { |
174 WTF_LOG(Media, "MediaKeySessionInitializer::MediaKeySessionInitializer"); | 175 WTF_LOG(Media, "MediaKeySessionInitializer::MediaKeySessionInitializer"); |
175 | 176 |
176 // Start the timer so that MediaKeySession can be created asynchronously. | 177 // Start the timer so that MediaKeySession can be created asynchronously. |
(...skipping 23 matching lines...) Expand all Loading... |
200 // a new DOMException whose name is "NotSupportedError". | 201 // a new DOMException whose name is "NotSupportedError". |
201 // 7.4.3 Let request be a request (e.g. a license request) generated based | 202 // 7.4.3 Let request be a request (e.g. a license request) generated based |
202 // on the init data, which is interpreteted per initDataType, and | 203 // on the init data, which is interpreteted per initDataType, and |
203 // sessionType. If sessionType is "temporary", the request is for a | 204 // sessionType. If sessionType is "temporary", the request is for a |
204 // temporary non-persisted license. If sessionType is "persistent", | 205 // temporary non-persisted license. If sessionType is "persistent", |
205 // the request is for a persistable license. | 206 // the request is for a persistable license. |
206 // 7.4.4 If the init data indicates a default URL, let default URL be | 207 // 7.4.4 If the init data indicates a default URL, let default URL be |
207 // that URL. The URL may be validated and/or normalized. | 208 // that URL. The URL may be validated and/or normalized. |
208 m_cdmSession = adoptPtr(cdm->createSession()); | 209 m_cdmSession = adoptPtr(cdm->createSession()); |
209 NewMediaKeySessionResult* result = new NewMediaKeySessionResult(this); | 210 NewMediaKeySessionResult* result = new NewMediaKeySessionResult(this); |
210 m_cdmSession->initializeNewSession(m_initDataType, m_initData->data(), m_ini
tData->length(), m_sessionType, result->result()); | 211 m_cdmSession->initializeNewSession(m_initDataType, static_cast<unsigned char
*>(m_initData->data()), m_initData->byteLength(), m_sessionType, result->result(
)); |
211 | 212 |
212 WTF_LOG(Media, "MediaKeySessionInitializer::timerFired done"); | 213 WTF_LOG(Media, "MediaKeySessionInitializer::timerFired done"); |
213 // Note: As soon as the promise is resolved (or rejected), the | 214 // Note: As soon as the promise is resolved (or rejected), the |
214 // ScriptPromiseResolver object (|this|) is freed. So if | 215 // ScriptPromiseResolver object (|this|) is freed. So if |
215 // initializeNewSession() is synchronous, access to any members will crash. | 216 // initializeNewSession() is synchronous, access to any members will crash. |
216 } | 217 } |
217 | 218 |
218 void MediaKeySessionInitializer::completeWithSession(blink::WebContentDecryption
ModuleResult::SessionStatus status) | 219 void MediaKeySessionInitializer::completeWithSession(blink::WebContentDecryption
ModuleResult::SessionStatus status) |
219 { | 220 { |
220 WTF_LOG(Media, "MediaKeySessionInitializer::completeWithSession"); | 221 WTF_LOG(Media, "MediaKeySessionInitializer::completeWithSession"); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 265 } |
265 ASSERT_NOT_REACHED(); | 266 ASSERT_NOT_REACHED(); |
266 } | 267 } |
267 | 268 |
268 void MediaKeySessionInitializer::completeWithDOMException(ExceptionCode code, co
nst String& errorMessage) | 269 void MediaKeySessionInitializer::completeWithDOMException(ExceptionCode code, co
nst String& errorMessage) |
269 { | 270 { |
270 WTF_LOG(Media, "MediaKeySessionInitializer::completeWithDOMException"); | 271 WTF_LOG(Media, "MediaKeySessionInitializer::completeWithDOMException"); |
271 reject(DOMException::create(code, errorMessage)); | 272 reject(DOMException::create(code, errorMessage)); |
272 } | 273 } |
273 | 274 |
274 ScriptPromise MediaKeySession::create(ScriptState* scriptState, MediaKeys* media
Keys, const String& initDataType, PassRefPtr<Uint8Array> initData, const String&
sessionType) | 275 ScriptPromise MediaKeySession::create(ScriptState* scriptState, MediaKeys* media
Keys, const String& initDataType, PassRefPtr<ArrayBuffer> initData, const String
& sessionType) |
275 { | 276 { |
276 // Since creation is done asynchronously, use MediaKeySessionInitializer | 277 // Since creation is done asynchronously, use MediaKeySessionInitializer |
277 // to do it. | 278 // to do it. |
278 return MediaKeySessionInitializer::create(scriptState, mediaKeys, initDataTy
pe, initData, sessionType); | 279 return MediaKeySessionInitializer::create(scriptState, mediaKeys, initDataTy
pe, initData, sessionType); |
279 } | 280 } |
280 | 281 |
281 MediaKeySession::MediaKeySession(ExecutionContext* context, MediaKeys* keys, Pas
sOwnPtr<blink::WebContentDecryptionModuleSession> cdmSession) | 282 MediaKeySession::MediaKeySession(ExecutionContext* context, MediaKeys* keys, Pas
sOwnPtr<blink::WebContentDecryptionModuleSession> cdmSession) |
282 : ActiveDOMObject(context) | 283 : ActiveDOMObject(context) |
283 , m_keySystem(keys->keySystem()) | 284 , m_keySystem(keys->keySystem()) |
284 , m_asyncEventQueue(GenericEventQueue::create(this)) | 285 , m_asyncEventQueue(GenericEventQueue::create(this)) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 void MediaKeySession::setError(MediaKeyError* error) | 320 void MediaKeySession::setError(MediaKeyError* error) |
320 { | 321 { |
321 m_error = error; | 322 m_error = error; |
322 } | 323 } |
323 | 324 |
324 String MediaKeySession::sessionId() const | 325 String MediaKeySession::sessionId() const |
325 { | 326 { |
326 return m_session->sessionId(); | 327 return m_session->sessionId(); |
327 } | 328 } |
328 | 329 |
329 ScriptPromise MediaKeySession::update(ScriptState* scriptState, Uint8Array* resp
onse) | 330 ScriptPromise MediaKeySession::update(ScriptState* scriptState, ArrayBuffer* res
ponse) |
| 331 { |
| 332 RefPtr<ArrayBuffer> responseCopy = ArrayBuffer::create(response->data(), res
ponse->byteLength()); |
| 333 return updateInternal(scriptState, responseCopy.release()); |
| 334 } |
| 335 |
| 336 ScriptPromise MediaKeySession::update(ScriptState* scriptState, ArrayBufferView*
response) |
| 337 { |
| 338 RefPtr<ArrayBuffer> responseCopy = ArrayBuffer::create(response->baseAddress
(), response->byteLength()); |
| 339 return updateInternal(scriptState, responseCopy.release()); |
| 340 } |
| 341 |
| 342 ScriptPromise MediaKeySession::updateInternal(ScriptState* scriptState, PassRefP
tr<ArrayBuffer> response) |
330 { | 343 { |
331 WTF_LOG(Media, "MediaKeySession(%p)::update", this); | 344 WTF_LOG(Media, "MediaKeySession(%p)::update", this); |
332 ASSERT(!m_isClosed); | 345 ASSERT(!m_isClosed); |
333 | 346 |
334 // From <https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/
encrypted-media.html#dom-update>: | 347 // From <https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/
encrypted-media.html#dom-update>: |
335 // The update(response) method provides messages, including licenses, to the | 348 // The update(response) method provides messages, including licenses, to the |
336 // CDM. It must run the following steps: | 349 // CDM. It must run the following steps: |
337 // | 350 // |
338 // 1. If response is an empty array, return a promise rejected with a new | 351 // 1. If response is an empty array, return a promise rejected with a new |
339 // DOMException whose name is "InvalidAccessError" and that has the | 352 // DOMException whose name is "InvalidAccessError" and that has the |
340 // message "The response parameter is empty." | 353 // message "The response parameter is empty." |
341 if (!response->length()) { | 354 if (!response->byteLength()) { |
342 return ScriptPromise::rejectWithDOMException( | 355 return ScriptPromise::rejectWithDOMException( |
343 scriptState, DOMException::create(InvalidAccessError, "The response
parameter is empty.")); | 356 scriptState, DOMException::create(InvalidAccessError, "The response
parameter is empty.")); |
344 } | 357 } |
345 | 358 |
346 // 2. Let message be a copy of the contents of the response parameter. | 359 // 2. Let message be a copy of the contents of the response parameter. |
347 RefPtr<Uint8Array> responseCopy = Uint8Array::create(response->data(), respo
nse->length()); | 360 // (Copied in the caller.) |
348 | 361 |
349 // 3. Let promise be a new promise. | 362 // 3. Let promise be a new promise. |
350 SimpleContentDecryptionModuleResult* result = new SimpleContentDecryptionMod
uleResult(scriptState); | 363 SimpleContentDecryptionModuleResult* result = new SimpleContentDecryptionMod
uleResult(scriptState); |
351 ScriptPromise promise = result->promise(); | 364 ScriptPromise promise = result->promise(); |
352 | 365 |
353 // 4. Run the following steps asynchronously (documented in | 366 // 4. Run the following steps asynchronously (documented in |
354 // actionTimerFired()) | 367 // actionTimerFired()) |
355 m_pendingActions.append(PendingAction::CreatePendingUpdate(result, responseC
opy.release())); | 368 m_pendingActions.append(PendingAction::CreatePendingUpdate(result, response)
); |
356 if (!m_actionTimer.isActive()) | 369 if (!m_actionTimer.isActive()) |
357 m_actionTimer.startOneShot(0, FROM_HERE); | 370 m_actionTimer.startOneShot(0, FROM_HERE); |
358 | 371 |
359 // 5. Return promise. | 372 // 5. Return promise. |
360 return promise; | 373 return promise; |
361 } | 374 } |
362 | 375 |
363 ScriptPromise MediaKeySession::release(ScriptState* scriptState) | 376 ScriptPromise MediaKeySession::release(ScriptState* scriptState) |
364 { | 377 { |
365 WTF_LOG(Media, "MediaKeySession(%p)::release", this); | 378 WTF_LOG(Media, "MediaKeySession(%p)::release", this); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 | 418 |
406 while (!pendingActions.isEmpty()) { | 419 while (!pendingActions.isEmpty()) { |
407 PendingAction* action = pendingActions.takeFirst(); | 420 PendingAction* action = pendingActions.takeFirst(); |
408 | 421 |
409 switch (action->type()) { | 422 switch (action->type()) { |
410 case PendingAction::Update: | 423 case PendingAction::Update: |
411 WTF_LOG(Media, "MediaKeySession(%p)::actionTimerFired: Update", this
); | 424 WTF_LOG(Media, "MediaKeySession(%p)::actionTimerFired: Update", this
); |
412 // NOTE: Continued from step 4 of MediaKeySession::update(). | 425 // NOTE: Continued from step 4 of MediaKeySession::update(). |
413 // Continue the update call by passing message to the cdm. Once | 426 // Continue the update call by passing message to the cdm. Once |
414 // completed, it will resolve/reject the promise. | 427 // completed, it will resolve/reject the promise. |
415 m_session->update(action->data()->data(), action->data()->length(),
action->result()->result()); | 428 m_session->update(static_cast<unsigned char*>(action->data()->data()
), action->data()->byteLength(), action->result()->result()); |
416 break; | 429 break; |
417 case PendingAction::Release: | 430 case PendingAction::Release: |
418 WTF_LOG(Media, "MediaKeySession(%p)::actionTimerFired: Release", thi
s); | 431 WTF_LOG(Media, "MediaKeySession(%p)::actionTimerFired: Release", thi
s); |
419 // NOTE: Continued from step 3 of MediaKeySession::release(). | 432 // NOTE: Continued from step 3 of MediaKeySession::release(). |
420 // 3.1 Let cdm be the cdm loaded in create(). | 433 // 3.1 Let cdm be the cdm loaded in create(). |
421 // 3.2 Use the cdm to execute the following steps: | 434 // 3.2 Use the cdm to execute the following steps: |
422 // 3.2.1 Process the close request. Do not remove stored session dat
a. | 435 // 3.2.1 Process the close request. Do not remove stored session dat
a. |
423 // 3.2.2 If the previous step caused the session to be closed, run t
he | 436 // 3.2.2 If the previous step caused the session to be closed, run t
he |
424 // Session Close algorithm on this object. | 437 // Session Close algorithm on this object. |
425 // 3.3 Resolve promise with undefined. | 438 // 3.3 Resolve promise with undefined. |
426 m_session->release(action->result()->result()); | 439 m_session->release(action->result()->result()); |
427 break; | 440 break; |
428 } | 441 } |
429 } | 442 } |
430 } | 443 } |
431 | 444 |
432 // Queue a task to fire a simple event named keymessage at the new object | 445 // Queue a task to fire a simple event named keymessage at the new object |
433 void MediaKeySession::message(const unsigned char* message, size_t messageLength
, const blink::WebURL& destinationURL) | 446 void MediaKeySession::message(const unsigned char* message, size_t messageLength
, const blink::WebURL& destinationURL) |
434 { | 447 { |
435 WTF_LOG(Media, "MediaKeySession(%p)::message", this); | 448 WTF_LOG(Media, "MediaKeySession(%p)::message", this); |
436 | 449 |
437 MediaKeyMessageEventInit init; | 450 MediaKeyMessageEventInit init; |
438 init.bubbles = false; | 451 init.bubbles = false; |
439 init.cancelable = false; | 452 init.cancelable = false; |
440 init.message = Uint8Array::create(message, messageLength); | 453 init.message = ArrayBuffer::create(static_cast<const void*>(message), messag
eLength); |
441 init.destinationURL = destinationURL.string(); | 454 init.destinationURL = destinationURL.string(); |
442 | 455 |
443 RefPtrWillBeRawPtr<MediaKeyMessageEvent> event = MediaKeyMessageEvent::creat
e(EventTypeNames::message, init); | 456 RefPtrWillBeRawPtr<MediaKeyMessageEvent> event = MediaKeyMessageEvent::creat
e(EventTypeNames::message, init); |
444 event->setTarget(this); | 457 event->setTarget(this); |
445 m_asyncEventQueue->enqueueEvent(event.release()); | 458 m_asyncEventQueue->enqueueEvent(event.release()); |
446 } | 459 } |
447 | 460 |
448 void MediaKeySession::ready() | 461 void MediaKeySession::ready() |
449 { | 462 { |
450 WTF_LOG(Media, "MediaKeySession(%p)::ready", this); | 463 WTF_LOG(Media, "MediaKeySession(%p)::ready", this); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 void MediaKeySession::trace(Visitor* visitor) | 567 void MediaKeySession::trace(Visitor* visitor) |
555 { | 568 { |
556 visitor->trace(m_error); | 569 visitor->trace(m_error); |
557 visitor->trace(m_asyncEventQueue); | 570 visitor->trace(m_asyncEventQueue); |
558 visitor->trace(m_pendingActions); | 571 visitor->trace(m_pendingActions); |
559 visitor->trace(m_keys); | 572 visitor->trace(m_keys); |
560 EventTargetWithInlineData::trace(visitor); | 573 EventTargetWithInlineData::trace(visitor); |
561 } | 574 } |
562 | 575 |
563 } | 576 } |
OLD | NEW |