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
This commit is contained in:
Chris H-C 2016-08-16 12:41:00 +07:00
parent 36f6594d00
commit bbc40e0f54

View File

@ -684,6 +684,10 @@ internal_HistogramAddCategorical(mozilla::Telemetry::ID id, const nsCString& lab
void
internal_HistogramClear(Histogram& aHistogram, bool onlySubsession)
{
MOZ_ASSERT(XRE_IsParentProcess());
if (!XRE_IsParentProcess()) {
return;
}
if (!onlySubsession) {
aHistogram.Clear();
}
@ -1023,6 +1027,10 @@ KeyedHistogram::Add(const nsCString& key, uint32_t sample)
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();