| 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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 , m_sessionType(sessionType) | 315 , m_sessionType(sessionType) |
| 316 , m_expiration(std::numeric_limits<double>::quiet_NaN()) | 316 , m_expiration(std::numeric_limits<double>::quiet_NaN()) |
| 317 , m_keyStatusesMap(new MediaKeyStatusMap()) | 317 , m_keyStatusesMap(new MediaKeyStatusMap()) |
| 318 , m_isUninitialized(true) | 318 , m_isUninitialized(true) |
| 319 , m_isCallable(false) | 319 , m_isCallable(false) |
| 320 , m_isClosed(false) | 320 , m_isClosed(false) |
| 321 , m_closedPromise(new ClosedPromise(scriptState->getExecutionContext(), this
, ClosedPromise::Closed)) | 321 , m_closedPromise(new ClosedPromise(scriptState->getExecutionContext(), this
, ClosedPromise::Closed)) |
| 322 , m_actionTimer(this, &MediaKeySession::actionTimerFired) | 322 , m_actionTimer(this, &MediaKeySession::actionTimerFired) |
| 323 { | 323 { |
| 324 WTF_LOG(Media, "MediaKeySession(%p)::MediaKeySession", this); | 324 WTF_LOG(Media, "MediaKeySession(%p)::MediaKeySession", this); |
| 325 ThreadState::current()->registerPreFinalizer(this); |
| 325 | 326 |
| 326 // Create the matching Chromium object. It will not be usable until | 327 // Create the matching Chromium object. It will not be usable until |
| 327 // initializeNewSession() is called in response to the user calling | 328 // initializeNewSession() is called in response to the user calling |
| 328 // generateRequest(). | 329 // generateRequest(). |
| 329 WebContentDecryptionModule* cdm = mediaKeys->contentDecryptionModule(); | 330 WebContentDecryptionModule* cdm = mediaKeys->contentDecryptionModule(); |
| 330 m_session = adoptPtr(cdm->createSession()); | 331 m_session = adoptPtr(cdm->createSession()); |
| 331 m_session->setClientInterface(this); | 332 m_session->setClientInterface(this); |
| 332 | 333 |
| 333 // From https://w3c.github.io/encrypted-media/#createSession: | 334 // From https://w3c.github.io/encrypted-media/#createSession: |
| 334 // MediaKeys::createSession(), step 3. | 335 // MediaKeys::createSession(), step 3. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 357 // use distinctive identifier. | 358 // use distinctive identifier. |
| 358 // FIXME: Implement this (http://crbug.com/448922). | 359 // FIXME: Implement this (http://crbug.com/448922). |
| 359 | 360 |
| 360 // 3.9 Let the cdm implementation value be this object's cdm implementation. | 361 // 3.9 Let the cdm implementation value be this object's cdm implementation. |
| 361 // 3.10 Let the cdm instance value be this object's cdm instance. | 362 // 3.10 Let the cdm instance value be this object's cdm instance. |
| 362 } | 363 } |
| 363 | 364 |
| 364 MediaKeySession::~MediaKeySession() | 365 MediaKeySession::~MediaKeySession() |
| 365 { | 366 { |
| 366 WTF_LOG(Media, "MediaKeySession(%p)::~MediaKeySession", this); | 367 WTF_LOG(Media, "MediaKeySession(%p)::~MediaKeySession", this); |
| 368 } |
| 369 |
| 370 void MediaKeySession::dispose() |
| 371 { |
| 372 // Promptly clears a raw reference from content/ to an on-heap object |
| 373 // so that content/ doesn't access it in a lazy sweeping phase. |
| 367 m_session.clear(); | 374 m_session.clear(); |
| 368 #if !ENABLE(OILPAN) | |
| 369 // MediaKeySession and m_asyncEventQueue always become unreachable | |
| 370 // together. So MediaKeySession and m_asyncEventQueue are destructed in the | |
| 371 // same GC. We don't need to call cancelAllEvents explicitly in Oilpan. | |
| 372 m_asyncEventQueue->cancelAllEvents(); | |
| 373 #endif | |
| 374 } | 375 } |
| 375 | 376 |
| 376 String MediaKeySession::sessionId() const | 377 String MediaKeySession::sessionId() const |
| 377 { | 378 { |
| 378 return m_session->sessionId(); | 379 return m_session->sessionId(); |
| 379 } | 380 } |
| 380 | 381 |
| 381 ScriptPromise MediaKeySession::closed(ScriptState* scriptState) | 382 ScriptPromise MediaKeySession::closed(ScriptState* scriptState) |
| 382 { | 383 { |
| 383 return m_closedPromise->promise(scriptState->world()); | 384 return m_closedPromise->promise(scriptState->world()); |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 visitor->trace(m_asyncEventQueue); | 923 visitor->trace(m_asyncEventQueue); |
| 923 visitor->trace(m_pendingActions); | 924 visitor->trace(m_pendingActions); |
| 924 visitor->trace(m_mediaKeys); | 925 visitor->trace(m_mediaKeys); |
| 925 visitor->trace(m_keyStatusesMap); | 926 visitor->trace(m_keyStatusesMap); |
| 926 visitor->trace(m_closedPromise); | 927 visitor->trace(m_closedPromise); |
| 927 RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession>::trace(
visitor); | 928 RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession>::trace(
visitor); |
| 928 ActiveDOMObject::trace(visitor); | 929 ActiveDOMObject::trace(visitor); |
| 929 } | 930 } |
| 930 | 931 |
| 931 } // namespace blink | 932 } // namespace blink |
| OLD | NEW |