| 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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 | 508 |
| 509 // 8. Let session type be this object's session type. | 509 // 8. Let session type be this object's session type. |
| 510 // (Done in constructor.) | 510 // (Done in constructor.) |
| 511 | 511 |
| 512 // 9. Let promise be a new promise. | 512 // 9. Let promise be a new promise. |
| 513 NewSessionResultPromise* result = | 513 NewSessionResultPromise* result = |
| 514 new NewSessionResultPromise(scriptState, this); | 514 new NewSessionResultPromise(scriptState, this); |
| 515 ScriptPromise promise = result->promise(); | 515 ScriptPromise promise = result->promise(); |
| 516 | 516 |
| 517 // 10. Run the following steps asynchronously (done in generateRequestTask()) | 517 // 10. Run the following steps asynchronously (done in generateRequestTask()) |
| 518 m_pendingActions.append(PendingAction::CreatePendingGenerateRequest( | 518 m_pendingActions.push_back(PendingAction::CreatePendingGenerateRequest( |
| 519 result, initDataType, initDataBuffer)); | 519 result, initDataType, initDataBuffer)); |
| 520 DCHECK(!m_actionTimer.isActive()); | 520 DCHECK(!m_actionTimer.isActive()); |
| 521 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); | 521 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); |
| 522 | 522 |
| 523 // 11. Return promise. | 523 // 11. Return promise. |
| 524 return promise; | 524 return promise; |
| 525 } | 525 } |
| 526 | 526 |
| 527 void MediaKeySession::generateRequestTask( | 527 void MediaKeySession::generateRequestTask( |
| 528 ContentDecryptionModuleResult* result, | 528 ContentDecryptionModuleResult* result, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 603 |
| 604 // 6. Let origin be the origin of this object's Document. | 604 // 6. Let origin be the origin of this object's Document. |
| 605 // (Available as getExecutionContext()->getSecurityOrigin() anytime.) | 605 // (Available as getExecutionContext()->getSecurityOrigin() anytime.) |
| 606 | 606 |
| 607 // 7. Let promise be a new promise. | 607 // 7. Let promise be a new promise. |
| 608 LoadSessionResultPromise* result = | 608 LoadSessionResultPromise* result = |
| 609 new LoadSessionResultPromise(scriptState, this); | 609 new LoadSessionResultPromise(scriptState, this); |
| 610 ScriptPromise promise = result->promise(); | 610 ScriptPromise promise = result->promise(); |
| 611 | 611 |
| 612 // 8. Run the following steps asynchronously (done in loadTask()) | 612 // 8. Run the following steps asynchronously (done in loadTask()) |
| 613 m_pendingActions.append( | 613 m_pendingActions.push_back( |
| 614 PendingAction::CreatePendingLoadRequest(result, sessionId)); | 614 PendingAction::CreatePendingLoadRequest(result, sessionId)); |
| 615 DCHECK(!m_actionTimer.isActive()); | 615 DCHECK(!m_actionTimer.isActive()); |
| 616 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); | 616 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); |
| 617 | 617 |
| 618 // 9. Return promise. | 618 // 9. Return promise. |
| 619 return promise; | 619 return promise; |
| 620 } | 620 } |
| 621 | 621 |
| 622 void MediaKeySession::loadTask(ContentDecryptionModuleResult* result, | 622 void MediaKeySession::loadTask(ContentDecryptionModuleResult* result, |
| 623 const String& sessionId) { | 623 const String& sessionId) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 722 | 722 |
| 723 // 4. Let response copy be a copy of the contents of the response parameter. | 723 // 4. Let response copy be a copy of the contents of the response parameter. |
| 724 DOMArrayBuffer* responseCopy = | 724 DOMArrayBuffer* responseCopy = |
| 725 DOMArrayBuffer::create(response.data(), response.byteLength()); | 725 DOMArrayBuffer::create(response.data(), response.byteLength()); |
| 726 | 726 |
| 727 // 5. Let promise be a new promise. | 727 // 5. Let promise be a new promise. |
| 728 SimpleResultPromise* result = new SimpleResultPromise(scriptState, this); | 728 SimpleResultPromise* result = new SimpleResultPromise(scriptState, this); |
| 729 ScriptPromise promise = result->promise(); | 729 ScriptPromise promise = result->promise(); |
| 730 | 730 |
| 731 // 6. Run the following steps asynchronously (done in updateTask()) | 731 // 6. Run the following steps asynchronously (done in updateTask()) |
| 732 m_pendingActions.append( | 732 m_pendingActions.push_back( |
| 733 PendingAction::CreatePendingUpdate(result, responseCopy)); | 733 PendingAction::CreatePendingUpdate(result, responseCopy)); |
| 734 if (!m_actionTimer.isActive()) | 734 if (!m_actionTimer.isActive()) |
| 735 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); | 735 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); |
| 736 | 736 |
| 737 // 7. Return promise. | 737 // 7. Return promise. |
| 738 return promise; | 738 return promise; |
| 739 } | 739 } |
| 740 | 740 |
| 741 void MediaKeySession::updateTask(ContentDecryptionModuleResult* result, | 741 void MediaKeySession::updateTask(ContentDecryptionModuleResult* result, |
| 742 DOMArrayBuffer* sanitizedResponse) { | 742 DOMArrayBuffer* sanitizedResponse) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 767 // 3. If session's callable value is false, return a promise rejected with | 767 // 3. If session's callable value is false, return a promise rejected with |
| 768 // an InvalidStateError. | 768 // an InvalidStateError. |
| 769 if (!m_isCallable) | 769 if (!m_isCallable) |
| 770 return CreateRejectedPromiseNotCallable(scriptState); | 770 return CreateRejectedPromiseNotCallable(scriptState); |
| 771 | 771 |
| 772 // 4. Let promise be a new promise. | 772 // 4. Let promise be a new promise. |
| 773 SimpleResultPromise* result = new SimpleResultPromise(scriptState, this); | 773 SimpleResultPromise* result = new SimpleResultPromise(scriptState, this); |
| 774 ScriptPromise promise = result->promise(); | 774 ScriptPromise promise = result->promise(); |
| 775 | 775 |
| 776 // 5. Run the following steps in parallel (done in closeTask()). | 776 // 5. Run the following steps in parallel (done in closeTask()). |
| 777 m_pendingActions.append(PendingAction::CreatePendingClose(result)); | 777 m_pendingActions.push_back(PendingAction::CreatePendingClose(result)); |
| 778 if (!m_actionTimer.isActive()) | 778 if (!m_actionTimer.isActive()) |
| 779 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); | 779 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); |
| 780 | 780 |
| 781 // 6. Return promise. | 781 // 6. Return promise. |
| 782 return promise; | 782 return promise; |
| 783 } | 783 } |
| 784 | 784 |
| 785 void MediaKeySession::closeTask(ContentDecryptionModuleResult* result) { | 785 void MediaKeySession::closeTask(ContentDecryptionModuleResult* result) { |
| 786 // NOTE: Continue step 4 of MediaKeySession::close(). | 786 // NOTE: Continue step 4 of MediaKeySession::close(). |
| 787 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")"; | 787 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")"; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 817 scriptState, | 817 scriptState, |
| 818 V8ThrowException::createTypeError( | 818 V8ThrowException::createTypeError( |
| 819 scriptState->isolate(), "The session type is not persistent.")); | 819 scriptState->isolate(), "The session type is not persistent.")); |
| 820 } | 820 } |
| 821 | 821 |
| 822 // 4. Let promise be a new promise. | 822 // 4. Let promise be a new promise. |
| 823 SimpleResultPromise* result = new SimpleResultPromise(scriptState, this); | 823 SimpleResultPromise* result = new SimpleResultPromise(scriptState, this); |
| 824 ScriptPromise promise = result->promise(); | 824 ScriptPromise promise = result->promise(); |
| 825 | 825 |
| 826 // 5. Run the following steps asynchronously (done in removeTask()). | 826 // 5. Run the following steps asynchronously (done in removeTask()). |
| 827 m_pendingActions.append(PendingAction::CreatePendingRemove(result)); | 827 m_pendingActions.push_back(PendingAction::CreatePendingRemove(result)); |
| 828 if (!m_actionTimer.isActive()) | 828 if (!m_actionTimer.isActive()) |
| 829 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); | 829 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); |
| 830 | 830 |
| 831 // 6. Return promise. | 831 // 6. Return promise. |
| 832 return promise; | 832 return promise; |
| 833 } | 833 } |
| 834 | 834 |
| 835 void MediaKeySession::removeTask(ContentDecryptionModuleResult* result) { | 835 void MediaKeySession::removeTask(ContentDecryptionModuleResult* result) { |
| 836 // NOTE: Continue step 5 of MediaKeySession::remove(). | 836 // NOTE: Continue step 5 of MediaKeySession::remove(). |
| 837 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")"; | 837 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")"; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 visitor->trace(m_asyncEventQueue); | 1045 visitor->trace(m_asyncEventQueue); |
| 1046 visitor->trace(m_pendingActions); | 1046 visitor->trace(m_pendingActions); |
| 1047 visitor->trace(m_mediaKeys); | 1047 visitor->trace(m_mediaKeys); |
| 1048 visitor->trace(m_keyStatusesMap); | 1048 visitor->trace(m_keyStatusesMap); |
| 1049 visitor->trace(m_closedPromise); | 1049 visitor->trace(m_closedPromise); |
| 1050 EventTargetWithInlineData::trace(visitor); | 1050 EventTargetWithInlineData::trace(visitor); |
| 1051 ContextLifecycleObserver::trace(visitor); | 1051 ContextLifecycleObserver::trace(visitor); |
| 1052 } | 1052 } |
| 1053 | 1053 |
| 1054 } // namespace blink | 1054 } // namespace blink |
| OLD | NEW |