diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:50 +0000 |
commit | def92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch) | |
tree | 2ef34b9ad8bb9a9220e05d60352558b15f513894 /dom/ipc/MMPrinter.cpp | |
parent | Adding debian version 125.0.3-1. (diff) | |
download | firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/ipc/MMPrinter.cpp')
-rw-r--r-- | dom/ipc/MMPrinter.cpp | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/dom/ipc/MMPrinter.cpp b/dom/ipc/MMPrinter.cpp index be2911341a..796b4fbeb3 100644 --- a/dom/ipc/MMPrinter.cpp +++ b/dom/ipc/MMPrinter.cpp @@ -26,8 +26,8 @@ LazyLogModule MMPrinter::sMMLog("MessageManager"); // the output of the logs into logs more friendly to reading. /* static */ -void MMPrinter::PrintImpl(char const* aLocation, const nsAString& aMsg, - ClonedMessageData const& aData) { +Maybe<uint64_t> MMPrinter::PrintHeader(char const* aLocation, + const nsAString& aMsg) { NS_ConvertUTF16toUTF8 charMsg(aMsg); /* @@ -43,15 +43,29 @@ void MMPrinter::PrintImpl(char const* aLocation, const nsAString& aMsg, char* mmSkipLog = PR_GetEnv("MOZ_LOG_MESSAGEMANAGER_SKIP"); if (mmSkipLog && strstr(mmSkipLog, charMsg.get())) { - return; + return Nothing(); } - uint64_t msg_id = RandomUint64OrDie(); + uint64_t aMsgId = RandomUint64OrDie(); MOZ_LOG(MMPrinter::sMMLog, LogLevel::Debug, - ("%" PRIu64 " %s Message: %s in process type: %s", msg_id, aLocation, + ("%" PRIu64 " %s Message: %s in process type: %s", aMsgId, aLocation, charMsg.get(), XRE_GetProcessTypeString())); + return Some(aMsgId); +} + +/* static */ +void MMPrinter::PrintNoData(uint64_t aMsgId) { + if (!MOZ_LOG_TEST(sMMLog, LogLevel::Verbose)) { + return; + } + MOZ_LOG(MMPrinter::sMMLog, LogLevel::Verbose, + ("%" PRIu64 " (No Data)", aMsgId)); +} + +/* static */ +void MMPrinter::PrintData(uint64_t aMsgId, ClonedMessageData const& aData) { if (!MOZ_LOG_TEST(sMMLog, LogLevel::Verbose)) { return; } @@ -75,8 +89,7 @@ void MMPrinter::PrintImpl(char const* aLocation, const nsAString& aMsg, if (rv.Failed()) { // In testing, the only reason this would fail was if there was no data in // the message; so it seems like this is safe-ish. - MOZ_LOG(MMPrinter::sMMLog, LogLevel::Verbose, - ("%" PRIu64 " (No Data)", msg_id)); + MMPrinter::PrintNoData(aMsgId); rv.SuppressException(); return; } @@ -86,7 +99,7 @@ void MMPrinter::PrintImpl(char const* aLocation, const nsAString& aMsg, if (!srcString.init(cx, unevalObj)) return; MOZ_LOG(MMPrinter::sMMLog, LogLevel::Verbose, - ("%" PRIu64 " %s", msg_id, NS_ConvertUTF16toUTF8(srcString).get())); + ("%" PRIu64 " %s", aMsgId, NS_ConvertUTF16toUTF8(srcString).get())); } } // namespace mozilla::dom |