Chromium Code Reviews| 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 WebCore { | 51 namespace WebCore { |
| 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 Persistent<MediaKeySession> m_session; | 117 Persistent<MediaKeySession> m_session; |
| 117 OwnPtr<blink::WebContentDecryptionModuleSession> m_cdmSession; | 118 OwnPtr<blink::WebContentDecryptionModuleSession> m_cdmSession; |
| 118 | 119 |
| 119 // The next 3 values are simply the initialization data saved so that the | 120 // The next 3 values are simply the initialization data saved so that the |
| 120 // asynchronous creation has the data needed. | 121 // asynchronous creation has the data needed. |
| 121 String m_initDataType; | 122 String m_initDataType; |
| 122 RefPtr<Uint8Array> m_initData; | 123 RefPtr<ArrayBuffer> m_initData; |
| 123 String m_sessionType; | 124 String m_sessionType; |
| 124 | 125 |
| 125 Timer<MediaKeySessionInitializer> m_timer; | 126 Timer<MediaKeySessionInitializer> m_timer; |
| 126 }; | 127 }; |
| 127 | 128 |
| 128 // Represents the result used when a new WebContentDecryptionModuleSession | 129 // Represents the result used when a new WebContentDecryptionModuleSession |
| 129 // object has been created. Needed as MediaKeySessionInitializer can't be both | 130 // object has been created. Needed as MediaKeySessionInitializer can't be both |
| 130 // a ScriptPromiseResolver and ContentDecryptionModuleResult at the same time. | 131 // a ScriptPromiseResolver and ContentDecryptionModuleResult at the same time. |
| 131 class NewMediaKeySessionResult FINAL : public ContentDecryptionModuleResult { | 132 class NewMediaKeySessionResult FINAL : public ContentDecryptionModuleResult { |
| 132 public: | 133 public: |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 149 | 150 |
| 150 virtual void completeWithError(blink::WebContentDecryptionModuleException co de, unsigned long systemCode, const blink::WebString& message) OVERRIDE | 151 virtual void completeWithError(blink::WebContentDecryptionModuleException co de, unsigned long systemCode, const blink::WebString& message) OVERRIDE |
| 151 { | 152 { |
| 152 m_initializer->completeWithDOMException(WebCdmExceptionToExceptionCode(c ode), message); | 153 m_initializer->completeWithDOMException(WebCdmExceptionToExceptionCode(c ode), message); |
| 153 } | 154 } |
| 154 | 155 |
| 155 private: | 156 private: |
| 156 MediaKeySessionInitializer* m_initializer; | 157 MediaKeySessionInitializer* m_initializer; |
| 157 }; | 158 }; |
| 158 | 159 |
| 159 ScriptPromise MediaKeySessionInitializer::create(ScriptState* scriptState, Media Keys* mediaKeys, const String& initDataType, PassRefPtr<Uint8Array> initData, co nst String& sessionType) | 160 ScriptPromise MediaKeySessionInitializer::create(ScriptState* scriptState, Media Keys* mediaKeys, const String& initDataType, PassRefPtr<ArrayBuffer> initData, c onst String& sessionType) |
| 160 { | 161 { |
| 161 RefPtr<MediaKeySessionInitializer> initializer = adoptRef(new MediaKeySessio nInitializer(scriptState, mediaKeys, initDataType, initData, sessionType)); | 162 RefPtr<MediaKeySessionInitializer> initializer = adoptRef(new MediaKeySessio nInitializer(scriptState, mediaKeys, initDataType, initData, sessionType)); |
| 162 initializer->suspendIfNeeded(); | 163 initializer->suspendIfNeeded(); |
| 163 initializer->keepAliveWhilePending(); | 164 initializer->keepAliveWhilePending(); |
| 164 return initializer->promise(); | 165 return initializer->promise(); |
| 165 } | 166 } |
| 166 | 167 |
| 167 MediaKeySessionInitializer::MediaKeySessionInitializer(ScriptState* scriptState, MediaKeys* mediaKeys, const String& initDataType, PassRefPtr<Uint8Array> initDa ta, const String& sessionType) | 168 MediaKeySessionInitializer::MediaKeySessionInitializer(ScriptState* scriptState, MediaKeys* mediaKeys, const String& initDataType, PassRefPtr<ArrayBuffer> initD ata, const String& sessionType) |
| 168 : ScriptPromiseResolver(scriptState) | 169 : ScriptPromiseResolver(scriptState) |
| 169 , m_mediaKeys(mediaKeys) | 170 , m_mediaKeys(mediaKeys) |
| 170 , m_initDataType(initDataType) | 171 , m_initDataType(initDataType) |
| 171 , m_initData(initData) | 172 , m_initData(initData) |
| 172 , m_sessionType(sessionType) | 173 , m_sessionType(sessionType) |
| 173 , m_timer(this, &MediaKeySessionInitializer::timerFired) | 174 , m_timer(this, &MediaKeySessionInitializer::timerFired) |
| 174 { | 175 { |
| 175 WTF_LOG(Media, "MediaKeySessionInitializer::MediaKeySessionInitializer"); | 176 WTF_LOG(Media, "MediaKeySessionInitializer::MediaKeySessionInitializer"); |
| 176 | 177 |
| 177 // Start the timer so that MediaKeySession can be created asynchronously. | 178 // Start the timer so that MediaKeySession can be created asynchronously. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 211 // creating the session on the Chromium side. As a result, we need to | 212 // creating the session on the Chromium side. As a result, we need to |
| 212 // create the session now. | 213 // create the session now. |
| 213 // FIXME: Add an API to allow the client interface to be specified later | 214 // FIXME: Add an API to allow the client interface to be specified later |
| 214 // to WebContentDecryptionModuleSession, and then creating the | 215 // to WebContentDecryptionModuleSession, and then creating the |
| 215 // MediaKeySession object can be done in completeWithSession(). | 216 // MediaKeySession object can be done in completeWithSession(). |
| 216 m_session = adoptRefCountedGarbageCollectedWillBeNoop(new MediaKeySession(ex ecutionContext(), m_mediaKeys)); | 217 m_session = adoptRefCountedGarbageCollectedWillBeNoop(new MediaKeySession(ex ecutionContext(), m_mediaKeys)); |
| 217 m_session->suspendIfNeeded(); | 218 m_session->suspendIfNeeded(); |
| 218 | 219 |
| 219 m_cdmSession = adoptPtr(cdm->createSession(m_session)); | 220 m_cdmSession = adoptPtr(cdm->createSession(m_session)); |
| 220 NewMediaKeySessionResult* result = new NewMediaKeySessionResult(this); | 221 NewMediaKeySessionResult* result = new NewMediaKeySessionResult(this); |
| 221 m_cdmSession->initializeNewSession(m_initDataType, m_initData->data(), m_ini tData->length(), m_sessionType, result->result()); | 222 m_cdmSession->initializeNewSession(m_initDataType, static_cast<unsigned char *>(m_initData->data()), m_initData->byteLength(), m_sessionType, result->result( )); |
| 222 | 223 |
| 223 WTF_LOG(Media, "MediaKeySessionInitializer::timerFired done"); | 224 WTF_LOG(Media, "MediaKeySessionInitializer::timerFired done"); |
| 224 // Note: As soon as the promise is resolved (or rejected), the | 225 // Note: As soon as the promise is resolved (or rejected), the |
| 225 // ScriptPromiseResolver object (|this|) is freed. So if | 226 // ScriptPromiseResolver object (|this|) is freed. So if |
| 226 // initializeNewSession() is synchronous, access to any members will crash. | 227 // initializeNewSession() is synchronous, access to any members will crash. |
| 227 } | 228 } |
| 228 | 229 |
| 229 void MediaKeySessionInitializer::completeWithSession(blink::WebContentDecryption ModuleResult::SessionStatus status) | 230 void MediaKeySessionInitializer::completeWithSession(blink::WebContentDecryption ModuleResult::SessionStatus status) |
| 230 { | 231 { |
| 231 WTF_LOG(Media, "MediaKeySessionInitializer::completeWithSession"); | 232 WTF_LOG(Media, "MediaKeySessionInitializer::completeWithSession"); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 } | 274 } |
| 274 ASSERT_NOT_REACHED(); | 275 ASSERT_NOT_REACHED(); |
| 275 } | 276 } |
| 276 | 277 |
| 277 void MediaKeySessionInitializer::completeWithDOMException(ExceptionCode code, co nst String& errorMessage) | 278 void MediaKeySessionInitializer::completeWithDOMException(ExceptionCode code, co nst String& errorMessage) |
| 278 { | 279 { |
| 279 WTF_LOG(Media, "MediaKeySessionInitializer::completeWithDOMException"); | 280 WTF_LOG(Media, "MediaKeySessionInitializer::completeWithDOMException"); |
| 280 reject(DOMException::create(code, errorMessage)); | 281 reject(DOMException::create(code, errorMessage)); |
| 281 } | 282 } |
| 282 | 283 |
| 283 ScriptPromise MediaKeySession::create(ScriptState* scriptState, MediaKeys* media Keys, const String& initDataType, PassRefPtr<Uint8Array> initData, const String& sessionType) | 284 ScriptPromise MediaKeySession::create(ScriptState* scriptState, MediaKeys* media Keys, const String& initDataType, PassRefPtr<ArrayBuffer> initData, const String & sessionType) |
| 284 { | 285 { |
| 285 // Since creation is done asynchronously, use MediaKeySessionInitializer | 286 // Since creation is done asynchronously, use MediaKeySessionInitializer |
| 286 // to do it. | 287 // to do it. |
| 287 return MediaKeySessionInitializer::create(scriptState, mediaKeys, initDataTy pe, initData, sessionType); | 288 return MediaKeySessionInitializer::create(scriptState, mediaKeys, initDataTy pe, initData, sessionType); |
| 288 } | 289 } |
| 289 | 290 |
| 290 MediaKeySession::MediaKeySession(ExecutionContext* context, MediaKeys* keys) | 291 MediaKeySession::MediaKeySession(ExecutionContext* context, MediaKeys* keys) |
| 291 : ActiveDOMObject(context) | 292 : ActiveDOMObject(context) |
| 292 , m_keySystem(keys->keySystem()) | 293 , m_keySystem(keys->keySystem()) |
| 293 , m_asyncEventQueue(GenericEventQueue::create(this)) | 294 , m_asyncEventQueue(GenericEventQueue::create(this)) |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 314 void MediaKeySession::setError(MediaKeyError* error) | 315 void MediaKeySession::setError(MediaKeyError* error) |
| 315 { | 316 { |
| 316 m_error = error; | 317 m_error = error; |
| 317 } | 318 } |
| 318 | 319 |
| 319 String MediaKeySession::sessionId() const | 320 String MediaKeySession::sessionId() const |
| 320 { | 321 { |
| 321 return m_session->sessionId(); | 322 return m_session->sessionId(); |
| 322 } | 323 } |
| 323 | 324 |
| 324 ScriptPromise MediaKeySession::update(ScriptState* scriptState, Uint8Array* resp onse) | 325 ScriptPromise MediaKeySession::update(ScriptState* scriptState, ArrayBuffer* res ponse) |
| 326 { | |
| 327 RefPtr<ArrayBuffer> responseCopy = ArrayBuffer::create(response->data(), res ponse->byteLength()); | |
| 328 return updateInternal(scriptState, responseCopy.release()); | |
| 329 } | |
| 330 | |
| 331 ScriptPromise MediaKeySession::update(ScriptState* scriptState, ArrayBufferView* response) | |
| 332 { | |
| 333 RefPtr<ArrayBuffer> responseCopy = ArrayBuffer::create(response->baseAddress (), response->byteLength()); | |
| 334 return updateInternal(scriptState, responseCopy.release()); | |
| 335 } | |
| 336 | |
| 337 ScriptPromise MediaKeySession::updateInternal(ScriptState* scriptState, PassRefP tr<ArrayBuffer> response) | |
| 325 { | 338 { |
| 326 WTF_LOG(Media, "MediaKeySession(%p)::update", this); | 339 WTF_LOG(Media, "MediaKeySession(%p)::update", this); |
| 327 ASSERT(!m_isClosed); | 340 ASSERT(!m_isClosed); |
| 328 | 341 |
| 329 // From <https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/ encrypted-media.html#dom-update>: | 342 // From <https://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/ encrypted-media.html#dom-update>: |
| 330 // The update(response) method provides messages, including licenses, to the | 343 // The update(response) method provides messages, including licenses, to the |
| 331 // CDM. It must run the following steps: | 344 // CDM. It must run the following steps: |
| 332 // | 345 // |
| 333 // 1. If response is an empty array, return a promise rejected with a new | 346 // 1. If response is an empty array, return a promise rejected with a new |
| 334 // DOMException whose name is "InvalidAccessError" and that has the | 347 // DOMException whose name is "InvalidAccessError" and that has the |
| 335 // message "The response parameter is empty." | 348 // message "The response parameter is empty." |
| 336 if (!response->length()) { | 349 if (!response->byteLength()) { |
| 337 return ScriptPromise::rejectWithDOMException( | 350 return ScriptPromise::rejectWithDOMException( |
| 338 scriptState, DOMException::create(InvalidAccessError, "The response parameter is empty.")); | 351 scriptState, DOMException::create(InvalidAccessError, "The response parameter is empty.")); |
| 339 } | 352 } |
| 340 | 353 |
| 341 // 2. Let message be a copy of the contents of the response parameter. | 354 // 2. Let message be a copy of the contents of the response parameter. |
| 342 RefPtr<Uint8Array> responseCopy = Uint8Array::create(response->data(), respo nse->length()); | 355 // (Copied in the caller.) |
| 343 | 356 |
| 344 // 3. Let promise be a new promise. | 357 // 3. Let promise be a new promise. |
| 345 SimpleContentDecryptionModuleResult* result = new SimpleContentDecryptionMod uleResult(scriptState); | 358 SimpleContentDecryptionModuleResult* result = new SimpleContentDecryptionMod uleResult(scriptState); |
| 346 ScriptPromise promise = result->promise(); | 359 ScriptPromise promise = result->promise(); |
| 347 | 360 |
| 348 // 4. Run the following steps asynchronously (documented in | 361 // 4. Run the following steps asynchronously (documented in |
| 349 // actionTimerFired()) | 362 // actionTimerFired()) |
| 350 m_pendingActions.append(PendingAction::CreatePendingUpdate(result, responseC opy.release())); | 363 m_pendingActions.append(PendingAction::CreatePendingUpdate(result, response) ); |
|
ddorwin
2014/07/16 22:34:57
Does PassRefPtr make the release implicit or are y
jrummell
2014/07/18 21:56:00
ArrayBuffer::create() returns a RefPtr, so I don't
| |
| 351 if (!m_actionTimer.isActive()) | 364 if (!m_actionTimer.isActive()) |
| 352 m_actionTimer.startOneShot(0, FROM_HERE); | 365 m_actionTimer.startOneShot(0, FROM_HERE); |
| 353 | 366 |
| 354 // 5. Return promise. | 367 // 5. Return promise. |
| 355 return promise; | 368 return promise; |
| 356 } | 369 } |
| 357 | 370 |
| 358 ScriptPromise MediaKeySession::release(ScriptState* scriptState) | 371 ScriptPromise MediaKeySession::release(ScriptState* scriptState) |
| 359 { | 372 { |
| 360 WTF_LOG(Media, "MediaKeySession(%p)::release", this); | 373 WTF_LOG(Media, "MediaKeySession(%p)::release", this); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 | 413 |
| 401 while (!pendingActions.isEmpty()) { | 414 while (!pendingActions.isEmpty()) { |
| 402 PendingAction* action = pendingActions.takeFirst(); | 415 PendingAction* action = pendingActions.takeFirst(); |
| 403 | 416 |
| 404 switch (action->type()) { | 417 switch (action->type()) { |
| 405 case PendingAction::Update: | 418 case PendingAction::Update: |
| 406 WTF_LOG(Media, "MediaKeySession(%p)::actionTimerFired: Update", this ); | 419 WTF_LOG(Media, "MediaKeySession(%p)::actionTimerFired: Update", this ); |
| 407 // NOTE: Continued from step 4 of MediaKeySession::update(). | 420 // NOTE: Continued from step 4 of MediaKeySession::update(). |
| 408 // Continue the update call by passing message to the cdm. Once | 421 // Continue the update call by passing message to the cdm. Once |
| 409 // completed, it will resolve/reject the promise. | 422 // completed, it will resolve/reject the promise. |
| 410 m_session->update(action->data()->data(), action->data()->length(), action->result()->result()); | 423 m_session->update(static_cast<unsigned char*>(action->data()->data() ), action->data()->byteLength(), action->result()->result()); |
| 411 break; | 424 break; |
| 412 case PendingAction::Release: | 425 case PendingAction::Release: |
| 413 WTF_LOG(Media, "MediaKeySession(%p)::actionTimerFired: Release", thi s); | 426 WTF_LOG(Media, "MediaKeySession(%p)::actionTimerFired: Release", thi s); |
| 414 // NOTE: Continued from step 3 of MediaKeySession::release(). | 427 // NOTE: Continued from step 3 of MediaKeySession::release(). |
| 415 // 3.1 Let cdm be the cdm loaded in create(). | 428 // 3.1 Let cdm be the cdm loaded in create(). |
| 416 // 3.2 Use the cdm to execute the following steps: | 429 // 3.2 Use the cdm to execute the following steps: |
| 417 // 3.2.1 Process the close request. Do not remove stored session dat a. | 430 // 3.2.1 Process the close request. Do not remove stored session dat a. |
| 418 // 3.2.2 If the previous step caused the session to be closed, run t he | 431 // 3.2.2 If the previous step caused the session to be closed, run t he |
| 419 // Session Close algorithm on this object. | 432 // Session Close algorithm on this object. |
| 420 // 3.3 Resolve promise with undefined. | 433 // 3.3 Resolve promise with undefined. |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 443 } | 456 } |
| 444 | 457 |
| 445 // Queue a task to fire a simple event named keymessage at the new object | 458 // Queue a task to fire a simple event named keymessage at the new object |
| 446 void MediaKeySession::message(const unsigned char* message, size_t messageLength , const blink::WebURL& destinationURL) | 459 void MediaKeySession::message(const unsigned char* message, size_t messageLength , const blink::WebURL& destinationURL) |
| 447 { | 460 { |
| 448 WTF_LOG(Media, "MediaKeySession(%p)::message", this); | 461 WTF_LOG(Media, "MediaKeySession(%p)::message", this); |
| 449 | 462 |
| 450 MediaKeyMessageEventInit init; | 463 MediaKeyMessageEventInit init; |
| 451 init.bubbles = false; | 464 init.bubbles = false; |
| 452 init.cancelable = false; | 465 init.cancelable = false; |
| 453 init.message = Uint8Array::create(message, messageLength); | 466 init.message = ArrayBuffer::create(static_cast<const void*>(message), messag eLength); |
| 454 init.destinationURL = destinationURL.string(); | 467 init.destinationURL = destinationURL.string(); |
| 455 | 468 |
| 456 RefPtrWillBeRawPtr<MediaKeyMessageEvent> event = MediaKeyMessageEvent::creat e(EventTypeNames::message, init); | 469 RefPtrWillBeRawPtr<MediaKeyMessageEvent> event = MediaKeyMessageEvent::creat e(EventTypeNames::message, init); |
| 457 event->setTarget(this); | 470 event->setTarget(this); |
| 458 m_asyncEventQueue->enqueueEvent(event.release()); | 471 m_asyncEventQueue->enqueueEvent(event.release()); |
| 459 } | 472 } |
| 460 | 473 |
| 461 void MediaKeySession::ready() | 474 void MediaKeySession::ready() |
| 462 { | 475 { |
| 463 WTF_LOG(Media, "MediaKeySession(%p)::ready", this); | 476 WTF_LOG(Media, "MediaKeySession(%p)::ready", this); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 567 void MediaKeySession::trace(Visitor* visitor) | 580 void MediaKeySession::trace(Visitor* visitor) |
| 568 { | 581 { |
| 569 visitor->trace(m_error); | 582 visitor->trace(m_error); |
| 570 visitor->trace(m_asyncEventQueue); | 583 visitor->trace(m_asyncEventQueue); |
| 571 visitor->trace(m_pendingActions); | 584 visitor->trace(m_pendingActions); |
| 572 visitor->trace(m_keys); | 585 visitor->trace(m_keys); |
| 573 EventTargetWithInlineData::trace(visitor); | 586 EventTargetWithInlineData::trace(visitor); |
| 574 } | 587 } |
| 575 | 588 |
| 576 } | 589 } |
| OLD | NEW |