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
Родитель 36f6594d00
Коммит bbc40e0f54
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -684,6 +684,10 @@ internal_HistogramAddCategorical(mozilla::Telemetry::ID id, const nsCString& lab
void void
internal_HistogramClear(Histogram& aHistogram, bool onlySubsession) internal_HistogramClear(Histogram& aHistogram, bool onlySubsession)
{ {
MOZ_ASSERT(XRE_IsParentProcess());
if (!XRE_IsParentProcess()) {
return;
}
if (!onlySubsession) { if (!onlySubsession) {
aHistogram.Clear(); aHistogram.Clear();
} }
@ -1023,6 +1027,10 @@ KeyedHistogram::Add(const nsCString& key, uint32_t sample)
void void
KeyedHistogram::Clear(bool onlySubsession) KeyedHistogram::Clear(bool onlySubsession)
{ {
MOZ_ASSERT(XRE_IsParentProcess());
if (!XRE_IsParentProcess()) {
return;
}
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID) #if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
for (auto iter = mSubsessionMap.Iter(); !iter.Done(); iter.Next()) { for (auto iter = mSubsessionMap.Iter(); !iter.Done(); iter.Next()) {
iter.Get()->mData->Clear(); iter.Get()->mData->Clear();