}
void MediaKeySession::Dispose() {
- DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")";
+ LOG(INFO) << "(" << static_cast<void*>(this) << "), " << __func__;
// Drop references to objects from content/ that aren't managed by blink.
session_.reset();
ScriptPromise MediaKeySession::close(ScriptState* script_state,
ExceptionState& exception_state) {
- DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")";
+ LOG(INFO) << "(" << static_cast<void*>(this) << "), " << __func__;
// From https://w3c.github.io/encrypted-media/#close:
// Indicates that the application no longer needs the session and the CDM
void MediaKeySession::CloseTask(ContentDecryptionModuleResult* result) {
// NOTE: Continue step 4 of MediaKeySession::close().
- DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")";
+ LOG(INFO) << "(" << static_cast<void*>(this) << "), " << __func__;
// close() in Chromium will execute steps 5.1 through 5.3.
session_->Close(result->Result());
// Stop the CDM from firing any more events for this session now that it is
// closed. This was deferred in OnSessionClosed() as the EME spec resolves
// the promise after firing the event.
+ LOG(INFO) << "(" << static_cast<void*>(this) << "), " << __func__;
Dispose();
}
// 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 << ")";
+ LOG(INFO) << "(" << static_cast<void*>(this) << "), " << __func__;
// From http://w3c.github.io/encrypted-media/#session-closed
// 1. Let session be the associated MediaKeySession object.
void MediaKeySession::ContextDestroyed() {
// Stop the CDM from firing any more events for this session.
+ LOG(INFO) << "(" << static_cast<void*>(this) << "), " << __func__;
session_.reset();
is_closed_ = true;
action_timer_.Stop();
void CdmSessionAdapter::CloseSession(
const std::string& session_id,
std::unique_ptr<media::SimpleCdmPromise> promise) {
- DVLOG(2) << __func__ << ": session_id = " << session_id;
+ LOG(INFO) << "(" << static_cast<void*>(this) << "), " << __func__
+ << ": session_id = " << session_id;
cdm_->CloseSession(session_id, std::move(promise));
}
void CdmSessionAdapter::OnSessionClosed(const std::string& session_id,
media::CdmSessionClosedReason reason) {
+ LOG(INFO) << "(" << static_cast<void*>(this) << "), " << __func__
+ << " for session " << session_id;
WebContentDecryptionModuleSessionImpl* session = GetSession(session_id);
DLOG_IF(WARNING, !session)
<< __func__ << " for unknown session " << session_id;
if (session) {
- DVLOG(2) << __func__ << ": session_id = " << session_id
- << ", reason = " << static_cast<int>(reason);
+ LOG(INFO) << "(" << static_cast<void*>(this) << "), " << __func__
+ << ": session_id = " << session_id
+ << ", reason = " << static_cast<int>(reason);
session->OnSessionClosed(reason);
+ } else {
+ LOG(INFO) << "(" << static_cast<void*>(this) << "), " << __func__
+ << " find no session for id " << session_id;
}
}
: adapter_(adapter),
session_type_(ConvertSessionType(session_type)),
has_close_been_called_(false),
- is_closed_(false) {}
+ is_closed_(false) {
+ LOG(INFO) << "WebContentDecryptionModuleSessionImpl("
+ << static_cast<void*>(this) << ")";
+}
WebContentDecryptionModuleSessionImpl::
~WebContentDecryptionModuleSessionImpl() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
+ LOG(INFO) << "~WebContentDecryptionModuleSessionImpl("
+ << static_cast<void*>(this) << ")";
if (!session_id_.empty()) {
adapter_->UnregisterSession(session_id_);
// destroyed, there is no need for the promise to do anything as this
// session will be gone.
if (!is_closed_ && !has_close_been_called_) {
+ LOG(INFO) << "~WebContentDecryptionModuleSessionImpl("
+ << static_cast<void*>(this) << ")"
+ << " trigger close session";
adapter_->CloseSession(session_id_,
std::make_unique<media::DoNothingCdmPromise<>>());
}
DCHECK(!session_id_.empty());
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
+ LOG(INFO) << "(" << static_cast<void*>(this) << "), " << __func__
+ << ", session id: " << session_id_;
+
// close() shouldn't be called if the session is already closed. Since the
// operation is asynchronous, there is a window where close() was called
// just before the closed event arrives. The CDM should handle the case where
// close() is called after it has already closed the session. However, if
// we can tell the session is now closed, simply resolve the promise.
if (is_closed_) {
+ LOG(INFO) << "(" << static_cast<void*>(this) << "), " << __func__
+ << ", session id: " << session_id_ << ", already closed, ignore";
result.Complete();
return;
}
media::CdmSessionClosedReason reason) {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
+ LOG(INFO) << "(" << static_cast<void*>(this) << "), " << __func__
+ << ", session id: " << session_id_;
+
// Only send one closed event to blink.
if (is_closed_)
return;
}
IEMEDrmBridge::~IEMEDrmBridge() {
- LOG(INFO) << "Destroying IEMEDrmBridge";
+ LOG(INFO) << "(" << static_cast<void*>(this) << ") "
+ << " Destroying IEMEDrmBridge";
// Destroy our CDM so no callbacks are called from this point onwards.
cdm_.reset();
const std::string& js_session_id,
std::unique_ptr<media::SimpleCdmPromise> promise) {
const auto ieme_session_id = session_id_map_.mapJsToIeme(js_session_id);
- LOG(INFO) << "Closing session id: " << ieme_session_id
+ LOG(INFO) << "(" << static_cast<void*>(this) << ") " << __func__
+ << ", Closing session id: " << ieme_session_id
<< ", js_session_id: " << js_session_id;
const auto close_result_status = cdm_->session_close(ieme_session_id);
session_key_statuses_map_.erase(ieme_session_id);
last_expiration_times_map_.erase(ieme_session_id);
+ LOG(INFO) << "Run close callback for session id: " << js_session_id;
+ session_closed_cb_.Run(js_session_id, CdmSessionClosedReason::kClose);
+ // since session already closed, retrieve key statuses from cdm_ will fail,
+ // no need invoke onKeyStatusesChange anymore
+ // onKeyStatusesChange(ieme_session_id);
+
+ // After dtor of WebContentDecryptionModuleSessionImpl, the string of
+ // session_id will be released, and promise->resolve() will trigger dtor of
+ // WebContentDecryptionModuleSessionImpl, so never use session_id after
+ // promise->resolve()
+ LOG(INFO) << "Resolve promise for session id: " << js_session_id;
ResolveCdmPromise(promise.get());
- task_runner_->PostTask(FROM_HERE,
- base::BindOnce(session_closed_cb_, js_session_id,
- CdmSessionClosedReason::kClose));
- onKeyStatusesChange(ieme_session_id);
}
void IEMEDrmBridge::RemoveSession(