diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-13 16:23:34 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-14 10:37:21 +0000 |
commit | 38a9a29f4f9436cace7f0e7abf9c586057df8a4e (patch) | |
tree | c4e8c458dc595bc0ddb435708fa2229edfd00bd4 /chromium/third_party/blink/renderer/modules/encryptedmedia/media_key_session.cc | |
parent | e684a3455bcc29a6e3e66a004e352dea4e1141e7 (diff) | |
download | qtwebengine-chromium-38a9a29f4f9436cace7f0e7abf9c586057df8a4e.tar.gz |
BASELINE: Update Chromium to 73.0.3683.37
Change-Id: I08c9af2948b645f671e5d933aca1f7a90ea372f2
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/modules/encryptedmedia/media_key_session.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/modules/encryptedmedia/media_key_session.cc | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/chromium/third_party/blink/renderer/modules/encryptedmedia/media_key_session.cc b/chromium/third_party/blink/renderer/modules/encryptedmedia/media_key_session.cc index e478c4d1a33..a208dac96e3 100644 --- a/chromium/third_party/blink/renderer/modules/encryptedmedia/media_key_session.cc +++ b/chromium/third_party/blink/renderer/modules/encryptedmedia/media_key_session.cc @@ -358,9 +358,10 @@ MediaKeySession::MediaKeySession(ScriptState* script_state, is_uninitialized_(true), is_callable_(false), is_closing_or_closed_(false), - closed_promise_(new ClosedPromise(ExecutionContext::From(script_state), - this, - ClosedPromise::kClosed)), + closed_promise_(MakeGarbageCollected<ClosedPromise>( + ExecutionContext::From(script_state), + this, + ClosedPromise::kClosed)), action_timer_(ExecutionContext::From(script_state) ->GetTaskRunner(TaskType::kMiscPlatformAPI), this, @@ -378,7 +379,7 @@ MediaKeySession::MediaKeySession(ScriptState* script_state, // From https://w3c.github.io/encrypted-media/#createSession: // MediaKeys::createSession(), step 3. // 3.1 Let the sessionId attribute be the empty string. - DCHECK(sessionId().IsEmpty()); + DCHECK(session_id_.IsEmpty()); // 3.2 Let the expiration attribute be NaN. DCHECK(std::isnan(expiration_)); @@ -418,7 +419,7 @@ void MediaKeySession::Dispose() { } String MediaKeySession::sessionId() const { - return session_->SessionId(); + return session_id_; } ScriptPromise MediaKeySession::closed(ScriptState* script_state) { @@ -536,7 +537,8 @@ void MediaKeySession::FinishGenerateRequest() { // new DOMException whose name is the appropriate error name. // (Done by CDM calling result.completeWithError() as appropriate.) // 10.10.2 Set the sessionId attribute to session id. - DCHECK(!sessionId().IsEmpty()); + session_id_ = session_->SessionId(); + DCHECK(!session_id_.IsEmpty()); // 10.10.3 Let this object's callable be true. is_callable_ = true; @@ -654,7 +656,8 @@ void MediaKeySession::FinishLoad() { // (Done by CDM calling result.completeWithError() as appropriate.) // 8.9.2 Set the sessionId attribute to sanitized session ID. - DCHECK(!sessionId().IsEmpty()); + session_id_ = session_->SessionId(); + DCHECK(!session_id_.IsEmpty()); // 8.9.3 Let this object's callable be true. is_callable_ = true; @@ -910,6 +913,11 @@ void MediaKeySession::Message(MessageType message_type, } void MediaKeySession::Close() { + // Note that this is the event from the CDM when this session is actually + // closed. The CDM can close a session at any time. Normally it would happen + // as the result of a close() call, but also happens when update() has been + // called with a record of license destruction or if the CDM crashes or + // otherwise becomes unavailable. DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")"; // From http://w3c.github.io/encrypted-media/#session-closed @@ -931,6 +939,22 @@ void MediaKeySession::Close() { // 7. Resolve promise. closed_promise_->ResolveWithUndefined(); + + // Stop the CDM from firing any more events for this session. + session_.reset(); + + // Fail any pending events, except if it's a close request. + action_timer_.Stop(); + while (!pending_actions_.IsEmpty()) { + PendingAction* action = pending_actions_.TakeFirst(); + if (action->GetType() == PendingAction::kClose) { + action->Result()->Complete(); + } else { + action->Result()->CompleteWithError( + kWebContentDecryptionModuleExceptionInvalidStateError, 0, + "Session has been closed"); + } + } } void MediaKeySession::ExpirationChanged(double updated_expiry_time_in_ms) { |