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->executionContext()) | 311 : ActiveDOMObject(scriptState->getExecutionContext()) |
312 , m_asyncEventQueue(GenericEventQueue::create(this)) | 312 , m_asyncEventQueue(GenericEventQueue::create(this)) |
313 , m_mediaKeys(mediaKeys) | 313 , m_mediaKeys(mediaKeys) |
314 , m_sessionType(sessionType) | 314 , m_sessionType(sessionType) |
315 , m_expiration(std::numeric_limits<double>::quiet_NaN()) | 315 , m_expiration(std::numeric_limits<double>::quiet_NaN()) |
316 , m_keyStatusesMap(new MediaKeyStatusMap()) | 316 , m_keyStatusesMap(new MediaKeyStatusMap()) |
317 , m_isUninitialized(true) | 317 , m_isUninitialized(true) |
318 , m_isCallable(false) | 318 , m_isCallable(false) |
319 , m_isClosed(false) | 319 , m_isClosed(false) |
320 , m_closedPromise(new ClosedPromise(scriptState->executionContext(), this, C
losedPromise::Closed)) | 320 , m_closedPromise(new ClosedPromise(scriptState->getExecutionContext(), this
, ClosedPromise::Closed)) |
321 , m_actionTimer(this, &MediaKeySession::actionTimerFired) | 321 , m_actionTimer(this, &MediaKeySession::actionTimerFired) |
322 { | 322 { |
323 WTF_LOG(Media, "MediaKeySession(%p)::MediaKeySession", this); | 323 WTF_LOG(Media, "MediaKeySession(%p)::MediaKeySession", this); |
324 | 324 |
325 // Create the matching Chromium object. It will not be usable until | 325 // Create the matching Chromium object. It will not be usable until |
326 // initializeNewSession() is called in response to the user calling | 326 // initializeNewSession() is called in response to the user calling |
327 // generateRequest(). | 327 // generateRequest(). |
328 WebContentDecryptionModule* cdm = mediaKeys->contentDecryptionModule(); | 328 WebContentDecryptionModule* cdm = mediaKeys->contentDecryptionModule(); |
329 m_session = adoptPtr(cdm->createSession()); | 329 m_session = adoptPtr(cdm->createSession()); |
330 m_session->setClientInterface(this); | 330 m_session->setClientInterface(this); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 scriptState, DOMException::create(InvalidAccessError, "The session t
ype is not persistent.")); | 482 scriptState, DOMException::create(InvalidAccessError, "The session t
ype is not persistent.")); |
483 } | 483 } |
484 | 484 |
485 // 5. If the Key System implementation represented by this object's cdm | 485 // 5. If the Key System implementation represented by this object's cdm |
486 // implementation value does not support loading previous sessions, | 486 // implementation value does not support loading previous sessions, |
487 // return a promise rejected with a new DOMException whose name is | 487 // return a promise rejected with a new DOMException whose name is |
488 // NotSupportedError. | 488 // NotSupportedError. |
489 // FIXME: Implement this (http://crbug.com/448922). | 489 // FIXME: Implement this (http://crbug.com/448922). |
490 | 490 |
491 // 6. Let origin be the origin of this object's Document. | 491 // 6. Let origin be the origin of this object's Document. |
492 // (Available as executionContext()->securityOrigin() anytime.) | 492 // (Available as getExecutionContext()->getSecurityOrigin() anytime.) |
493 | 493 |
494 // 7. Let promise be a new promise. | 494 // 7. Let promise be a new promise. |
495 LoadSessionResultPromise* result = new LoadSessionResultPromise(scriptState,
this); | 495 LoadSessionResultPromise* result = new LoadSessionResultPromise(scriptState,
this); |
496 ScriptPromise promise = result->promise(); | 496 ScriptPromise promise = result->promise(); |
497 | 497 |
498 // 8. Run the following steps asynchronously (documented in | 498 // 8. Run the following steps asynchronously (documented in |
499 // actionTimerFired()) | 499 // actionTimerFired()) |
500 m_pendingActions.append(PendingAction::CreatePendingLoadRequest(result, sess
ionId)); | 500 m_pendingActions.append(PendingAction::CreatePendingLoadRequest(result, sess
ionId)); |
501 ASSERT(!m_actionTimer.isActive()); | 501 ASSERT(!m_actionTimer.isActive()); |
502 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); | 502 m_actionTimer.startOneShot(0, BLINK_FROM_HERE); |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 // may choose to skip this step if it knows resuming will fail. | 878 // may choose to skip this step if it knows resuming will fail. |
879 // FIXME: Attempt to resume playback if |hasAdditionalUsableKey| is true. | 879 // FIXME: Attempt to resume playback if |hasAdditionalUsableKey| is true. |
880 // http://crbug.com/413413 | 880 // http://crbug.com/413413 |
881 } | 881 } |
882 | 882 |
883 const AtomicString& MediaKeySession::interfaceName() const | 883 const AtomicString& MediaKeySession::interfaceName() const |
884 { | 884 { |
885 return EventTargetNames::MediaKeySession; | 885 return EventTargetNames::MediaKeySession; |
886 } | 886 } |
887 | 887 |
888 ExecutionContext* MediaKeySession::executionContext() const | 888 ExecutionContext* MediaKeySession::getExecutionContext() const |
889 { | 889 { |
890 return ActiveDOMObject::executionContext(); | 890 return ActiveDOMObject::getExecutionContext(); |
891 } | 891 } |
892 | 892 |
893 bool MediaKeySession::hasPendingActivity() const | 893 bool MediaKeySession::hasPendingActivity() const |
894 { | 894 { |
895 // Remain around if there are pending events or MediaKeys is still around | 895 // Remain around if there are pending events or MediaKeys is still around |
896 // and we're not closed. | 896 // and we're not closed. |
897 WTF_LOG(Media, "MediaKeySession(%p)::hasPendingActivity %s%s%s%s", this, | 897 WTF_LOG(Media, "MediaKeySession(%p)::hasPendingActivity %s%s%s%s", this, |
898 ScriptWrappable::hasPendingActivity() ? " ScriptWrappable::hasPendingAct
ivity()" : "", | 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()" : "", |
(...skipping 22 matching lines...) Expand all Loading... |
923 visitor->trace(m_asyncEventQueue); | 923 visitor->trace(m_asyncEventQueue); |
924 visitor->trace(m_pendingActions); | 924 visitor->trace(m_pendingActions); |
925 visitor->trace(m_mediaKeys); | 925 visitor->trace(m_mediaKeys); |
926 visitor->trace(m_keyStatusesMap); | 926 visitor->trace(m_keyStatusesMap); |
927 visitor->trace(m_closedPromise); | 927 visitor->trace(m_closedPromise); |
928 RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession>::trace(
visitor); | 928 RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession>::trace(
visitor); |
929 ActiveDOMObject::trace(visitor); | 929 ActiveDOMObject::trace(visitor); |
930 } | 930 } |
931 | 931 |
932 } // namespace blink | 932 } // namespace blink |
OLD | NEW |