Bug 1991458. a=pascalc

Original Revision: https://phabricator.services.mozilla.com/D267389

Differential Revision: https://phabricator.services.mozilla.com/D268695
This commit is contained in:
Timothy Nikkel
2025-10-20 07:45:32 +00:00
committed by pchevrel@mozilla.com
parent 19a6662a64
commit 39315e05a8

View File

@@ -198,7 +198,9 @@ class CrashStatsLogForwarder : public mozilla::gfx::LogForwarder {
private: private:
// Helper for the Log() // Helper for the Log()
void UpdateCrashReport(); void UpdateCrashReport(const MutexAutoLock& aProofOfLock);
bool UpdateStringsVectorInternal(const std::string& aString,
const MutexAutoLock& aProofOfLock);
private: private:
LoggingRecord mBuffer; LoggingRecord mBuffer;
@@ -227,6 +229,12 @@ LoggingRecord CrashStatsLogForwarder::LoggingRecordCopy() {
} }
bool CrashStatsLogForwarder::UpdateStringsVector(const std::string& aString) { bool CrashStatsLogForwarder::UpdateStringsVector(const std::string& aString) {
MutexAutoLock lock(mMutex);
return UpdateStringsVectorInternal(aString, lock);
}
bool CrashStatsLogForwarder::UpdateStringsVectorInternal(
const std::string& aString, const MutexAutoLock& aProofOfLock) {
// We want at least the first one and the last one. Otherwise, no point. // We want at least the first one and the last one. Otherwise, no point.
if (mMaxCapacity < 2) { if (mMaxCapacity < 2) {
return false; return false;
@@ -254,7 +262,8 @@ bool CrashStatsLogForwarder::UpdateStringsVector(const std::string& aString) {
return true; return true;
} }
void CrashStatsLogForwarder::UpdateCrashReport() { void CrashStatsLogForwarder::UpdateCrashReport(
const MutexAutoLock& aProofOfLock) {
std::stringstream message; std::stringstream message;
std::string logAnnotation; std::string logAnnotation;
@@ -321,8 +330,8 @@ void CrashStatsLogForwarder::Log(const std::string& aString) {
PROFILER_MARKER_TEXT("gfx::CriticalError", GRAPHICS, {}, PROFILER_MARKER_TEXT("gfx::CriticalError", GRAPHICS, {},
nsDependentCString(aString.c_str())); nsDependentCString(aString.c_str()));
if (UpdateStringsVector(aString)) { if (UpdateStringsVectorInternal(aString, lock)) {
UpdateCrashReport(); UpdateCrashReport(lock);
} }
// Add it to the parent strings // Add it to the parent strings