From b37b90faa362d5ee6d55be204e2b6bbdb1c19fa9 Mon Sep 17 00:00:00 2001 From: Vladan Djeric Date: Fri, 31 Aug 2012 15:20:20 -0400 Subject: [PATCH] Bug 778671: Fix two crashes in Telemetry. r=espindola --- toolkit/components/telemetry/Telemetry.cpp | 10 +++------- xpcom/build/nsXPComInit.cpp | 4 ++-- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index 8829849ab1a..cce1317c47a 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -1395,8 +1395,7 @@ TelemetryImpl::RecordSlowStatement(const nsACString &sql, const nsACString &dbName, uint32_t delay) { - MOZ_ASSERT(sTelemetry); - if (!sTelemetry->mCanRecord) + if (!sTelemetry || !sTelemetry->mCanRecord) return; nsCAutoString fullSQL(sql); @@ -1421,10 +1420,8 @@ void TelemetryImpl::RecordChromeHang(uint32_t duration, Telemetry::ProcessedStack &aStack) { - MOZ_ASSERT(sTelemetry); - if (!sTelemetry->mCanRecord) { + if (!sTelemetry || !sTelemetry->mCanRecord) return; - } MutexAutoLock hangReportMutex(sTelemetry->mHangReportsMutex); @@ -1432,8 +1429,7 @@ TelemetryImpl::RecordChromeHang(uint32_t duration, if (sTelemetry->mHangReports.Length()) { Telemetry::ProcessedStack &firstStack = sTelemetry->mHangReports[0].mStack; - const uint32_t moduleCount = aStack.GetNumModules(); - for (size_t i = 0; i < moduleCount; ++i) { + for (size_t i = 0; i < aStack.GetNumModules(); ++i) { const Telemetry::ProcessedStack::Module &module = aStack.GetModule(i); if (firstStack.HasModule(module)) { aStack.RemoveModule(i); diff --git a/xpcom/build/nsXPComInit.cpp b/xpcom/build/nsXPComInit.cpp index b7d44460f72..8a86fd52cd0 100644 --- a/xpcom/build/nsXPComInit.cpp +++ b/xpcom/build/nsXPComInit.cpp @@ -504,10 +504,10 @@ NS_InitXPCOM2(nsIServiceManager* *result, mozilla::MapsMemoryReporter::Init(); - mozilla::HangMonitor::Startup(); - mozilla::Telemetry::Init(); + mozilla::HangMonitor::Startup(); + mozilla::eventtracer::Init(); return NS_OK;