From 5f4a7a2a872dc15c9d02e5a583e3cd5b2b6cf674 Mon Sep 17 00:00:00 2001 From: Harveer Singh Date: Fri, 13 May 2022 07:08:21 +0000 Subject: [PATCH] Bug 1735124: Start the sequence number in QM_TRY logging at 1. r=jstutte Differential Revision: https://phabricator.services.mozilla.com/D146250 --- dom/quota/QuotaCommon.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dom/quota/QuotaCommon.cpp b/dom/quota/QuotaCommon.cpp index d8eb7a761cc2..21e73d1ca355 100644 --- a/dom/quota/QuotaCommon.cpp +++ b/dom/quota/QuotaCommon.cpp @@ -533,16 +533,19 @@ void LogError(const nsACString& aExpr, const Maybe aMaybeRv, // This would be initialized once, all subsequent calls would be a no-op. MOZ_ALWAYS_TRUE(sSequenceNumber.init()); - const auto currSeqNum = sSequenceNumber.get(); + // sequence number should always starts at number 1. + // `sSequenceNumber` gets initialized to 0; so we have to increment here. + const auto newSeqNum = sSequenceNumber.get() + 1; const auto threadId = mozilla::baseprofiler::profiler_current_thread_id().ToNumber(); + const auto threadIdAndSequence = - (static_cast(threadId) << 32) | (currSeqNum & 0xFFFFFFFF); + (static_cast(threadId) << 32) | (newSeqNum & 0xFFFFFFFF); res.AppendElement( EventExtraEntry{"seq"_ns, IntToCString(threadIdAndSequence)}); - sSequenceNumber.set(currSeqNum + 1); + sSequenceNumber.set(newSeqNum); res.AppendElement(EventExtraEntry{"severity"_ns, severityString});