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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 }; | 301 }; |
302 | 302 |
303 MediaKeySession* MediaKeySession::create(ScriptState* scriptState, MediaKeys* me
diaKeys, WebEncryptedMediaSessionType sessionType) | 303 MediaKeySession* MediaKeySession::create(ScriptState* scriptState, MediaKeys* me
diaKeys, WebEncryptedMediaSessionType sessionType) |
304 { | 304 { |
305 RefPtrWillBeRawPtr<MediaKeySession> session = new MediaKeySession(scriptStat
e, mediaKeys, sessionType); | 305 RefPtrWillBeRawPtr<MediaKeySession> session = new MediaKeySession(scriptStat
e, mediaKeys, sessionType); |
306 session->suspendIfNeeded(); | 306 session->suspendIfNeeded(); |
307 return session.get(); | 307 return session.get(); |
308 } | 308 } |
309 | 309 |
310 MediaKeySession::MediaKeySession(ScriptState* scriptState, MediaKeys* mediaKeys,
WebEncryptedMediaSessionType sessionType) | 310 MediaKeySession::MediaKeySession(ScriptState* scriptState, MediaKeys* mediaKeys,
WebEncryptedMediaSessionType sessionType) |
311 : ActiveDOMObject(scriptState->getExecutionContext()) | 311 : ActiveScriptWrappable(this) |
| 312 , ActiveDOMObject(scriptState->getExecutionContext()) |
312 , m_asyncEventQueue(GenericEventQueue::create(this)) | 313 , m_asyncEventQueue(GenericEventQueue::create(this)) |
313 , m_mediaKeys(mediaKeys) | 314 , m_mediaKeys(mediaKeys) |
314 , m_sessionType(sessionType) | 315 , m_sessionType(sessionType) |
315 , m_expiration(std::numeric_limits<double>::quiet_NaN()) | 316 , m_expiration(std::numeric_limits<double>::quiet_NaN()) |
316 , m_keyStatusesMap(new MediaKeyStatusMap()) | 317 , m_keyStatusesMap(new MediaKeyStatusMap()) |
317 , m_isUninitialized(true) | 318 , m_isUninitialized(true) |
318 , m_isCallable(false) | 319 , m_isCallable(false) |
319 , m_isClosed(false) | 320 , m_isClosed(false) |
320 , m_closedPromise(new ClosedPromise(scriptState->getExecutionContext(), this
, ClosedPromise::Closed)) | 321 , m_closedPromise(new ClosedPromise(scriptState->getExecutionContext(), this
, ClosedPromise::Closed)) |
321 , m_actionTimer(this, &MediaKeySession::actionTimerFired) | 322 , m_actionTimer(this, &MediaKeySession::actionTimerFired) |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 | 888 |
888 ExecutionContext* MediaKeySession::getExecutionContext() const | 889 ExecutionContext* MediaKeySession::getExecutionContext() const |
889 { | 890 { |
890 return ActiveDOMObject::getExecutionContext(); | 891 return ActiveDOMObject::getExecutionContext(); |
891 } | 892 } |
892 | 893 |
893 bool MediaKeySession::hasPendingActivity() const | 894 bool MediaKeySession::hasPendingActivity() const |
894 { | 895 { |
895 // Remain around if there are pending events or MediaKeys is still around | 896 // Remain around if there are pending events or MediaKeys is still around |
896 // and we're not closed. | 897 // and we're not closed. |
897 WTF_LOG(Media, "MediaKeySession(%p)::hasPendingActivity %s%s%s%s", this, | 898 WTF_LOG(Media, "MediaKeySession(%p)::hasPendingActivity %s%s%s", this, |
898 ScriptWrappable::hasPendingActivity() ? " ScriptWrappable::hasPendingAct
ivity()" : "", | |
899 !m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "", | 899 !m_pendingActions.isEmpty() ? " !m_pendingActions.isEmpty()" : "", |
900 m_asyncEventQueue->hasPendingEvents() ? " m_asyncEventQueue->hasPendingE
vents()" : "", | 900 m_asyncEventQueue->hasPendingEvents() ? " m_asyncEventQueue->hasPendingE
vents()" : "", |
901 (m_mediaKeys && !m_isClosed) ? " m_mediaKeys && !m_isClosed" : ""); | 901 (m_mediaKeys && !m_isClosed) ? " m_mediaKeys && !m_isClosed" : ""); |
902 | 902 |
903 return ScriptWrappable::hasPendingActivity() | 903 return !m_pendingActions.isEmpty() |
904 || !m_pendingActions.isEmpty() | |
905 || m_asyncEventQueue->hasPendingEvents() | 904 || m_asyncEventQueue->hasPendingEvents() |
906 || (m_mediaKeys && !m_isClosed); | 905 || (m_mediaKeys && !m_isClosed); |
907 } | 906 } |
908 | 907 |
909 void MediaKeySession::stop() | 908 void MediaKeySession::stop() |
910 { | 909 { |
911 // Stop the CDM from firing any more events for this session. | 910 // Stop the CDM from firing any more events for this session. |
912 m_session.clear(); | 911 m_session.clear(); |
913 m_isClosed = true; | 912 m_isClosed = true; |
914 | 913 |
915 if (m_actionTimer.isActive()) | 914 if (m_actionTimer.isActive()) |
916 m_actionTimer.stop(); | 915 m_actionTimer.stop(); |
917 m_pendingActions.clear(); | 916 m_pendingActions.clear(); |
918 m_asyncEventQueue->close(); | 917 m_asyncEventQueue->close(); |
919 } | 918 } |
920 | 919 |
921 DEFINE_TRACE(MediaKeySession) | 920 DEFINE_TRACE(MediaKeySession) |
922 { | 921 { |
923 visitor->trace(m_asyncEventQueue); | 922 visitor->trace(m_asyncEventQueue); |
924 visitor->trace(m_pendingActions); | 923 visitor->trace(m_pendingActions); |
925 visitor->trace(m_mediaKeys); | 924 visitor->trace(m_mediaKeys); |
926 visitor->trace(m_keyStatusesMap); | 925 visitor->trace(m_keyStatusesMap); |
927 visitor->trace(m_closedPromise); | 926 visitor->trace(m_closedPromise); |
928 RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession>::trace(
visitor); | 927 RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession>::trace(
visitor); |
929 ActiveDOMObject::trace(visitor); | 928 ActiveDOMObject::trace(visitor); |
930 } | 929 } |
931 | 930 |
932 } // namespace blink | 931 } // namespace blink |
OLD | NEW |