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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 WTF_LOG(Media, "MediaKeySession(%p)::~MediaKeySession", this); | 395 WTF_LOG(Media, "MediaKeySession(%p)::~MediaKeySession", this); |
| 396 m_session.clear(); | 396 m_session.clear(); |
| 397 #if !ENABLE(OILPAN) | 397 #if !ENABLE(OILPAN) |
| 398 // MediaKeySession and m_asyncEventQueue always become unreachable | 398 // MediaKeySession and m_asyncEventQueue always become unreachable |
| 399 // together. So MediaKeySession and m_asyncEventQueue are destructed in the | 399 // together. So MediaKeySession and m_asyncEventQueue are destructed in the |
| 400 // same GC. We don't need to call cancelAllEvents explicitly in Oilpan. | 400 // same GC. We don't need to call cancelAllEvents explicitly in Oilpan. |
| 401 m_asyncEventQueue->cancelAllEvents(); | 401 m_asyncEventQueue->cancelAllEvents(); |
| 402 #endif | 402 #endif |
| 403 } | 403 } |
| 404 | 404 |
| 405 void MediaKeySession::setError(MediaKeyError* error) | |
| 406 { | |
| 407 m_error = error; | |
| 408 } | |
| 409 | |
| 410 String MediaKeySession::sessionId() const | 405 String MediaKeySession::sessionId() const |
| 411 { | 406 { |
| 412 return m_session->sessionId(); | 407 return m_session->sessionId(); |
| 413 } | 408 } |
| 414 | 409 |
| 415 ScriptPromise MediaKeySession::closed(ScriptState* scriptState) | 410 ScriptPromise MediaKeySession::closed(ScriptState* scriptState) |
| 416 { | 411 { |
| 417 return m_closedPromise->promise(scriptState->world()); | 412 return m_closedPromise->promise(scriptState->world()); |
| 418 } | 413 } |
| 419 | 414 |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 881 init.message = DOMArrayBuffer::create(static_cast<const void*>(message), mes sageLength); | 876 init.message = DOMArrayBuffer::create(static_cast<const void*>(message), mes sageLength); |
| 882 init.destinationURL = destinationURL.string(); | 877 init.destinationURL = destinationURL.string(); |
| 883 | 878 |
| 884 RefPtrWillBeRawPtr<MediaKeyMessageEvent> event = MediaKeyMessageEvent::creat e(EventTypeNames::message, init); | 879 RefPtrWillBeRawPtr<MediaKeyMessageEvent> event = MediaKeyMessageEvent::creat e(EventTypeNames::message, init); |
| 885 event->setTarget(this); | 880 event->setTarget(this); |
| 886 m_asyncEventQueue->enqueueEvent(event.release()); | 881 m_asyncEventQueue->enqueueEvent(event.release()); |
| 887 } | 882 } |
| 888 | 883 |
| 889 void MediaKeySession::ready() | 884 void MediaKeySession::ready() |
| 890 { | 885 { |
| 891 WTF_LOG(Media, "MediaKeySession(%p)::ready", this); | 886 // FIXME: Remove this event from the |
| 892 | 887 // WebContentDecryptionModuleSession::Client interface. |
| 893 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::ready); | |
| 894 event->setTarget(this); | |
| 895 m_asyncEventQueue->enqueueEvent(event.release()); | |
| 896 } | 888 } |
| 897 | 889 |
| 898 void MediaKeySession::close() | 890 void MediaKeySession::close() |
| 899 { | 891 { |
| 900 WTF_LOG(Media, "MediaKeySession(%p)::close", this); | 892 WTF_LOG(Media, "MediaKeySession(%p)::close", this); |
| 901 | 893 |
| 902 // Once closed, the session can no longer be the target of events from | 894 // Once closed, the session can no longer be the target of events from |
| 903 // the CDM so this object can be garbage collected. | 895 // the CDM so this object can be garbage collected. |
| 904 m_isClosed = true; | 896 m_isClosed = true; |
| 905 | 897 |
| 906 // Resolve the closed promise. | 898 // Resolve the closed promise. |
| 907 m_closedPromise->resolve(V8UndefinedType()); | 899 m_closedPromise->resolve(V8UndefinedType()); |
| 908 } | 900 } |
| 909 | 901 |
| 910 // Queue a task to fire a simple event named keyadded at the MediaKeySession obj ect. | |
| 911 void MediaKeySession::error(MediaKeyErrorCode errorCode, unsigned long systemCod e) | 902 void MediaKeySession::error(MediaKeyErrorCode errorCode, unsigned long systemCod e) |
| 912 { | 903 { |
| 913 WTF_LOG(Media, "MediaKeySession(%p)::error: errorCode=%d, systemCode=%lu", t his, errorCode, systemCode); | 904 // FIXME: Remove this event from the |
|
ddorwin
2014/10/30 00:30:17
Is Chrome still calling it? If no, NOTREACHED().
jrummell
2014/10/30 21:32:27
Done.
| |
| 914 | 905 // WebContentDecryptionModuleSession::Client interface. |
| 915 MediaKeyError::Code mediaKeyErrorCode = MediaKeyError::MEDIA_KEYERR_UNKNOWN; | |
| 916 switch (errorCode) { | |
| 917 case MediaKeyErrorCodeUnknown: | |
| 918 mediaKeyErrorCode = MediaKeyError::MEDIA_KEYERR_UNKNOWN; | |
| 919 break; | |
| 920 case MediaKeyErrorCodeClient: | |
| 921 mediaKeyErrorCode = MediaKeyError::MEDIA_KEYERR_CLIENT; | |
| 922 break; | |
| 923 } | |
| 924 | |
| 925 // 1. Create a new MediaKeyError object with the following attributes: | |
| 926 // code = the appropriate MediaKeyError code | |
| 927 // systemCode = a Key System-specific value, if provided, and 0 otherwise | |
| 928 // 2. Set the MediaKeySession object's error attribute to the error object c reated in the previous step. | |
| 929 m_error = MediaKeyError::create(mediaKeyErrorCode, systemCode); | |
| 930 | |
| 931 // 3. queue a task to fire a simple event named keyerror at the MediaKeySess ion object. | |
| 932 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::error); | |
| 933 event->setTarget(this); | |
| 934 m_asyncEventQueue->enqueueEvent(event.release()); | |
| 935 } | 906 } |
| 936 | 907 |
| 937 void MediaKeySession::error(WebContentDecryptionModuleException exception, unsig ned long systemCode, const WebString& errorMessage) | 908 void MediaKeySession::error(WebContentDecryptionModuleException exception, unsig ned long systemCode, const WebString& errorMessage) |
| 938 { | 909 { |
| 939 WTF_LOG(Media, "MediaKeySession::error: exception=%d, systemCode=%lu", excep tion, systemCode); | 910 // FIXME: Remove this event from the |
| 940 | 911 // WebContentDecryptionModuleSession::Client interface. |
| 941 // FIXME: EME-WD MediaKeyError now derives from DOMException. Figure out how | |
| 942 // to implement this without breaking prefixed EME, which has a totally | |
| 943 // different definition. The spec may also change to be just a DOMException. | |
| 944 // For now, simply generate an existing MediaKeyError. | |
| 945 MediaKeyErrorCode errorCode; | |
| 946 switch (exception) { | |
| 947 case WebContentDecryptionModuleExceptionClientError: | |
| 948 errorCode = MediaKeyErrorCodeClient; | |
| 949 break; | |
| 950 default: | |
| 951 // All other exceptions get converted into Unknown. | |
| 952 errorCode = MediaKeyErrorCodeUnknown; | |
| 953 break; | |
| 954 } | |
| 955 error(errorCode, systemCode); | |
| 956 } | 912 } |
| 957 | 913 |
| 958 void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) | 914 void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) |
| 959 { | 915 { |
| 960 m_expiration = updatedExpiryTimeInMS; | 916 m_expiration = updatedExpiryTimeInMS; |
| 961 } | 917 } |
| 962 | 918 |
| 963 const AtomicString& MediaKeySession::interfaceName() const | 919 const AtomicString& MediaKeySession::interfaceName() const |
| 964 { | 920 { |
| 965 return EventTargetNames::MediaKeySession; | 921 return EventTargetNames::MediaKeySession; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 993 m_isClosed = true; | 949 m_isClosed = true; |
| 994 | 950 |
| 995 if (m_actionTimer.isActive()) | 951 if (m_actionTimer.isActive()) |
| 996 m_actionTimer.stop(); | 952 m_actionTimer.stop(); |
| 997 m_pendingActions.clear(); | 953 m_pendingActions.clear(); |
| 998 m_asyncEventQueue->close(); | 954 m_asyncEventQueue->close(); |
| 999 } | 955 } |
| 1000 | 956 |
| 1001 void MediaKeySession::trace(Visitor* visitor) | 957 void MediaKeySession::trace(Visitor* visitor) |
| 1002 { | 958 { |
| 1003 visitor->trace(m_error); | |
| 1004 visitor->trace(m_asyncEventQueue); | 959 visitor->trace(m_asyncEventQueue); |
| 1005 visitor->trace(m_pendingActions); | 960 visitor->trace(m_pendingActions); |
| 1006 visitor->trace(m_mediaKeys); | 961 visitor->trace(m_mediaKeys); |
| 1007 visitor->trace(m_closedPromise); | 962 visitor->trace(m_closedPromise); |
| 1008 EventTargetWithInlineData::trace(visitor); | 963 EventTargetWithInlineData::trace(visitor); |
| 1009 } | 964 } |
| 1010 | 965 |
| 1011 } // namespace blink | 966 } // namespace blink |
| OLD | NEW |