Bug 1260908 - Allow keyed histograms to accumulate early in startup (r=gfritzsche)

This commit is contained in:
Bill McCloskey 2016-03-30 15:25:18 -07:00
Родитель 683c7a418e
Коммит 2471ddff5c
1 изменённых файлов: 8 добавлений и 1 удалений

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

@ -703,6 +703,7 @@ class TelemetryImpl final
public:
void InitMemoryReporter();
static bool IsInitialized();
static bool CanRecordBase();
static bool CanRecordExtended();
static already_AddRefed<nsITelemetry> CreateTelemetryInstance();
@ -3309,6 +3310,12 @@ TelemetryImpl::SetCanRecordBase(bool canRecord) {
return NS_OK;
}
/* static */ bool
TelemetryImpl::IsInitialized()
{
return sTelemetry;
}
/**
* Indicates if Telemetry can record base data (FHR data). This is true if the
* FHR data reporting service or self-support are enabled.
@ -3902,7 +3909,7 @@ Accumulate(ID aHistogram, uint32_t aSample)
void
Accumulate(ID aID, const nsCString& aKey, uint32_t aSample)
{
if (!TelemetryImpl::CanRecordBase()) {
if (!TelemetryImpl::IsInitialized() || !TelemetryImpl::CanRecordBase()) {
return;
}
const TelemetryHistogram& th = gHistograms[aID];