Commit 5e3c0b62 authored by Xiaohan Wang's avatar Xiaohan Wang Committed by Commit Bot

media: Rename WebContentDecryptionModuleSession::Client methods

Close() is confusing as people might relate to MediaKeySession::close().
Also, the current names are not consistent with what we use in other
parts of the stack, making code search harder.

This CL renames the methods to make it consistent with what use
everywhere else.

Tbr: dcheng@chromium.org
Change-Id: Ia9dd8c17ac11b9276efc0f4133f6002dea2a524c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2277339Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarJohn Rummell <jrummell@chromium.org>
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786342}
parent d641ed9b
......@@ -450,8 +450,8 @@ void WebContentDecryptionModuleSessionImpl::OnSessionMessage(
const std::vector<uint8_t>& message) {
DCHECK(client_) << "Client not set before message event";
DCHECK(thread_checker_.CalledOnValidThread());
client_->Message(convertMessageType(message_type), message.data(),
message.size());
client_->OnSessionMessage(convertMessageType(message_type), message.data(),
message.size());
}
void WebContentDecryptionModuleSessionImpl::OnSessionKeysChange(
......@@ -473,7 +473,7 @@ void WebContentDecryptionModuleSessionImpl::OnSessionKeysChange(
}
// Now send the event to blink.
client_->KeysStatusesChange(keys, has_additional_usable_key);
client_->OnSessionKeysChange(keys, has_additional_usable_key);
}
void WebContentDecryptionModuleSessionImpl::OnSessionExpirationUpdate(
......@@ -481,9 +481,9 @@ void WebContentDecryptionModuleSessionImpl::OnSessionExpirationUpdate(
DCHECK(thread_checker_.CalledOnValidThread());
// The check works around an issue in base::Time that converts null base::Time
// to |1601-01-01 00:00:00 UTC| in ToJsTime(). See http://crbug.com/679079
client_->ExpirationChanged(new_expiry_time.is_null()
? std::numeric_limits<double>::quiet_NaN()
: new_expiry_time.ToJsTime());
client_->OnSessionExpirationUpdate(
new_expiry_time.is_null() ? std::numeric_limits<double>::quiet_NaN()
: new_expiry_time.ToJsTime());
}
void WebContentDecryptionModuleSessionImpl::OnSessionClosed() {
......@@ -494,7 +494,7 @@ void WebContentDecryptionModuleSessionImpl::OnSessionClosed() {
return;
is_closed_ = true;
client_->Close();
client_->OnSessionClosed();
}
void WebContentDecryptionModuleSessionImpl::OnSessionInitialized(
......
......@@ -57,22 +57,23 @@ class BLINK_PLATFORM_EXPORT WebContentDecryptionModuleSession {
kIndividualizationRequest
};
virtual void Message(MessageType,
const unsigned char* message,
size_t message_length) = 0;
virtual void Close() = 0;
virtual void OnSessionMessage(MessageType,
const unsigned char* message,
size_t message_length) = 0;
virtual void OnSessionClosed() = 0;
// Called when the expiration time for the session changes.
// |updated_expiry_time_in_ms| is specified as the number of milliseconds
// since 01 January, 1970 UTC.
virtual void ExpirationChanged(double updated_expiry_time_in_ms) = 0;
virtual void OnSessionExpirationUpdate(
double updated_expiry_time_in_ms) = 0;
// Called when the set of keys for this session changes or existing keys
// change state. |has_additional_usable_key| is set if a key is newly
// usable (e.g. new key available, previously expired key has been
// renewed, etc.) and the browser should attempt to resume playback
// if necessary.
virtual void KeysStatusesChange(
virtual void OnSessionKeysChange(
const WebVector<WebEncryptedMediaKeyInformation>&,
bool has_additional_usable_key) = 0;
......
......@@ -847,9 +847,9 @@ void MediaKeySession::ActionTimerFired(TimerBase*) {
}
// Queue a task to fire a simple event named keymessage at the new object.
void MediaKeySession::Message(MessageType message_type,
const unsigned char* message,
size_t message_length) {
void MediaKeySession::OnSessionMessage(MessageType message_type,
const unsigned char* message,
size_t message_length) {
DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")";
// Verify that 'message' not fired before session initialization is complete.
......@@ -891,7 +891,7 @@ void MediaKeySession::Message(MessageType message_type,
async_event_queue_->EnqueueEvent(FROM_HERE, *event);
}
void MediaKeySession::Close() {
void MediaKeySession::OnSessionClosed() {
// 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
......@@ -911,10 +911,10 @@ void MediaKeySession::Close() {
// 5. Run the Update Key Statuses algorithm on the session, providing
// an empty sequence.
KeysStatusesChange(WebVector<WebEncryptedMediaKeyInformation>(), false);
OnSessionKeysChange(WebVector<WebEncryptedMediaKeyInformation>(), false);
// 6. Run the Update Expiration algorithm on the session, providing NaN.
ExpirationChanged(std::numeric_limits<double>::quiet_NaN());
OnSessionExpirationUpdate(std::numeric_limits<double>::quiet_NaN());
// 7. Resolve promise.
closed_promise_->ResolveWithUndefined();
......@@ -936,7 +936,8 @@ void MediaKeySession::Close() {
}
}
void MediaKeySession::ExpirationChanged(double updated_expiry_time_in_ms) {
void MediaKeySession::OnSessionExpirationUpdate(
double updated_expiry_time_in_ms) {
DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL)
<< __func__ << "(" << this << ") " << updated_expiry_time_in_ms;
......@@ -955,7 +956,7 @@ void MediaKeySession::ExpirationChanged(double updated_expiry_time_in_ms) {
expiration_ = expiration_time;
}
void MediaKeySession::KeysStatusesChange(
void MediaKeySession::OnSessionKeysChange(
const WebVector<WebEncryptedMediaKeyInformation>& keys,
bool has_additional_usable_key) {
DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL)
......
......@@ -131,13 +131,13 @@ class MediaKeySession final
void RemoveTask(ContentDecryptionModuleResult*);
// WebContentDecryptionModuleSession::Client
void Message(MessageType,
const unsigned char* message,
size_t message_length) override;
void Close() override;
void ExpirationChanged(double updated_expiry_time_in_ms) override;
void KeysStatusesChange(const WebVector<WebEncryptedMediaKeyInformation>&,
bool has_additional_usable_key) override;
void OnSessionMessage(MessageType,
const unsigned char* message,
size_t message_length) override;
void OnSessionClosed() override;
void OnSessionExpirationUpdate(double updated_expiry_time_in_ms) override;
void OnSessionKeysChange(const WebVector<WebEncryptedMediaKeyInformation>&,
bool has_additional_usable_key) override;
Member<EventQueue> async_event_queue_;
std::unique_ptr<WebContentDecryptionModuleSession> session_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment