Bug 1498166 - Use fully-qualified name for histogram storage r=chutten
authorJan-Erik Rediger <jrediger@mozilla.com>
Mon, 19 Nov 2018 13:00:53 +0000
changeset 503881 b362f996a039cd46e06787cacc5b395a4491633b
parent 503880 20aac72d781ba237d8419c752a009d689b93889b
child 503882 137130a36a2264710b41e8e38cdbb242e7dcf78c
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten
bugs1498166
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1498166 - Use fully-qualified name for histogram storage r=chutten This is a preparation for the following introduction of a new wrapper type by that name, making it more explicit which class we're handling Differential Revision: https://phabricator.services.mozilla.com/D11904
toolkit/components/telemetry/core/TelemetryHistogram.cpp
--- a/toolkit/components/telemetry/core/TelemetryHistogram.cpp
+++ b/toolkit/components/telemetry/core/TelemetryHistogram.cpp
@@ -25,17 +25,16 @@
 #include "nsTHashtable.h"
 #include "nsHashKeys.h"
 #include "nsITelemetry.h"
 #include "nsPrintfCString.h"
 #include "TelemetryCommon.h"
 #include "TelemetryHistogramNameMap.h"
 #include "TelemetryScalar.h"
 
-using base::Histogram;
 using base::BooleanHistogram;
 using base::CountHistogram;
 using base::FlagHistogram;
 using base::LinearHistogram;
 using mozilla::MakeTuple;
 using mozilla::StaticMutexNotRecorded;
 using mozilla::StaticMutexAutoLock;
 using mozilla::Telemetry::HistogramAccumulation;
@@ -154,19 +153,19 @@ struct HistogramInfo {
   const char *expiration() const;
   nsresult label_id(const char* label, uint32_t* labelId) const;
   bool allows_key(const nsACString& key) const;
 };
 
 // Structs used to keep information about the histograms for which a
 // snapshot should be created.
 struct HistogramSnapshotData {
-  nsTArray<Histogram::Sample> mBucketRanges;
-  nsTArray<Histogram::Count> mBucketCounts;
-  int64_t mSampleSum; // Same type as Histogram::SampleSet::sum_
+  nsTArray<base::Histogram::Sample> mBucketRanges;
+  nsTArray<base::Histogram::Count> mBucketCounts;
+  int64_t mSampleSum; // Same type as base::Histogram::SampleSet::sum_
 };
 
 struct HistogramSnapshotInfo {
   HistogramSnapshotData data;
   HistogramID histogramID;
 };
 
 typedef mozilla::Vector<HistogramSnapshotInfo> HistogramSnapshotsArray;
@@ -182,18 +181,18 @@ struct KeyedHistogramSnapshotInfo {
 
 typedef mozilla::Vector<KeyedHistogramSnapshotInfo> KeyedHistogramSnapshotsArray;
 typedef mozilla::Vector<KeyedHistogramSnapshotsArray> KeyedHistogramProcessSnapshotsArray;
 
 class KeyedHistogram {
 public:
   KeyedHistogram(HistogramID id, const HistogramInfo& info, bool expired);
   ~KeyedHistogram();
-  nsresult GetHistogram(const nsCString& name, Histogram** histogram);
-  Histogram* GetHistogram(const nsCString& name);
+  nsresult GetHistogram(const nsCString& name, base::Histogram** histogram);
+  base::Histogram* GetHistogram(const nsCString& name);
   uint32_t GetHistogramType() const { return mHistogramInfo.histogramType; }
   nsresult GetKeys(const StaticMutexAutoLock& aLock, nsTArray<nsCString>& aKeys);
   // Note: unlike other methods, GetJSSnapshot is thread safe.
   nsresult GetJSSnapshot(JSContext* cx, JS::Handle<JSObject*> obj,
                          bool clearSubsession);
   nsresult GetSnapshot(const StaticMutexAutoLock& aLock,
                        KeyedHistogramSnapshotData& aSnapshot, bool aClearSubsession);
 
@@ -204,17 +203,17 @@ public:
 
   bool IsEmpty() const { return mHistogramMap.IsEmpty(); }
 
   bool IsExpired() const { return mIsExpired; }
 
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf);
 
 private:
-  typedef nsBaseHashtableET<nsCStringHashKey, Histogram*> KeyedHistogramEntry;
+  typedef nsBaseHashtableET<nsCStringHashKey, base::Histogram*> KeyedHistogramEntry;
   typedef AutoHashtable<KeyedHistogramEntry> KeyedHistogramMapType;
   KeyedHistogramMapType mHistogramMap;
 
   const HistogramID mId;
   const HistogramInfo& mHistogramInfo;
   bool mIsExpired;
 };
 
@@ -233,22 +232,22 @@ bool gInitDone = false;
 
 // Whether we are collecting the base, opt-out, Histogram data.
 bool gCanRecordBase = false;
 // Whether we are collecting the extended, opt-in, Histogram data.
 bool gCanRecordExtended = false;
 
 // The storage for actual Histogram instances.
 // We use separate ones for plain and keyed histograms.
-Histogram** gHistogramStorage;
+base::Histogram** gHistogramStorage;
 // Keyed histograms internally map string keys to individual Histogram instances.
 KeyedHistogram** gKeyedHistogramStorage;
 
 // To simplify logic below we use a single histogram instance for all expired histograms.
-Histogram* gExpiredHistogram = nullptr;
+base::Histogram* gExpiredHistogram = nullptr;
 
 // The single placeholder for expired keyed histograms.
 KeyedHistogram* gExpiredKeyedHistogram = nullptr;
 
 // This tracks whether recording is enabled for specific histograms.
 // To utilize C++ initialization rules, we invert the meaning to "disabled".
 bool gHistogramRecordingDisabled[HistogramCount] = {};
 
@@ -298,28 +297,28 @@ size_t internal_HistogramStorageIndex(co
   static_assert(
     HistogramCount <
       std::numeric_limits<size_t>::max() / size_t(ProcessID::Count),
         "Too many histograms and processes to store in a 1D array.");
 
   return aHistogramId * size_t(ProcessID::Count) + size_t(aProcessId);
 }
 
-Histogram* internal_GetHistogramFromStorage(const StaticMutexAutoLock& aLock,
-                                            HistogramID aHistogramId,
-                                            ProcessID aProcessId)
+base::Histogram* internal_GetHistogramFromStorage(const StaticMutexAutoLock& aLock,
+                                                  HistogramID aHistogramId,
+                                                  ProcessID aProcessId)
 {
   size_t index = internal_HistogramStorageIndex(aLock, aHistogramId, aProcessId);
   return gHistogramStorage[index];
 }
 
 void internal_SetHistogramInStorage(const StaticMutexAutoLock& aLock,
                                     HistogramID aHistogramId,
                                     ProcessID aProcessId,
-                                    Histogram* aHistogram)
+                                    base::Histogram* aHistogram)
 {
   MOZ_ASSERT(XRE_IsParentProcess(),
     "Histograms are stored only in the parent process.");
 
   size_t index = internal_HistogramStorageIndex(aLock, aHistogramId, aProcessId);
   MOZ_ASSERT(!gHistogramStorage[index],
     "Mustn't overwrite storage without clearing it first.");
   gHistogramStorage[index] = aHistogram;
@@ -341,38 +340,38 @@ void internal_SetKeyedHistogramInStorage
 
   size_t index = internal_KeyedHistogramStorageIndex(aHistogramId, aProcessId);
   MOZ_ASSERT(!gKeyedHistogramStorage[index],
     "Mustn't overwrite storage without clearing it first");
   gKeyedHistogramStorage[index] = aKeyedHistogram;
 }
 
 // Factory function for histogram instances.
-Histogram*
+base::Histogram*
 internal_CreateHistogramInstance(const HistogramInfo& info, int bucketsOffset);
 
 bool
 internal_IsHistogramEnumId(HistogramID aID)
 {
   static_assert(((HistogramID)-1 > 0), "ID should be unsigned.");
   return aID < HistogramCount;
 }
 
 // Look up a plain histogram by id.
-Histogram*
+base::Histogram*
 internal_GetHistogramById(const StaticMutexAutoLock& aLock,
                           HistogramID histogramId,
                           ProcessID processId,
                           bool instantiate = true)
 {
   MOZ_ASSERT(internal_IsHistogramEnumId(histogramId));
   MOZ_ASSERT(!gHistogramInfos[histogramId].keyed);
   MOZ_ASSERT(processId < ProcessID::Count);
 
-  Histogram* h = internal_GetHistogramFromStorage(aLock, histogramId, processId);
+  base::Histogram* h = internal_GetHistogramFromStorage(aLock, histogramId, processId);
   if (h || !instantiate) {
     return h;
   }
 
   const HistogramInfo& info = gHistogramInfos[histogramId];
   const int bucketsOffset = gHistogramBucketLowerBoundIndex[histogramId];
   h = internal_CreateHistogramInstance(info, bucketsOffset);
   MOZ_ASSERT(h);
@@ -477,23 +476,23 @@ internal_AttemptedGPUProcess() {
   if (auto gpm = mozilla::gfx::GPUProcessManager::Get()) {
     attemptedGPUProcess = gpm->AttemptedGPUProcess();
   }
   return attemptedGPUProcess;
 }
 
 // Note: this is completely unrelated to mozilla::IsEmpty.
 bool
-internal_IsEmpty(const StaticMutexAutoLock& aLock, const Histogram *h)
+internal_IsEmpty(const StaticMutexAutoLock& aLock, const base::Histogram *h)
 {
   return h->is_empty();
 }
 
 bool
-internal_IsExpired(const StaticMutexAutoLock& aLock, Histogram* h)
+internal_IsExpired(const StaticMutexAutoLock& aLock, base::Histogram* h)
 {
   return h == gExpiredHistogram;
 }
 
 void
 internal_SetHistogramRecordingEnabled(const StaticMutexAutoLock& aLock,
                                       HistogramID id,
                                       bool aEnabled)
@@ -600,17 +599,17 @@ internal_CheckHistogramArguments(const H
     if (info.min < 1) {
       return NS_ERROR_ILLEGAL_VALUE;
     }
   }
 
   return NS_OK;
 }
 
