bug 1218576 - Assert we're the parent process when clearing histograms. r=gfritzsche
☠☠ backed out by 1530103e032c ☠ ☠
authorChris H-C <chutten@mozilla.com>
Tue, 05 Jul 2016 09:51:49 -0400
changeset 313000 3caacb5c213b
parent 312999 c68fc5ad5ecf
child 313001 ce2a2dabb042
push id20479
push userkwierso@gmail.com
push dateThu, 08 Sep 2016 01:08:46 +0000
treeherderfx-team@fb7c6b034329 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1218576
milestone51.0a1
bug 1218576 - Assert we're the parent process when clearing histograms. r=gfritzsche Clear isn't generally called at all, and isn't dispatched to the parent process for child telemetry aggregation. Clear should only be called on the parent process. MozReview-Commit-ID: stIutvAO6h
toolkit/components/telemetry/TelemetryHistogram.cpp
--- a/toolkit/components/telemetry/TelemetryHistogram.cpp
+++ b/toolkit/components/telemetry/TelemetryHistogram.cpp
@@ -679,16 +679,20 @@ internal_HistogramAddCategorical(mozilla
   }
 
   return internal_HistogramAdd(*h, labelId);
 }
 
 void
 internal_HistogramClear(Histogram& aHistogram, bool onlySubsession)
 {
+  MOZ_ASSERT(XRE_IsParentProcess());
+  if (!XRE_IsParentProcess()) {
+    return;
+  }
   if (!onlySubsession) {
     aHistogram.Clear();
   }
 
 #if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
   if (Histogram* subsession = internal_GetSubsessionHistogram(aHistogram)) {
     subsession->Clear();
   }
@@ -1018,16 +1022,20 @@ KeyedHistogram::Add(const nsCString& key
   subsession->Add(sample);
 #endif
   return NS_OK;
 }
 
 void
 KeyedHistogram::Clear(bool onlySubsession)
 {
+  MOZ_ASSERT(XRE_IsParentProcess());
+  if (!XRE_IsParentProcess()) {
+    return;
+  }
 #if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
   for (auto iter = mSubsessionMap.Iter(); !iter.Done(); iter.Next()) {
     iter.Get()->mData->Clear();
   }
   mSubsessionMap.Clear();
   if (onlySubsession) {
     return;
   }