Bug 1522547 - Log `this` in ChromiumCDMProxy logs, use PRIu32 where appropriate. r=cpearce

Because multiple ChromiumCDMProxy object may exist during a browser lifetime,
logging the value of `this` in their logs is useful for disambiguating log
statements, as well as matching ChromiumCDMProxy objects to pointers held by
other objects.

Update formatter usage in logs to prefer PRIu32 over %u when the underlying type
is uint32_t.

Differential Revision: https://phabricator.services.mozilla.com/D21980

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Bryce Van Dyk 2019-03-05 16:21:24 +00:00
Родитель b1ba8b40cb
Коммит 8878cd41d3
1 изменённых файлов: 39 добавлений и 27 удалений

Просмотреть файл

@ -43,11 +43,12 @@ void ChromiumCDMProxy::Init(PromiseId aPromiseId, const nsAString& aOrigin,
NS_ENSURE_TRUE_VOID(!mKeys.IsNull());
EME_LOG(
"ChromiumCDMProxy::Init (pid=%u, origin=%s, topLevelOrigin=%s, gmp=%s)",
aPromiseId, NS_ConvertUTF16toUTF8(aOrigin).get(),
NS_ConvertUTF16toUTF8(aTopLevelOrigin).get(),
NS_ConvertUTF16toUTF8(aGMPName).get());
EME_LOG("ChromiumCDMProxy::Init(this=%p, pid=%" PRIu32
", origin=%s, topLevelOrigin=%s, "
"gmp=%s)",
this, aPromiseId, NS_ConvertUTF16toUTF8(aOrigin).get(),
NS_ConvertUTF16toUTF8(aTopLevelOrigin).get(),
NS_ConvertUTF16toUTF8(aGMPName).get());
if (!mGMPThread) {
RejectPromise(
@ -117,8 +118,9 @@ void ChromiumCDMProxy::Init(PromiseId aPromiseId, const nsAString& aOrigin,
}
void ChromiumCDMProxy::OnCDMCreated(uint32_t aPromiseId) {
EME_LOG("ChromiumCDMProxy::OnCDMCreated(pid=%u) isMainThread=%d this=%p",
aPromiseId, NS_IsMainThread(), this);
EME_LOG("ChromiumCDMProxy::OnCDMCreated(this=%p, pid=%" PRIu32
") isMainThread=%d",
this, aPromiseId, NS_IsMainThread());
if (!NS_IsMainThread()) {
mMainThread->Dispatch(NewRunnableMethod<PromiseId>(
@ -179,10 +181,12 @@ void ChromiumCDMProxy::CreateSession(uint32_t aCreateSessionToken,
const nsAString& aInitDataType,
nsTArray<uint8_t>& aInitData) {
MOZ_ASSERT(NS_IsMainThread());
EME_LOG(
"ChromiumCDMProxy::CreateSession(token=%u, type=%d, pid=%u) "
"initDataLen=%zu",
aCreateSessionToken, (int)aSessionType, aPromiseId, aInitData.Length());
EME_LOG("ChromiumCDMProxy::CreateSession(this=%p, token=%" PRIu32
", type=%d, pid=%" PRIu32
") "
"initDataLen=%zu",
this, aCreateSessionToken, (int)aSessionType, aPromiseId,
aInitData.Length());
uint32_t sessionType = ToCDMSessionType(aSessionType);
uint32_t initDataType = ToCDMInitDataType(aInitDataType);
@ -222,8 +226,9 @@ void ChromiumCDMProxy::LoadSession(PromiseId aPromiseId,
void ChromiumCDMProxy::SetServerCertificate(PromiseId aPromiseId,
nsTArray<uint8_t>& aCert) {
MOZ_ASSERT(NS_IsMainThread());
EME_LOG("ChromiumCDMProxy::SetServerCertificate(pid=%u) certLen=%zu",
aPromiseId, aCert.Length());
EME_LOG("ChromiumCDMProxy::SetServerCertificate(this=%p, pid=%" PRIu32
") certLen=%zu",
this, aPromiseId, aCert.Length());
RefPtr<gmp::ChromiumCDMParent> cdm = GetCDMParent();
if (!cdm) {
@ -242,8 +247,10 @@ void ChromiumCDMProxy::UpdateSession(const nsAString& aSessionId,
PromiseId aPromiseId,
nsTArray<uint8_t>& aResponse) {
MOZ_ASSERT(NS_IsMainThread());
EME_LOG("ChromiumCDMProxy::UpdateSession(sid='%s', pid=%u) responseLen=%zu",
NS_ConvertUTF16toUTF8(aSessionId).get(), aPromiseId,
EME_LOG("ChromiumCDMProxy::UpdateSession(this=%p, sid='%s', pid=%" PRIu32
") "
"responseLen=%zu",
this, NS_ConvertUTF16toUTF8(aSessionId).get(), aPromiseId,
aResponse.Length());
RefPtr<gmp::ChromiumCDMParent> cdm = GetCDMParent();
@ -262,8 +269,8 @@ void ChromiumCDMProxy::UpdateSession(const nsAString& aSessionId,
void ChromiumCDMProxy::CloseSession(const nsAString& aSessionId,
PromiseId aPromiseId) {
MOZ_ASSERT(NS_IsMainThread());
EME_LOG("ChromiumCDMProxy::CloseSession(sid='%s', pid=%u)",
NS_ConvertUTF16toUTF8(aSessionId).get(), aPromiseId);
EME_LOG("ChromiumCDMProxy::CloseSession(this=%p, sid='%s', pid=%" PRIu32 ")",
this, NS_ConvertUTF16toUTF8(aSessionId).get(), aPromiseId);
RefPtr<gmp::ChromiumCDMParent> cdm = GetCDMParent();
if (!cdm) {
@ -280,8 +287,8 @@ void ChromiumCDMProxy::CloseSession(const nsAString& aSessionId,
void ChromiumCDMProxy::RemoveSession(const nsAString& aSessionId,
PromiseId aPromiseId) {
MOZ_ASSERT(NS_IsMainThread());
EME_LOG("ChromiumCDMProxy::RemoveSession(sid='%s', pid=%u)",
NS_ConvertUTF16toUTF8(aSessionId).get(), aPromiseId);
EME_LOG("ChromiumCDMProxy::RemoveSession(this=%p, sid='%s', pid=%" PRIu32 ")",
this, NS_ConvertUTF16toUTF8(aSessionId).get(), aPromiseId);
RefPtr<gmp::ChromiumCDMParent> cdm = GetCDMParent();
if (!cdm) {
@ -297,7 +304,7 @@ void ChromiumCDMProxy::RemoveSession(const nsAString& aSessionId,
void ChromiumCDMProxy::Shutdown() {
MOZ_ASSERT(NS_IsMainThread());
EME_LOG("ChromiumCDMProxy::Shutdown()");
EME_LOG("ChromiumCDMProxy::Shutdown(this=%p)", this);
mKeys.Clear();
RefPtr<gmp::ChromiumCDMParent> cdm;
{
@ -324,8 +331,10 @@ void ChromiumCDMProxy::RejectPromise(PromiseId aId, nsresult aCode,
NS_DISPATCH_NORMAL);
return;
}
EME_LOG("ChromiumCDMProxy::RejectPromise(pid=%u, code=0x%x, reason='%s')",
aId, static_cast<uint32_t>(aCode), aReason.get());
EME_LOG("ChromiumCDMProxy::RejectPromise(this=%p, pid=%" PRIu32
", code=0x%x, "
"reason='%s')",
this, aId, static_cast<uint32_t>(aCode), aReason.get());
if (!mKeys.IsNull()) {
mKeys->RejectPromise(aId, aCode, aReason);
}
@ -340,7 +349,8 @@ void ChromiumCDMProxy::ResolvePromise(PromiseId aId) {
return;
}
EME_LOG("ChromiumCDMProxy::ResolvePromise(pid=%u)", aId);
EME_LOG("ChromiumCDMProxy::ResolvePromise(this=%p, pid=%" PRIu32 ")", this,
aId);
if (!mKeys.IsNull()) {
mKeys->ResolvePromise(aId);
} else {
@ -353,8 +363,9 @@ const nsCString& ChromiumCDMProxy::GetNodeId() const { return mNodeId; }
void ChromiumCDMProxy::OnSetSessionId(uint32_t aCreateSessionToken,
const nsAString& aSessionId) {
MOZ_ASSERT(NS_IsMainThread());
EME_LOG("ChromiumCDMProxy::OnSetSessionId(token=%u, sid='%s')",
aCreateSessionToken, NS_ConvertUTF16toUTF8(aSessionId).get());
EME_LOG("ChromiumCDMProxy::OnSetSessionId(this=%p, token=%" PRIu32
", sid='%s')",
this, aCreateSessionToken, NS_ConvertUTF16toUTF8(aSessionId).get());
if (mKeys.IsNull()) {
return;
@ -485,8 +496,9 @@ RefPtr<DecryptPromise> ChromiumCDMProxy::Decrypt(MediaRawData* aSample) {
void ChromiumCDMProxy::GetStatusForPolicy(PromiseId aPromiseId,
const nsAString& aMinHdcpVersion) {
MOZ_ASSERT(NS_IsMainThread());
EME_LOG("ChromiumCDMProxy::GetStatusForPolicy(pid=%u) minHdcpVersion=%s",
aPromiseId, NS_ConvertUTF16toUTF8(aMinHdcpVersion).get());
EME_LOG("ChromiumCDMProxy::GetStatusForPolicy(this=%p, pid=%" PRIu32
") minHdcpVersion=%s",
this, aPromiseId, NS_ConvertUTF16toUTF8(aMinHdcpVersion).get());
RefPtr<gmp::ChromiumCDMParent> cdm = GetCDMParent();
if (!cdm) {