-Histogram*
+base::Histogram*
 internal_CreateHistogramInstance(const HistogramInfo& passedInfo, int bucketsOffset)
 {
   if (NS_FAILED(internal_CheckHistogramArguments(passedInfo))) {
     MOZ_ASSERT(false, "Failed histogram argument checks.");
     return nullptr;
   }
 
   // To keep the code simple we map all the calls to expired histograms to the same histogram instance.
@@ -628,21 +627,21 @@ internal_CreateHistogramInstance(const H
     // expired histograms.
     buckets = gHistogramBucketLowerBounds;
     info.min = 1;
     info.max = 2;
     info.bucketCount = 3;
     info.histogramType = nsITelemetry::HISTOGRAM_LINEAR;
   }
 
-  Histogram::Flags flags = Histogram::kNoFlags;
-  Histogram* h = nullptr;
+  base::Histogram::Flags flags = base::Histogram::kNoFlags;
+  base::Histogram* h = nullptr;
   switch (info.histogramType) {
   case nsITelemetry::HISTOGRAM_EXPONENTIAL:
-    h = Histogram::FactoryGet(info.min, info.max, info.bucketCount, flags, buckets);
+    h = base::Histogram::FactoryGet(info.min, info.max, info.bucketCount, flags, buckets);
     break;
   case nsITelemetry::HISTOGRAM_LINEAR:
   case nsITelemetry::HISTOGRAM_CATEGORICAL:
     h = LinearHistogram::FactoryGet(info.min, info.max, info.bucketCount, flags, buckets);
     break;
   case nsITelemetry::HISTOGRAM_BOOLEAN:
     h = BooleanHistogram::FactoryGet(flags, buckets);
     break;
@@ -661,17 +660,17 @@ internal_CreateHistogramInstance(const H
     gExpiredHistogram = h;
   }
 
   return h;
 }
 
 nsresult
 internal_HistogramAdd(const StaticMutexAutoLock& aLock,
-                      Histogram& histogram,
+                      base::Histogram& histogram,
                       const HistogramID id,
                       uint32_t value,
                       ProcessID aProcessType)
 {
   // Check if we are allowed to record the data.
   bool canRecordDataset = CanRecordDataset(gHistogramInfos[id].dataset,
                                            internal_CanRecordBase(),
                                            internal_CanRecordExtended());
@@ -716,31 +715,31 @@ namespace {
  * Please note that this version does not make use of JS contexts.
  *
  * @param {StaticMutexAutoLock} the proof we hold the mutex.
  * @param {Histogram} the histogram to reflect.
  * @return {nsresult} NS_ERROR_FAILURE if we fail to allocate memory for the snapshot.
  */
 nsresult
 internal_GetHistogramAndSamples(const StaticMutexAutoLock& aLock,
-                                const Histogram *h,
+                                const base::Histogram *h,
                                 HistogramSnapshotData& aSnapshot)
 {
   MOZ_ASSERT(h);
 
   // Convert the ranges of the buckets to a nsTArray.
   const size_t bucketCount = h->bucket_count();
   for (size_t i = 0; i < bucketCount; i++) {
     if (!aSnapshot.mBucketRanges.AppendElement(h->ranges(i))) {
       return NS_ERROR_FAILURE;
     }
   }
 
   // Get a snapshot of the samples.
-  Histogram::SampleSet ss;
+  base::Histogram::SampleSet ss;
   h->SnapshotSample(&ss);
 
   // Get the number of samples in each bucket.
   for (size_t i = 0; i < bucketCount; i++) {
     if (!aSnapshot.mBucketCounts.AppendElement(ss.counts(i))) {
       return NS_ERROR_FAILURE;
     }
   }
@@ -835,17 +834,17 @@ internal_ReflectHistogramAndSamples(JSCo
       return NS_ERROR_FAILURE;
     }
   }
 
   return NS_OK;
 }
 
 bool
-internal_ShouldReflectHistogram(const StaticMutexAutoLock& aLock, Histogram* h, HistogramID id)
+internal_ShouldReflectHistogram(const StaticMutexAutoLock& aLock, base::Histogram* h, HistogramID id)
 {
   // Only flag histograms are serialized when they are empty.
   // This has historical reasons, changing this will require downstream changes.
   // The cheaper path here is to just deprecate flag histograms in favor
   // of scalars.
   uint32_t type = gHistogramInfos[id].histogramType;
   if (internal_IsEmpty(aLock, h) && type != nsITelemetry::HISTOGRAM_FLAG) {
     return false;
@@ -900,17 +899,17 @@ internal_GetHistogramsSnapshot(const Sta
       }
 
       if (!IsInDataset(info.dataset, aDataset)) {
         continue;
       }
 
       bool shouldInstantiate =
         info.histogramType == nsITelemetry::HISTOGRAM_FLAG;
-      Histogram* h = internal_GetHistogramById(aLock, id, ProcessID(process),
+      base::Histogram* h = internal_GetHistogramById(aLock, id, ProcessID(process),
                                                shouldInstantiate);
       if (!h || internal_IsExpired(aLock, h) || !internal_ShouldReflectHistogram(aLock, h, id)) {
         continue;
       }
 
       const char* name = info.name();
       if (aFilterTest && strncmp(TEST_HISTOGRAM_PREFIX, name, strlen(TEST_HISTOGRAM_PREFIX)) == 0) {
         if (aClearSubsession) {
@@ -981,56 +980,56 @@ KeyedHistogram::KeyedHistogram(Histogram
   , mHistogramInfo(info)
   , mIsExpired(expired)
 {
 }
 
 KeyedHistogram::~KeyedHistogram()
 {
   for (auto iter = mHistogramMap.Iter(); !iter.Done(); iter.Next()) {
-    Histogram* h = iter.Get()->mData;
+    base::Histogram* h = iter.Get()->mData;
     if (h == gExpiredHistogram) {
       continue;
     }
     delete h;
   }
   mHistogramMap.Clear();
 }
 
 nsresult
-KeyedHistogram::GetHistogram(const nsCString& key, Histogram** histogram)
+KeyedHistogram::GetHistogram(const nsCString& key, base::Histogram** histogram)
 {
   KeyedHistogramEntry* entry = mHistogramMap.GetEntry(key);
   if (entry) {
     *histogram = entry->mData;
     return NS_OK;
   }
 
   int bucketsOffset = gHistogramBucketLowerBoundIndex[mId];
-  Histogram* h = internal_CreateHistogramInstance(mHistogramInfo, bucketsOffset);
+  base::Histogram* h = internal_CreateHistogramInstance(mHistogramInfo, bucketsOffset);
   if (!h) {
     return NS_ERROR_FAILURE;
   }
 
-  h->ClearFlags(Histogram::kUmaTargetedHistogramFlag);
+  h->ClearFlags(base::Histogram::kUmaTargetedHistogramFlag);
   *histogram = h;
 
   entry = mHistogramMap.PutEntry(key);
   if (MOZ_UNLIKELY(!entry)) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   entry->mData = h;
   return NS_OK;
 }
 
-Histogram*
+base::Histogram*
 KeyedHistogram::GetHistogram(const nsCString& key)
 {
-  Histogram* h = nullptr;
+  base::Histogram* h = nullptr;
   if (NS_FAILED(GetHistogram(key, &h))) {
     return nullptr;
   }
   return h;
 }
 
 nsresult
 KeyedHistogram::Add(const nsCString& key, uint32_t sample,
@@ -1051,17 +1050,17 @@ KeyedHistogram::Add(const nsCString& key
     return NS_OK;
   }
 
   // Don't record if the current platform is not enabled
   if (!CanRecordProduct(gHistogramInfos[mId].products)) {
     return NS_OK;
   }
 
-  Histogram* histogram = GetHistogram(key);
+  base::Histogram* histogram = GetHistogram(key);
   MOZ_ASSERT(histogram);
   if (!histogram) {
     return NS_ERROR_FAILURE;
   }
 
   // The internal representation of a base::Histogram's buckets uses `int`.
   // Clamp large values of `sample` to be INT_MAX so they continue to be treated
   // as large values (instead of negative ones).
@@ -1080,17 +1079,17 @@ void
 KeyedHistogram::Clear()
 {
   MOZ_ASSERT(XRE_IsParentProcess());
   if (!XRE_IsParentProcess()) {
     return;
   }
 
   for (auto iter = mHistogramMap.Iter(); !iter.Done(); iter.Next()) {
-    Histogram* h = iter.Get()->mData;
+    base::Histogram* h = iter.Get()->mData;
     if (h == gExpiredHistogram) {
       continue;
     }
     delete h;
   }
   mHistogramMap.Clear();
 }
 
@@ -1140,17 +1139,17 @@ KeyedHistogram::GetJSSnapshot(JSContext*
 }
 
 nsresult
 KeyedHistogram::GetSnapshot(const StaticMutexAutoLock& aLock,
                             KeyedHistogramSnapshotData& aSnapshot, bool aClearSubsession)
 {
   // Snapshot every key.
   for (auto iter = mHistogramMap.ConstIter(); !iter.Done(); iter.Next()) {
-    Histogram* keyData = iter.Get()->mData;
+    base::Histogram* keyData = iter.Get()->mData;
     if (!keyData) {
       return NS_ERROR_FAILURE;
     }
 
     HistogramSnapshotData keySnapshot;
     if (NS_FAILED(internal_GetHistogramAndSamples(aLock, keyData, keySnapshot))) {
       return NS_ERROR_FAILURE;
     }
@@ -1285,17 +1284,17 @@ internal_RemoteAccumulate(const StaticMu
 
 void internal_Accumulate(const StaticMutexAutoLock& aLock, HistogramID aId, uint32_t aSample)
 {
   if (!internal_CanRecordBase() ||
       internal_RemoteAccumulate(aLock, aId, aSample)) {
     return;
   }
 
-  Histogram *h = internal_GetHistogramById(aLock, aId, ProcessID::Parent);
+  base::Histogram *h = internal_GetHistogramById(aLock, aId, ProcessID::Parent);
   MOZ_ASSERT(h);
   internal_HistogramAdd(aLock, *h, aId, aSample, ProcessID::Parent);
 }
 
 void
 internal_Accumulate(const StaticMutexAutoLock& aLock, HistogramID aId,
                     const nsCString& aKey, uint32_t aSample)
 {
@@ -1314,17 +1313,17 @@ internal_AccumulateChild(const StaticMut
                          ProcessID aProcessType,
                          HistogramID aId,
                          uint32_t aSample)
 {
   if (!internal_CanRecordBase()) {
     return;
   }
 
-  if (Histogram* h = internal_GetHistogramById(aLock, aId, aProcessType)) {
+  if (base::Histogram* h = internal_GetHistogramById(aLock, aId, aProcessType)) {
     internal_HistogramAdd(aLock, *h, aId, aSample, aProcessType);
   } else {
     NS_WARNING("Failed GetHistogramById for CHILD");
   }
 }
 
 void
 internal_AccumulateChildKeyed(const StaticMutexAutoLock& aLock, ProcessID aProcessType,
@@ -1584,17 +1583,17 @@ internal_JSHistogram_Snapshot(JSContext 
   HistogramSnapshotData dataSnapshot;
   {
     StaticMutexAutoLock locker(gTelemetryHistogramMutex);
     MOZ_ASSERT(internal_IsHistogramEnumId(id));
 
     // This is not good standard behavior given that we have histogram instances
     // covering multiple processes.
     // However, changing this requires some broader changes to callers.
-    Histogram* h = internal_GetHistogramById(locker, id, ProcessID::Parent);
+    base::Histogram* h = internal_GetHistogramById(locker, id, ProcessID::Parent);
     // Take a snapshot of the data here, protected by the lock, and then,
     // outside of the lock protection, mirror it to a JS structure
     if (NS_FAILED(internal_GetHistogramAndSamples(locker, h, dataSnapshot))) {
       return false;
     }
   }
 
   JS::Rooted<JSObject*> snapshot(cx, JS_NewPlainObject(cx));
@@ -1781,17 +1780,17 @@ internal_KeyedHistogram_SnapshotImpl(JSC
     return false;
   }
 
   HistogramSnapshotData dataSnapshot;
   {
     StaticMutexAutoLock locker(gTelemetryHistogramMutex);
 
     // Get data for the key we're looking for.
-    Histogram* h = nullptr;
+    base::Histogram* h = nullptr;
     nsresult rv = keyed->GetHistogram(NS_ConvertUTF16toUTF8(key), &h);
     if (NS_FAILED(rv)) {
       return false;
     }
 
     // Take a snapshot of the data here, protected by the lock, and then,
     // outside of the lock protection, mirror it to a JS structure
     if (NS_FAILED(internal_GetHistogramAndSamples(locker, h, dataSnapshot))) {
@@ -2047,17 +2046,17 @@ void TelemetryHistogram::InitializeGloba
   MOZ_ASSERT(!gInitDone, "TelemetryHistogram::InitializeGlobalState "
              "may only be called once");
 
   gCanRecordBase = canRecordBase;
   gCanRecordExtended = canRecordExtended;
 
   if (XRE_IsParentProcess()) {
     gHistogramStorage =
-      new Histogram*[HistogramCount * size_t(ProcessID::Count)] {};
+      new base::Histogram*[HistogramCount * size_t(ProcessID::Count)] {};
     gKeyedHistogramStorage =
       new KeyedHistogram*[HistogramCount * size_t(ProcessID::Count)] {};
   }
 
     // Some Telemetry histograms depend on the value of C++ constants and hardcode
     // their values in Histograms.json.
     // We add static asserts here for those values to match so that future changes
     // don't go unnoticed.
@@ -2639,17 +2638,17 @@ TelemetryHistogram::GetHistogramSizesOfI
       if (gKeyedHistogramStorage[i] && gKeyedHistogramStorage[i] != gExpiredKeyedHistogram) {
         n += gKeyedHistogramStorage[i]->SizeOfIncludingThis(aMallocSizeOf);
       }
     }
   }
 
   // If we allocated the array, let's count the number of pointers in there.
   if (gHistogramStorage) {
-    n += HistogramCount * size_t(ProcessID::Count) * sizeof(Histogram*);
+    n += HistogramCount * size_t(ProcessID::Count) * sizeof(base::Histogram*);
     for (size_t i = 0; i < HistogramCount * size_t(ProcessID::Count); ++i) {
       if (gHistogramStorage[i] && gHistogramStorage[i] != gExpiredHistogram) {
         n += gHistogramStorage[i]->SizeOfIncludingThis(aMallocSizeOf);
       }
     }
   }
 
   // We only allocate the expired (keyed) histogram once.
@@ -2665,24 +2664,24 @@ TelemetryHistogram::GetHistogramSizesOfI
 }
 
 ////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////
 //
 // PRIVATE: GeckoView specific helpers
 
 namespace base {
-class PersistedSampleSet : public Histogram::SampleSet
+class PersistedSampleSet : public base::Histogram::SampleSet
 {
 public:
-  explicit PersistedSampleSet(const nsTArray<Histogram::Count>& aCounts,
+  explicit PersistedSampleSet(const nsTArray<base::Histogram::Count>& aCounts,
                               int64_t aSampleSum);
 };
 
-PersistedSampleSet::PersistedSampleSet(const nsTArray<Histogram::Count>& aCounts,
+PersistedSampleSet::PersistedSampleSet(const nsTArray<base::Histogram::Count>& aCounts,
                                        int64_t aSampleSum)
 {
   // Initialize the data in the base class. See Histogram::SampleSet
   // for the fields documentation.
   const size_t numCounts = aCounts.Length();
   counts_.SetLength(numCounts);
 
   for (size_t i = 0; i < numCounts; i++) {
@@ -2741,17 +2740,17 @@ internal_CanRecordHistogram(const Histog
   }
 
   return true;
 }
 
 nsresult
 internal_ParseHistogramData(JSContext* aCx, JS::HandleId aEntryId,
                             JS::HandleObject aContainerObj, nsACString& aOutName,
-                            nsTArray<Histogram::Count>& aOutCountArray, int64_t& aOutSum)
+                            nsTArray<base::Histogram::Count>& aOutCountArray, int64_t& aOutSum)
 {
   // Get the histogram name.
   nsAutoJSString histogramName;
   if (!histogramName.init(aCx, aEntryId)) {
     JS_ClearPendingException(aCx);
     return NS_ERROR_FAILURE;
   }
 
@@ -2760,17 +2759,17 @@ internal_ParseHistogramData(JSContext* a
   // Get the data for this histogram.
   JS::RootedValue histogramData(aCx);
   if (!JS_GetPropertyById(aCx, aContainerObj, aEntryId, &histogramData)) {
     JS_ClearPendingException(aCx);
     return NS_ERROR_FAILURE;
   }
 
   if (!histogramData.isObject()) {
-    // Histogram data need to be an object. If that's not the case, skip it
+    // base::Histogram data need to be an object. If that's not the case, skip it
     // and try to load the rest of the data.
     return NS_ERROR_FAILURE;
   }
 
   // Get the "sum" property.
   JS::RootedValue sumValue(aCx);
   JS::RootedObject histogramObj(aCx, &histogramData.toObject());
   if (!JS_GetProperty(aCx, histogramObj, "sum", &sumValue)) {
@@ -2943,17 +2942,17 @@ TelemetryHistogram::DeserializeHistogram
   }
 
   // Telemetry is disabled. This should never happen, but let's leave this check
   // for consistency with other histogram updates routines.
   if (!internal_CanRecordBase()) {
     return NS_OK;
   }
 
-  typedef mozilla::Tuple<nsCString, nsTArray<Histogram::Count>, int64_t>
+  typedef mozilla::Tuple<nsCString, nsTArray<base::Histogram::Count>, int64_t>
     PersistedHistogramTuple;
   typedef mozilla::Vector<PersistedHistogramTuple> PersistedHistogramArray;
   typedef mozilla::Vector<PersistedHistogramArray> PersistedHistogramStorage;
 
   // Before updating the histograms, we need to get the data out of the JS
   // wrappers. We can't hold the histogram mutex while handling JS stuff.
   // Build a <histogram name, value> map.
   JS::RootedObject histogramDataObj(aCx, &aData.toObject());
@@ -3022,17 +3021,17 @@ TelemetryHistogram::DeserializeHistogram
     PersistedHistogramArray& deserializedProcessData =
       histogramsToUpdate[static_cast<uint32_t>(processID)];
 
     JS::RootedId histogram(aCx);
     for (auto& histogramVal : histograms) {
       histogram = histogramVal;
 
       int64_t sum = 0;
-      nsTArray<Histogram::Count> deserializedCounts;
+      nsTArray<base::Histogram::Count> deserializedCounts;
       nsCString histogramName;
       if (NS_FAILED(internal_ParseHistogramData(aCx, histogram, processDataObj,
                                                 histogramName, deserializedCounts, sum))) {
         continue;
       }
 
       // Finally append the deserialized data to the storage.
       if (!deserializedProcessData.emplaceBack(
@@ -3058,17 +3057,17 @@ TelemetryHistogram::DeserializeHistogram
 
         ProcessID procID = static_cast<ProcessID>(process);
         if (!internal_CanRecordHistogram(id, procID)) {
           // We're not allowed to record this, so don't try to restore it.
           continue;
         }
 
         // Get the Histogram instance: this will instantiate it if it doesn't exist.
-        Histogram* h = internal_GetHistogramById(locker, id, procID);
+        base::Histogram* h = internal_GetHistogramById(locker, id, procID);
         MOZ_ASSERT(h);
 
         if (!h || internal_IsExpired(locker, h)) {
           // Don't restore expired histograms.
           continue;
         }
 
         // Make sure that histogram counts have matching sizes. If not,
@@ -3099,17 +3098,17 @@ TelemetryHistogram::DeserializeKeyedHist
   }
 
   // Telemetry is disabled. This should never happen, but let's leave this check
   // for consistency with other histogram updates routines.
   if (!internal_CanRecordBase()) {
     return NS_OK;
   }
 
-  typedef mozilla::Tuple<nsCString, nsCString, nsTArray<Histogram::Count>, int64_t>
+  typedef mozilla::Tuple<nsCString, nsCString, nsTArray<base::Histogram::Count>, int64_t>
     PersistedKeyedHistogramTuple;
   typedef mozilla::Vector<PersistedKeyedHistogramTuple> PersistedKeyedHistogramArray;
   typedef mozilla::Vector<PersistedKeyedHistogramArray> PersistedKeyedHistogramStorage;
 
   // Before updating the histograms, we need to get the data out of the JS
   // wrappers. We can't hold the histogram mutex while handling JS stuff.
   // Build a <histogram name, value> map.
   JS::RootedObject histogramDataObj(aCx, &aData.toObject());
@@ -3203,17 +3202,17 @@ TelemetryHistogram::DeserializeKeyedHist
         continue;
       }
 
       JS::RootedId key(aCx);
       for (auto& keyVal : keys) {
         key = keyVal;
 
         int64_t sum = 0;
-        nsTArray<Histogram::Count> deserializedCounts;
+        nsTArray<base::Histogram::Count> deserializedCounts;
         nsCString keyName;
         if (NS_FAILED(internal_ParseHistogramData(aCx, key, keysDataObj, keyName,
                                                   deserializedCounts, sum))) {
           continue;
         }
 
         // Finally append the deserialized data to the storage.
         if (!deserializedProcessData.emplaceBack(
@@ -3249,17 +3248,17 @@ TelemetryHistogram::DeserializeKeyedHist
         MOZ_ASSERT(keyed);
 
         if (!keyed) {
           // Don't restore if we don't have a destination storage.
           continue;
         }
 
         // Get data for the key we're looking for.
-        Histogram* h = nullptr;
+        base::Histogram* h = nullptr;
         if (NS_FAILED(keyed->GetHistogram(mozilla::Get<1>(histogramData), &h))) {
           continue;
         }
         MOZ_ASSERT(h);
 
         if (!h || internal_IsExpired(locker, h)) {
           // Don't restore expired histograms.
           continue;