Backed out 3 changesets (bug 1454606) for bustage on /toolkit/components/telemetry/TelemetryScalar.cpp on a CLOSED TREE
authorGurzau Raul <rgurzau@mozilla.com>
Wed, 30 May 2018 13:55:37 +0300
changeset 420513 324e22546444ba80d38d5899706fdc993efd1f18
parent 420512 6be2c9f129c9966e7ee1cd489a534754362ac662
child 420514 84bcc6fa5f9c60bfea8c57ebd58b93f6f74c53c6
push id103828
push useraiakab@mozilla.com
push dateWed, 30 May 2018 22:08:58 +0000
treeherdermozilla-inbound@8d0ee6e73fb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1454606
milestone62.0a1
backs out6be2c9f129c9966e7ee1cd489a534754362ac662
114fd49040b6bbbb3262fb3459188d903337b5b0
2889aa95e455370a18a634bbaa2af6c1bb77f147
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
Backed out 3 changesets (bug 1454606) for bustage on /toolkit/components/telemetry/TelemetryScalar.cpp on a CLOSED TREE Backed out changeset 6be2c9f129c9 (bug 1454606) Backed out changeset 114fd49040b6 (bug 1454606) Backed out changeset 2889aa95e455 (bug 1454606)
toolkit/components/telemetry/TelemetryScalar.cpp
toolkit/components/telemetry/TelemetryScalar.h
toolkit/components/telemetry/docs/internals/geckoview.rst
toolkit/components/telemetry/geckoview/TelemetryGeckoViewPersistence.cpp
toolkit/components/telemetry/geckoview/gtest/TestGeckoView.cpp
toolkit/components/telemetry/ipc/TelemetryComms.h
toolkit/components/telemetry/ipc/TelemetryIPCAccumulator.cpp
--- a/toolkit/components/telemetry/TelemetryScalar.cpp
+++ b/toolkit/components/telemetry/TelemetryScalar.cpp
@@ -29,33 +29,29 @@
 #include "TelemetryScalarData.h"
 #include "ipc/TelemetryComms.h"
 #include "ipc/TelemetryIPCAccumulator.h"
 
 using mozilla::Preferences;
 using mozilla::StaticAutoPtr;
 using mozilla::StaticMutex;
 using mozilla::StaticMutexAutoLock;
-using mozilla::Some;
-using mozilla::Nothing;
 using mozilla::Telemetry::Common::AutoHashtable;
 using mozilla::Telemetry::Common::IsExpiredVersion;
 using mozilla::Telemetry::Common::CanRecordDataset;
 using mozilla::Telemetry::Common::CanRecordProduct;
 using mozilla::Telemetry::Common::IsInDataset;
 using mozilla::Telemetry::Common::LogToBrowserConsole;
 using mozilla::Telemetry::Common::GetNameForProcessID;
 using mozilla::Telemetry::Common::GetIDForProcessName;
 using mozilla::Telemetry::Common::RecordedProcessType;
 using mozilla::Telemetry::Common::IsValidIdentifierString;
 using mozilla::Telemetry::Common::GetCurrentProduct;
 using mozilla::Telemetry::Common::SupportedProduct;
 using mozilla::Telemetry::ScalarActionType;
-using mozilla::Telemetry::ScalarAction;
-using mozilla::Telemetry::KeyedScalarAction;
 using mozilla::Telemetry::ScalarID;
 using mozilla::Telemetry::DynamicScalarDefinition;
 using mozilla::Telemetry::ScalarVariant;
 using mozilla::Telemetry::ProcessID;
 
 namespace TelemetryIPCAccumulator = mozilla::TelemetryIPCAccumulator;
 
 ////////////////////////////////////////////////////////////////////////
@@ -104,21 +100,16 @@ const uint32_t kMaximumStringValueLength
 // The category and scalar name maximum lengths are used by the dynamic
 // scalar registration function and must match the constants used by
 // the 'parse_scalars.py' script for static scalars.
 const uint32_t kMaximumCategoryNameLength = 40;
 const uint32_t kMaximumScalarNameLength = 40;
 const uint32_t kScalarCount =
   static_cast<uint32_t>(mozilla::Telemetry::ScalarID::ScalarCount);
 
-// To stop growing unbounded in memory while waiting for scalar deserialization
-// to finish, we immediately apply pending operations if the array reaches
-// a certain high water mark of elements.
-const size_t kScalarActionsArrayHighWaterMark = 10000;
-
 enum class ScalarResult : uint8_t {
   // Nothing went wrong.
   Ok,
   // General Scalar Errors
   NotInitialized,
   CannotUnpackVariant,
   CannotRecordInProcess,
   CannotRecordDataset,
@@ -932,30 +923,16 @@ ScalarMapType gScalarNameIDMap(kScalarCo
 ProcessesScalarsMapType gScalarStorageMap;
 // As above, for the keyed scalars.
 ProcessesKeyedScalarsMapType gKeyedScalarStorageMap;
 // Provide separate storage for "dynamic builtin" plain and keyed scalars,
 // needed to support "build faster" in local developer builds.
 ProcessesScalarsMapType gDynamicBuiltinScalarStorageMap;
 ProcessesKeyedScalarsMapType gDynamicBuiltinKeyedScalarStorageMap;
 
-// Whether or not the deserialization of persisted scalars is still in progress.
-// This is never the case on Desktop or Fennec.
-// Only GeckoView restores persisted scalars.
-bool gIsDeserializing = false;
-// This batches scalar accumulations that should be applied once loading finished.
-StaticAutoPtr<nsTArray<ScalarAction>> gScalarsActions;
-StaticAutoPtr<nsTArray<KeyedScalarAction>> gKeyedScalarsActions;
-
-bool
-internal_IsScalarDeserializing(const StaticMutexAutoLock& lock)
-{
-  return gIsDeserializing;
-}
-
 } // namespace
 
 ////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////
 //
 // PRIVATE: Function that may call JS code.
 
 // NOTE: the functions in this section all run without protection from
@@ -1262,143 +1239,32 @@ internal_GetScalarByEnum(const StaticMut
     return NS_ERROR_INVALID_ARG;
   }
 
   scalarStorage->Put(aId.id, scalar);
   *aRet = scalar;
   return NS_OK;
 }
 
-void internal_ApplyPendingOperations(const StaticMutexAutoLock& lock);
-
-/**
- * Record the given action on a scalar into the pending actions list.
- *
- * If the pending actions list overflows the high water mark length
- * all operations are immediately applied, including the passed action.
- *
- * @param aScalarAction The action to record.
- */
-void
-internal_RecordScalarAction(const StaticMutexAutoLock& lock,
-                            const ScalarAction& aScalarAction)
-{
-  // Make sure to have the storage.
-  if (!gScalarsActions) {
-    gScalarsActions = new nsTArray<ScalarAction>();
-  }
-
-  // Store the action.
-  gScalarsActions->AppendElement(aScalarAction);
-
-  // If this action overflows the pending actions array, we immediately apply pending operations
-  // and assume loading is over.
-  // If loading still happens afterwards, some scalar values might be
-  // overwritten and inconsistent, but we won't lose operations on otherwise untouched probes.
-  if (gScalarsActions->Length() > kScalarActionsArrayHighWaterMark) {
-    internal_ApplyPendingOperations(lock);
-    return;
-  }
-}
-
-/**
- * Record the given action on a scalar on the main process into the pending actions list.
- *
- * If the pending actions list overflows the high water mark length
- * all operations are immediately applied, including the passed action.
- *
- * @param aId The scalar's ID this action applies to
- * @param aDynamic Determines if the scalar is dynamic
- * @param aAction The action to record
- * @param aValue The additional data for the recorded action
- */
-void
-internal_RecordScalarAction(const StaticMutexAutoLock& lock,
-                            uint32_t aId, bool aDynamic,
-                            ScalarActionType aAction, const ScalarVariant& aValue)
-{
-  internal_RecordScalarAction(lock, ScalarAction{
-                                      aId, aDynamic, aAction,
-                                      Some(aValue), ProcessID::Parent
-                                    });
-}
-
-/**
- * Record the given action on a keyed scalar into the pending actions list.
- *
- * If the pending actions list overflows the high water mark length
- * all operations are immediately applied, including the passed action.
- *
- * @param aScalarAction The action to record.
- */
-void
-internal_RecordKeyedScalarAction(const StaticMutexAutoLock& lock,
-                                 const KeyedScalarAction& aScalarAction)
-{
-  // Make sure to have the storage.
-  if (!gKeyedScalarsActions) {
-    gKeyedScalarsActions = new nsTArray<KeyedScalarAction>();
-  }
-
-  // Store the action.
-  gKeyedScalarsActions->AppendElement(aScalarAction);
-
-  // If this action overflows the pending actions array, we immediately apply pending operations
-  // and assume loading is over.
-  // If loading still happens afterwards, some scalar values might be
-  // overwritten and inconsistent, but we won't lose operations on otherwise untouched probes.
-  if (gKeyedScalarsActions->Length() > kScalarActionsArrayHighWaterMark) {
-    internal_ApplyPendingOperations(lock);
-    return;
-  }
-}
-
-/**
- * Record the given action on a keyed scalar on the main process into the pending actions list.
- *
- * If the pending actions list overflows the high water mark length
- * all operations are immediately applied, including the passed action.
- *
- * @param aId The scalar's ID this action applies to
- * @param aDynamic Determines if the scalar is dynamic
- * @param aKey The scalar's key
- * @param aAction The action to record
- * @param aValue The additional data for the recorded action
- */
-void
-internal_RecordKeyedScalarAction(const StaticMutexAutoLock& lock,
-                                 uint32_t aId, bool aDynamic,
-                                 const nsAString& aKey,
-                                 ScalarActionType aAction,
-                                 const ScalarVariant& aValue)
-{
-  internal_RecordKeyedScalarAction(lock, KeyedScalarAction{
-                                           aId, aDynamic, aAction, NS_ConvertUTF16toUTF8(aKey),
-                                           Some(aValue), ProcessID::Parent
-                                         });
-}
-
 /**
  * Update the scalar with the provided value. This is used by the JS API.
  *
  * @param lock Instance of a lock locking gTelemetryHistogramMutex
  * @param aName The scalar name.
  * @param aType The action type for updating the scalar.
  * @param aValue The value to use for updating the scalar.
  * @param aProcessOverride The process for which the scalar must be updated.
  *        This must only be used for GeckoView persistence. It must be
  *        set to the ProcessID::Parent for all the other cases.
- * @param aForce Whether to force updating even if load is in progress.
  * @return a ScalarResult error value.
  */
 ScalarResult
 internal_UpdateScalar(const StaticMutexAutoLock& lock, const nsACString& aName,
                       ScalarActionType aType, nsIVariant* aValue,
-                      ProcessID aProcessOverride = ProcessID::Parent,
-                      bool aForce = false)
+                      ProcessID aProcessOverride = ProcessID::Parent)
 {
   ScalarKey uniqueId;
   nsresult rv = internal_GetEnumByScalarName(lock, aName, &uniqueId);
   if (NS_FAILED(rv)) {
     return (rv == NS_ERROR_FAILURE) ?
            ScalarResult::NotInitialized : ScalarResult::UnknownScalar;
   }
 
@@ -1420,29 +1286,16 @@ internal_UpdateScalar(const StaticMutexA
       MOZ_ASSERT(false, "Unable to convert nsIVariant to mozilla::Variant.");
       return sr;
     }
     TelemetryIPCAccumulator::RecordChildScalarAction(
       uniqueId.id, uniqueId.dynamic, aType, variantValue.ref());
     return ScalarResult::Ok;
   }
 
-  if (!aForce && internal_IsScalarDeserializing(lock)) {
-    const BaseScalarInfo &info = internal_GetScalarInfo(lock, uniqueId);
-    // Convert the nsIVariant to a Variant.
-    mozilla::Maybe<ScalarVariant> variantValue;
-    sr = GetVariantFromIVariant(aValue, info.kind, variantValue);
-    if (sr != ScalarResult::Ok) {
-      MOZ_ASSERT(false, "Unable to convert nsIVariant to mozilla::Variant.");
-      return sr;
-    }
-    internal_RecordScalarAction(lock, uniqueId.id, uniqueId.dynamic, aType, variantValue.ref());
-    return ScalarResult::Ok;
-  }
-
   // Finally get the scalar.
   ScalarBase* scalar = nullptr;
   rv = internal_GetScalarByEnum(lock, uniqueId, aProcessOverride, &scalar);
   if (NS_FAILED(rv)) {
     // Don't throw on expired scalars.
     if (rv == NS_ERROR_NOT_AVAILABLE) {
       return ScalarResult::Ok;
     }
@@ -1565,18 +1418,17 @@ internal_GetKeyedScalarByEnum(const Stat
  *        This must only be used for GeckoView persistence. It must be
  *        set to the ProcessID::Parent for all the other cases.
  * @return a ScalarResult error value.
  */
 ScalarResult
 internal_UpdateKeyedScalar(const StaticMutexAutoLock& lock,
                            const nsACString& aName, const nsAString& aKey,
                            ScalarActionType aType, nsIVariant* aValue,
-                           ProcessID aProcessOverride = ProcessID::Parent,
-                           bool aForce = false)
+                           ProcessID aProcessOverride = ProcessID::Parent)
 {
   ScalarKey uniqueId;
   nsresult rv = internal_GetEnumByScalarName(lock, aName, &uniqueId);
   if (NS_FAILED(rv)) {
     return (rv == NS_ERROR_FAILURE) ?
            ScalarResult::NotInitialized : ScalarResult::UnknownScalar;
   }
 
@@ -1598,31 +1450,16 @@ internal_UpdateKeyedScalar(const StaticM
       MOZ_ASSERT(false, "Unable to convert nsIVariant to mozilla::Variant.");
       return sr;
     }
     TelemetryIPCAccumulator::RecordChildKeyedScalarAction(
       uniqueId.id, uniqueId.dynamic, aKey, aType, variantValue.ref());
     return ScalarResult::Ok;
   }
 
-  if (!aForce && internal_IsScalarDeserializing(lock)) {
-    const BaseScalarInfo &info = internal_GetScalarInfo(lock, uniqueId);
-    // Convert the nsIVariant to a Variant.
-    mozilla::Maybe<ScalarVariant> variantValue;
-    sr = GetVariantFromIVariant(aValue, info.kind, variantValue);
-    if (sr != ScalarResult::Ok) {
-      MOZ_ASSERT(false, "Unable to convert nsIVariant to mozilla::Variant.");
-      return sr;
-    }
-    internal_RecordKeyedScalarAction(lock,
-                                     uniqueId.id, uniqueId.dynamic,
-                                     aKey, aType, variantValue.ref());
-    return ScalarResult::Ok;
-  }
-
   // Finally get the scalar.
   KeyedScalar* scalar = nullptr;
   rv = internal_GetKeyedScalarByEnum(lock, uniqueId, aProcessOverride, &scalar);
   if (NS_FAILED(rv)) {
     // Don't throw on expired scalars.
     if (rv == NS_ERROR_NOT_AVAILABLE) {
       return ScalarResult::Ok;
     }
@@ -1895,229 +1732,16 @@ internal_GetKeyedScalarSnapshot(const St
     gDynamicBuiltinKeyedScalarStorageMap.Clear();
   }
 
   return NS_OK;
 }
 
 } // namespace
 
-// helpers for recording/applying scalar operations
-namespace {
-
-void
-internal_ApplyScalarActions(const StaticMutexAutoLock& lock,
-                            const nsTArray<mozilla::Telemetry::ScalarAction>& aScalarActions,
-                            mozilla::Maybe<ProcessID> aProcessType = Nothing())
-{
-  if (!internal_CanRecordBase(lock)) {
-    return;
-  }
-
-  for (auto& upd : aScalarActions) {
-    ScalarKey uniqueId{upd.mId, upd.mDynamic};
-    if (NS_WARN_IF(!internal_IsValidId(lock, uniqueId))) {
-      MOZ_ASSERT_UNREACHABLE("Scalar usage requires valid ids.");
-      continue;
-    }
-
-    if (internal_IsKeyedScalar(lock, uniqueId)) {
-      continue;
-    }
-
-    // Are we allowed to record this scalar? We don't need to check for
-    // allowed processes here, that's taken care of when recording
-    // in child processes.
-    if (!internal_CanRecordForScalarID(lock, uniqueId)) {
-      continue;
-    }
-
-    // Either we got passed a process type or it was explicitely set on the recorded action.
-    // It should never happen that it is set to an invalid value (such as ProcessID::Count)
-    ProcessID processType = aProcessType.valueOr(upd.mProcessType);
-    MOZ_ASSERT(processType != ProcessID::Count);
-
-    // Refresh the data in the parent process with the data coming from the child
-    // processes.
-    ScalarBase* scalar = nullptr;
-    nsresult rv = internal_GetScalarByEnum(lock, uniqueId, processType,
-                                           &scalar);
-    if (NS_FAILED(rv)) {
-      NS_WARNING("NS_FAILED internal_GetScalarByEnum for CHILD");
-      continue;
-    }
-
-    if (upd.mData.isNothing()) {
-      MOZ_ASSERT(false, "There is no data in the ScalarActionType.");
-      continue;
-    }
-
-    // Get the type of this scalar from the scalar ID. We already checked
-    // for its validity a few lines above.
-    const uint32_t scalarType = internal_GetScalarInfo(lock, uniqueId).kind;
-
-    // Extract the data from the mozilla::Variant.
-    switch (upd.mActionType)
-    {
-      case ScalarActionType::eSet:
-        {
-          switch (scalarType)
-          {
-            case nsITelemetry::SCALAR_TYPE_COUNT:
-              scalar->SetValue(upd.mData->as<uint32_t>());
-              break;
-            case nsITelemetry::SCALAR_TYPE_BOOLEAN:
-              scalar->SetValue(upd.mData->as<bool>());
-              break;
-            case nsITelemetry::SCALAR_TYPE_STRING:
-              scalar->SetValue(upd.mData->as<nsString>());
-              break;
-          }
-          break;
-        }
-      case ScalarActionType::eAdd:
-        {
-          if (scalarType != nsITelemetry::SCALAR_TYPE_COUNT) {
-            NS_WARNING("Attempting to add on a non count scalar.");
-            continue;
-          }
-          // We only support adding uint32_t.
-          scalar->AddValue(upd.mData->as<uint32_t>());
-          break;
-        }
-      case ScalarActionType::eSetMaximum:
-        {
-          if (scalarType != nsITelemetry::SCALAR_TYPE_COUNT) {
-            NS_WARNING("Attempting to add on a non count scalar.");
-            continue;
-          }
-          // We only support SetMaximum on uint32_t.
-          scalar->SetMaximum(upd.mData->as<uint32_t>());
-          break;
-        }
-      default:
-        NS_WARNING("Unsupported action coming from scalar child updates.");
-    }
-  }
-}
-
-void
-internal_ApplyKeyedScalarActions(const StaticMutexAutoLock& lock,
-                                 const nsTArray<mozilla::Telemetry::KeyedScalarAction>& aScalarActions,
-                                 mozilla::Maybe<ProcessID> aProcessType = Nothing())
-{
-  if (!internal_CanRecordBase(lock)) {
-    return;
-  }
-
-  for (auto& upd : aScalarActions) {
-    ScalarKey uniqueId{upd.mId, upd.mDynamic};
-    if (NS_WARN_IF(!internal_IsValidId(lock, uniqueId))) {
-      MOZ_ASSERT_UNREACHABLE("Scalar usage requires valid ids.");
-      continue;
-    }
-
-    if (!internal_IsKeyedScalar(lock, uniqueId)) {
-      continue;
-    }
-
-    // Are we allowed to record this scalar? We don't need to check for
-    // allowed processes here, that's taken care of when recording
-    // in child processes.
-    if (!internal_CanRecordForScalarID(lock, uniqueId)) {
-      continue;
-    }
-
-    // Either we got passed a process type or it was explicitely set on the recorded action.
-    // It should never happen that it is set to an invalid value (such as ProcessID::Count)
-    ProcessID processType = aProcessType.valueOr(upd.mProcessType);
-    MOZ_ASSERT(processType != ProcessID::Count);
-
-    // Refresh the data in the parent process with the data coming from the child
-    // processes.
-    KeyedScalar* scalar = nullptr;
-    nsresult rv = internal_GetKeyedScalarByEnum(lock, uniqueId, processType,
-                                                &scalar);
-    if (NS_FAILED(rv)) {
-      NS_WARNING("NS_FAILED internal_GetScalarByEnum for CHILD");
-      continue;
-    }
-
-    if (upd.mData.isNothing()) {
-      MOZ_ASSERT(false, "There is no data in the KeyedScalarAction.");
-      continue;
-    }
-
-    // Get the type of this scalar from the scalar ID. We already checked
-    // for its validity a few lines above.
-    const uint32_t scalarType = internal_GetScalarInfo(lock, uniqueId).kind;
-
-    // Extract the data from the mozilla::Variant.
-    switch (upd.mActionType)
-    {
-      case ScalarActionType::eSet:
-        {
-          switch (scalarType)
-          {
-            case nsITelemetry::SCALAR_TYPE_COUNT:
-              scalar->SetValue(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData->as<uint32_t>());
-              break;
-            case nsITelemetry::SCALAR_TYPE_BOOLEAN:
-              scalar->SetValue(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData->as<bool>());
-              break;
-            default:
-              NS_WARNING("Unsupported type coming from scalar child updates.");
-          }
-          break;
-        }
-      case ScalarActionType::eAdd:
-        {
-          if (scalarType != nsITelemetry::SCALAR_TYPE_COUNT) {
-            NS_WARNING("Attempting to add on a non count scalar.");
-            continue;
-          }
-          // We only support adding on uint32_t.
-          scalar->AddValue(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData->as<uint32_t>());
-          break;
-        }
-      case ScalarActionType::eSetMaximum:
-        {
-          if (scalarType != nsITelemetry::SCALAR_TYPE_COUNT) {
-            NS_WARNING("Attempting to add on a non count scalar.");
-            continue;
-          }
-          // We only support SetMaximum on uint32_t.
-          scalar->SetMaximum(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData->as<uint32_t>());
-          break;
-        }
-      default:
-        NS_WARNING("Unsupported action coming from keyed scalar child updates.");
-    }
-  }
-}
-
-void
-internal_ApplyPendingOperations(const StaticMutexAutoLock& lock)
-{
-  if (gScalarsActions && gScalarsActions->Length() > 0) {
-    internal_ApplyScalarActions(lock, *gScalarsActions);
-    gScalarsActions->Clear();
-  }
-
-  if (gKeyedScalarsActions && gKeyedScalarsActions->Length() > 0) {
-    internal_ApplyKeyedScalarActions(lock, *gKeyedScalarsActions);
-    gKeyedScalarsActions->Clear();
-  }
-
-  // After all pending operations are applied deserialization is done
-  gIsDeserializing = false;
-}
-
-} // namespace
-
 ////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////
 //
 // EXTERNALLY VISIBLE FUNCTIONS in namespace TelemetryScalars::
 
 // This is a StaticMutex rather than a plain Mutex (1) so that
 // it gets initialised in a thread-safe manner the first time
 // it is used, and (2) because it is never de-initialised, and
@@ -2175,30 +1799,16 @@ TelemetryScalar::DeInitializeGlobalState
   gKeyedScalarStorageMap.Clear();
   gDynamicBuiltinScalarStorageMap.Clear();
   gDynamicBuiltinKeyedScalarStorageMap.Clear();
   gDynamicScalarInfo = nullptr;
   gInitDone = false;
 }
 
 void
-TelemetryScalar::DeserializationStarted()
-{
-  StaticMutexAutoLock locker(gTelemetryScalarsMutex);
-  gIsDeserializing = true;
-}
-
-void
-TelemetryScalar::ApplyPendingOperations()
-{
-  StaticMutexAutoLock locker(gTelemetryScalarsMutex);
-  internal_ApplyPendingOperations(locker);
-}
-
-void
 TelemetryScalar::SetCanRecordBase(bool b)
 {
   StaticMutexAutoLock locker(gTelemetryScalarsMutex);
   gCanRecordBase = b;
 }
 
 void
 TelemetryScalar::SetCanRecordExtended(bool b) {
@@ -2306,23 +1916,16 @@ TelemetryScalar::Add(mozilla::Telemetry:
   // Accumulate in the child process if needed.
   if (!XRE_IsParentProcess()) {
     TelemetryIPCAccumulator::RecordChildScalarAction(uniqueId.id, uniqueId.dynamic,
                                                      ScalarActionType::eAdd,
                                                      ScalarVariant(aValue));
     return;
   }
 
-  if (internal_IsScalarDeserializing(locker)) {
-    internal_RecordScalarAction(locker, uniqueId.id, uniqueId.dynamic,
-                                ScalarActionType::eAdd,
-                                ScalarVariant(aValue));
-    return;
-  }
-
   ScalarBase* scalar = nullptr;
   nsresult rv = internal_GetScalarByEnum(locker, uniqueId, ProcessID::Parent,
                                          &scalar);
   if (NS_FAILED(rv)) {
     return;
   }
 
   scalar->AddValue(aValue);
@@ -2354,24 +1957,16 @@ TelemetryScalar::Add(mozilla::Telemetry:
 
   // Accumulate in the child process if needed.
   if (!XRE_IsParentProcess()) {
     TelemetryIPCAccumulator::RecordChildKeyedScalarAction(uniqueId.id, uniqueId.dynamic,
       aKey, ScalarActionType::eAdd, ScalarVariant(aValue));
     return;
   }
 
-  if (internal_IsScalarDeserializing(locker)) {
-    internal_RecordKeyedScalarAction(locker, uniqueId.id, uniqueId.dynamic,
-                                     aKey,
-                                     ScalarActionType::eAdd,
-                                     ScalarVariant(aValue));
-    return;
-  }
-
   KeyedScalar* scalar = nullptr;
   nsresult rv = internal_GetKeyedScalarByEnum(locker, uniqueId,
                                               ProcessID::Parent,
                                               &scalar);
   if (NS_FAILED(rv)) {
     return;
   }
 
@@ -2478,23 +2073,16 @@ TelemetryScalar::Set(mozilla::Telemetry:
   // Accumulate in the child process if needed.
   if (!XRE_IsParentProcess()) {
     TelemetryIPCAccumulator::RecordChildScalarAction(uniqueId.id, uniqueId.dynamic,
                                                      ScalarActionType::eSet,
                                                      ScalarVariant(aValue));
     return;
   }
 
-  if (internal_IsScalarDeserializing(locker)) {
-    internal_RecordScalarAction(locker, uniqueId.id, uniqueId.dynamic,
-                                ScalarActionType::eSet,
-                                ScalarVariant(aValue));
-    return;
-  }
-
   ScalarBase* scalar = nullptr;
   nsresult rv = internal_GetScalarByEnum(locker, uniqueId, ProcessID::Parent,
                                          &scalar);
   if (NS_FAILED(rv)) {
     return;
   }
 
   scalar->SetValue(aValue);
@@ -2525,23 +2113,16 @@ TelemetryScalar::Set(mozilla::Telemetry:
   // Accumulate in the child process if needed.
   if (!XRE_IsParentProcess()) {
     TelemetryIPCAccumulator::RecordChildScalarAction(uniqueId.id, uniqueId.dynamic,
                                                      ScalarActionType::eSet,
                                                      ScalarVariant(nsString(aValue)));
     return;
   }
 
-  if (internal_IsScalarDeserializing(locker)) {
-    internal_RecordScalarAction(locker, uniqueId.id, uniqueId.dynamic,
-                                ScalarActionType::eSet,
-                                ScalarVariant(nsString(aValue)));
-    return;
-  }
-
   ScalarBase* scalar = nullptr;
   nsresult rv = internal_GetScalarByEnum(locker, uniqueId, ProcessID::Parent,
                                          &scalar);
   if (NS_FAILED(rv)) {
     return;
   }
 
   scalar->SetValue(aValue);
@@ -2572,23 +2153,16 @@ TelemetryScalar::Set(mozilla::Telemetry:
   // Accumulate in the child process if needed.
   if (!XRE_IsParentProcess()) {
     TelemetryIPCAccumulator::RecordChildScalarAction(uniqueId.id, uniqueId.dynamic,
                                                      ScalarActionType::eSet,
                                                      ScalarVariant(aValue));
     return;
   }
 
-  if (internal_IsScalarDeserializing(locker)) {
-    internal_RecordScalarAction(locker, uniqueId.id, uniqueId.dynamic,
-                                ScalarActionType::eSet,
-                                ScalarVariant(aValue));
-    return;
-  }
-
   ScalarBase* scalar = nullptr;
   nsresult rv = internal_GetScalarByEnum(locker, uniqueId, ProcessID::Parent,
                                          &scalar);
   if (NS_FAILED(rv)) {
     return;
   }
 
   scalar->SetValue(aValue);
@@ -2620,24 +2194,16 @@ TelemetryScalar::Set(mozilla::Telemetry:
 
   // Accumulate in the child process if needed.
   if (!XRE_IsParentProcess()) {
     TelemetryIPCAccumulator::RecordChildKeyedScalarAction(uniqueId.id, uniqueId.dynamic,
       aKey, ScalarActionType::eSet, ScalarVariant(aValue));
     return;
   }
 
-  if (internal_IsScalarDeserializing(locker)) {
-    internal_RecordKeyedScalarAction(locker, uniqueId.id, uniqueId.dynamic,
-                                     aKey,
-                                     ScalarActionType::eSet,
-                                     ScalarVariant(aValue));
-    return;
-  }
-
   KeyedScalar* scalar = nullptr;
   nsresult rv = internal_GetKeyedScalarByEnum(locker, uniqueId,
                                               ProcessID::Parent,
                                               &scalar);
   if (NS_FAILED(rv)) {
     return;
   }
 
@@ -2670,24 +2236,16 @@ TelemetryScalar::Set(mozilla::Telemetry:
 
   // Accumulate in the child process if needed.
   if (!XRE_IsParentProcess()) {
     TelemetryIPCAccumulator::RecordChildKeyedScalarAction(uniqueId.id, uniqueId.dynamic,
       aKey, ScalarActionType::eSet, ScalarVariant(aValue));
     return;
   }
 
-  if (internal_IsScalarDeserializing(locker)) {
-    internal_RecordKeyedScalarAction(locker, uniqueId.id, uniqueId.dynamic,
-                                     aKey,
-                                     ScalarActionType::eSet,
-                                     ScalarVariant(aValue));
-    return;
-  }
-
   KeyedScalar* scalar = nullptr;
   nsresult rv = internal_GetKeyedScalarByEnum(locker, uniqueId,
                                               ProcessID::Parent,
                                               &scalar);
   if (NS_FAILED(rv)) {
     return;
   }
 
@@ -2794,23 +2352,16 @@ TelemetryScalar::SetMaximum(mozilla::Tel
   // Accumulate in the child process if needed.
   if (!XRE_IsParentProcess()) {
     TelemetryIPCAccumulator::RecordChildScalarAction(uniqueId.id, uniqueId.dynamic,
                                                      ScalarActionType::eSetMaximum,
                                                      ScalarVariant(aValue));
     return;
   }
 
-  if (internal_IsScalarDeserializing(locker)) {
-    internal_RecordScalarAction(locker, uniqueId.id, uniqueId.dynamic,
-                                ScalarActionType::eSetMaximum,
-                                ScalarVariant(aValue));
-    return;
-  }
-
   ScalarBase* scalar = nullptr;
   nsresult rv = internal_GetScalarByEnum(locker, uniqueId, ProcessID::Parent,
                                          &scalar);
   if (NS_FAILED(rv)) {
     return;
   }
 
   scalar->SetMaximum(aValue);
@@ -2842,24 +2393,16 @@ TelemetryScalar::SetMaximum(mozilla::Tel
 
   // Accumulate in the child process if needed.
   if (!XRE_IsParentProcess()) {
     TelemetryIPCAccumulator::RecordChildKeyedScalarAction(uniqueId.id, uniqueId.dynamic,
       aKey, ScalarActionType::eSetMaximum, ScalarVariant(aValue));
     return;
   }
 
-  if (internal_IsScalarDeserializing(locker)) {
-    internal_RecordKeyedScalarAction(locker, uniqueId.id, uniqueId.dynamic,
-                                     aKey,
-                                     ScalarActionType::eSetMaximum,
-                                     ScalarVariant(aValue));
-    return;
-  }
-
   KeyedScalar* scalar = nullptr;
   nsresult rv = internal_GetKeyedScalarByEnum(locker, uniqueId, ProcessID::Parent,
                                               &scalar);
   if (NS_FAILED(rv)) {
     return;
   }
 
   scalar->SetMaximum(aKey, aValue);
@@ -3213,18 +2756,16 @@ TelemetryScalar::ClearScalars()
     return;
   }
 
   StaticMutexAutoLock locker(gTelemetryScalarsMutex);
   gScalarStorageMap.Clear();
   gKeyedScalarStorageMap.Clear();
   gDynamicBuiltinScalarStorageMap.Clear();
   gDynamicBuiltinKeyedScalarStorageMap.Clear();
-  gScalarsActions = nullptr;
-  gKeyedScalarsActions = nullptr;
 }
 
 size_t
 TelemetryScalar::GetMapShallowSizesOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
 {
   StaticMutexAutoLock locker(gTelemetryScalarsMutex);
   return gScalarNameIDMap.ShallowSizeOfExcludingThis(aMallocSizeOf);
 }
@@ -3259,57 +2800,192 @@ TelemetryScalar::GetScalarSizesOfIncludi
 
 void
 TelemetryScalar::UpdateChildData(ProcessID aProcessType,
                                  const nsTArray<mozilla::Telemetry::ScalarAction>& aScalarActions)
 {
   MOZ_ASSERT(XRE_IsParentProcess(),
              "The stored child processes scalar data must be updated from the parent process.");
   StaticMutexAutoLock locker(gTelemetryScalarsMutex);
-
-  // If scalars are still being deserialized, we need to record the incoming
-  // operations as well.
-  if (internal_IsScalarDeserializing(locker)) {
-    for (const ScalarAction& action : aScalarActions) {
-      // We're only getting immutable access, so let's copy it
-      ScalarAction copy = action;
-      // Fix up the process type
-      copy.mProcessType = aProcessType;
-      internal_RecordScalarAction(locker, copy);
-    }
-
+  if (!internal_CanRecordBase(locker)) {
     return;
   }
 
-  internal_ApplyScalarActions(locker, aScalarActions, Some(aProcessType));
+  for (auto& upd : aScalarActions) {
+    ScalarKey uniqueId{upd.mId, upd.mDynamic};
+    if (NS_WARN_IF(!internal_IsValidId(locker, uniqueId))) {
+      MOZ_ASSERT_UNREACHABLE("Scalar usage requires valid ids.");
+      continue;
+    }
+
+    if (internal_IsKeyedScalar(locker, uniqueId)) {
+      continue;
+    }
+
+    // Are we allowed to record this scalar? We don't need to check for
+    // allowed processes here, that's taken care of when recording
+    // in child processes.
+    if (!internal_CanRecordForScalarID(locker, uniqueId)) {
+      continue;
+    }
+
+    // Refresh the data in the parent process with the data coming from the child
+    // processes.
+    ScalarBase* scalar = nullptr;
+    nsresult rv = internal_GetScalarByEnum(locker, uniqueId, aProcessType,
+                                           &scalar);
+    if (NS_FAILED(rv)) {
+      NS_WARNING("NS_FAILED internal_GetScalarByEnum for CHILD");
+      continue;
+    }
+
+    if (upd.mData.isNothing()) {
+      MOZ_ASSERT(false, "There is no data in the ScalarActionType.");
+      continue;
+    }
+
+    // Get the type of this scalar from the scalar ID. We already checked
+    // for its validity a few lines above.
+    const uint32_t scalarType = internal_GetScalarInfo(locker, uniqueId).kind;
+
+    // Extract the data from the mozilla::Variant.
+    switch (upd.mActionType)
+    {
+      case ScalarActionType::eSet:
+        {
+          switch (scalarType)
+          {
+            case nsITelemetry::SCALAR_TYPE_COUNT:
+              scalar->SetValue(upd.mData->as<uint32_t>());
+              break;
+            case nsITelemetry::SCALAR_TYPE_BOOLEAN:
+              scalar->SetValue(upd.mData->as<bool>());
+              break;
+            case nsITelemetry::SCALAR_TYPE_STRING:
+              scalar->SetValue(upd.mData->as<nsString>());
+              break;
+          }
+          break;
+        }
+      case ScalarActionType::eAdd:
+        {
+          if (scalarType != nsITelemetry::SCALAR_TYPE_COUNT) {
+            NS_WARNING("Attempting to add on a non count scalar.");
+            continue;
+          }
+          // We only support adding uint32_t.
+          scalar->AddValue(upd.mData->as<uint32_t>());
+          break;
+        }
+      case ScalarActionType::eSetMaximum:
+        {
+          if (scalarType != nsITelemetry::SCALAR_TYPE_COUNT) {
+            NS_WARNING("Attempting to add on a non count scalar.");
+            continue;
+          }
+          // We only support SetMaximum on uint32_t.
+          scalar->SetMaximum(upd.mData->as<uint32_t>());
+          break;
+        }
+      default:
+        NS_WARNING("Unsupported action coming from scalar child updates.");
+    }
+  }
 }
 
 void
 TelemetryScalar::UpdateChildKeyedData(ProcessID aProcessType,
                                       const nsTArray<mozilla::Telemetry::KeyedScalarAction>& aScalarActions)
 {
   MOZ_ASSERT(XRE_IsParentProcess(),
              "The stored child processes keyed scalar data must be updated from the parent process.");
   StaticMutexAutoLock locker(gTelemetryScalarsMutex);
-
-  // If scalars are still being deserialized, we need to record the incoming
-  // operations as well.
-  if (internal_IsScalarDeserializing(locker)) {
-    for (const KeyedScalarAction& action : aScalarActions) {
-      // We're only getting immutable access, so let's copy it
-      KeyedScalarAction copy = action;
-      // Fix up the process type
-      copy.mProcessType = aProcessType;
-      internal_RecordKeyedScalarAction(locker, copy);
-    }
-
+  if (!internal_CanRecordBase(locker)) {
     return;
   }
 
-  internal_ApplyKeyedScalarActions(locker, aScalarActions, Some(aProcessType));
+  for (auto& upd : aScalarActions) {
+    ScalarKey uniqueId{upd.mId, upd.mDynamic};
+    if (NS_WARN_IF(!internal_IsValidId(locker, uniqueId))) {
+      MOZ_ASSERT_UNREACHABLE("Scalar usage requires valid ids.");
+      continue;
+    }
+
+    if (!internal_IsKeyedScalar(locker, uniqueId)) {
+      continue;
+    }
+
+    // Are we allowed to record this scalar? We don't need to check for
+    // allowed processes here, that's taken care of when recording
+    // in child processes.
+    if (!internal_CanRecordForScalarID(locker, uniqueId)) {
+      continue;
+    }
+
+    // Refresh the data in the parent process with the data coming from the child
+    // processes.
+    KeyedScalar* scalar = nullptr;
+    nsresult rv = internal_GetKeyedScalarByEnum(locker, uniqueId, aProcessType,
+                                                &scalar);
+    if (NS_FAILED(rv)) {
+      NS_WARNING("NS_FAILED internal_GetScalarByEnum for CHILD");
+      continue;
+    }
+
+    if (upd.mData.isNothing()) {
+      MOZ_ASSERT(false, "There is no data in the KeyedScalarAction.");
+      continue;
+    }
+
+    // Get the type of this scalar from the scalar ID. We already checked
+    // for its validity a few lines above.
+    const uint32_t scalarType = internal_GetScalarInfo(locker, uniqueId).kind;
+
+    // Extract the data from the mozilla::Variant.
+    switch (upd.mActionType)
+    {
+      case ScalarActionType::eSet:
+        {
+          switch (scalarType)
+          {
+            case nsITelemetry::SCALAR_TYPE_COUNT:
+              scalar->SetValue(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData->as<uint32_t>());
+              break;
+            case nsITelemetry::SCALAR_TYPE_BOOLEAN:
+              scalar->SetValue(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData->as<bool>());
+              break;
+            default:
+              NS_WARNING("Unsupported type coming from scalar child updates.");
+          }
+          break;
+        }
+      case ScalarActionType::eAdd:
+        {
+          if (scalarType != nsITelemetry::SCALAR_TYPE_COUNT) {
+            NS_WARNING("Attempting to add on a non count scalar.");
+            continue;
+          }
+          // We only support adding on uint32_t.
+          scalar->AddValue(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData->as<uint32_t>());
+          break;
+        }
+      case ScalarActionType::eSetMaximum:
+        {
+          if (scalarType != nsITelemetry::SCALAR_TYPE_COUNT) {
+            NS_WARNING("Attempting to add on a non count scalar.");
+            continue;
+          }
+          // We only support SetMaximum on uint32_t.
+          scalar->SetMaximum(NS_ConvertUTF8toUTF16(upd.mKey), upd.mData->as<uint32_t>());
+          break;
+        }
+      default:
+        NS_WARNING("Unsupported action coming from keyed scalar child updates.");
+    }
+  }
 }
 
 void
 TelemetryScalar::RecordDiscardedData(ProcessID aProcessType,
                                      const mozilla::Telemetry::DiscardedData& aDiscardedData)
 {
   MOZ_ASSERT(XRE_IsParentProcess(),
              "Discarded Data must be updated from the parent process.");
@@ -3644,18 +3320,17 @@ TelemetryScalar::DeserializePersistedSca
 
     for (auto iter = scalarsToUpdate.ConstIter(); !iter.Done(); iter.Next()) {
       PersistedScalarArray& processScalars = iter.Data();
       for (PersistedScalarArray::size_type i = 0; i < processScalars.Length(); i++) {
         mozilla::Unused << internal_UpdateScalar(lock,
                                                  processScalars[i].first(),
                                                  ScalarActionType::eSet,
                                                  processScalars[i].second(),
-                                                 ProcessID(iter.Key()),
-                                                 true /* aForce */);
+                                                 ProcessID(iter.Key()));
       }
     }
   }
 
   return NS_OK;
 }
 
 /**
@@ -3817,16 +3492,15 @@ TelemetryScalar::DeserializePersistedKey
     for (auto iter = scalarsToUpdate.ConstIter(); !iter.Done(); iter.Next()) {
       PersistedKeyedScalarArray& processScalars = iter.Data();
       for (PersistedKeyedScalarArray::size_type i = 0; i < processScalars.Length(); i++) {
         mozilla::Unused << internal_UpdateKeyedScalar(lock,
                                                       mozilla::Get<0>(processScalars[i]),
                                                       mozilla::Get<1>(processScalars[i]),
                                                       ScalarActionType::eSet,
                                                       mozilla::Get<2>(processScalars[i]),
-                                                      ProcessID(iter.Key()),
-                                                      true /* aForce */);
+                                                      ProcessID(iter.Key()));
       }
     }
   }
 
   return NS_OK;
 }
--- a/toolkit/components/telemetry/TelemetryScalar.h
+++ b/toolkit/components/telemetry/TelemetryScalar.h
@@ -91,16 +91,11 @@ void GetDynamicScalarDefinitions(nsTArra
 void AddDynamicScalarDefinitions(const nsTArray<mozilla::Telemetry::DynamicScalarDefinition>&);
 
 // They are responsible for updating in-memory probes with the data persisted
 // on the disk and vice-versa.
 nsresult SerializeScalars(mozilla::JSONWriter &aWriter);
 nsresult SerializeKeyedScalars(mozilla::JSONWriter &aWriter);
 nsresult DeserializePersistedScalars(JSContext* aCx, JS::HandleValue aData);
 nsresult DeserializePersistedKeyedScalars(JSContext* aCx, JS::HandleValue aData);
-// Mark deserialization as in progress.
-// After this, all scalar operations are recorded into the pending operations list.
-void DeserializationStarted();
-// Apply all operations from the pending operations list and mark deserialization finished afterwards.
-void ApplyPendingOperations();
 } // namespace TelemetryScalar
 
 #endif // TelemetryScalar_h__
--- a/toolkit/components/telemetry/docs/internals/geckoview.rst
+++ b/toolkit/components/telemetry/docs/internals/geckoview.rst
@@ -36,44 +36,16 @@ contained measurements are loaded in mem
   ``internal-telemetry-geckoview-load-complete`` topic is broadcasted to signal that loading
   is complete.
 
 Once the measurements are restored, their values will be dumped again to the persisted
 measurements file after the update interval expires. This interval is defined by the
 ``toolkit.telemetry.geckoPersistenceTimeout`` preference (defaults to 1 minute), see the
 :doc:`preferences docs <preferences>`.
 
-Scalar Semantics
-~~~~~~~~~~~~~~~~
-
-Data collection can start very early during the application life cycle and might overlap with the persistence deserialization.
-The Telemetry Core therefore takes additional steps to preserve the semantics of scalar operations.
-
-During deserialization of persisted measurements operations on scalar probes are not applied immediately, but recorded into a pending operations list.
-Once deserialization is finished, the pending operations are applied in the order they were recorded.
-This avoids any data race between operations and scalar values are always in a consistent state.
-Snapshots requests will only be fulfilled after the deserialization finished and all pending operations are applied.
-Consumers of the recorded data should therefore never see inconsistent data.
-
-An example:
-
-1. Scalar deserialization is started
-2. "test" scalar is incremented by "10" by the application -> The operation ``[test, add, 10]`` is recorded into the list.
-3. The state of the "test" scalar is loaded off the persistence file, and the value "14" is set.
-4. Deserialization is finished and the pending operations are applied.
-
-   * The "test" scalar is incremented by "10", the value is now "24"
-5. "test" scalar is incremented via "scalarAdd" by 1. Its value is "25"
-
-To stop growing unbounded in memory while waiting for scalar deserialization to finish, pending operations are applied
-immediately if the array reaches a high water mark of 10000 elements.
-At that point the deserialization is considered done and following scalar operatins will be applied immediately.
-In the case of the deserialization still being in progress, it might overwrite recorded values,
-leading to inconsistent data.
-
 The persistence file format
 ---------------------------
 All the supported measurements are serialized to the persistence file using the JSON format.
 The top level entries in the file are the measurement types. Each measurement section contains
 an entry for all the supported processes. Finally, each process section contains the measurement
 specific data required to restore its state in memory.
 
 .. code-block:: js
@@ -169,9 +141,8 @@ The following API is only exposed to the
 Version history
 ---------------
 
 
 - Firefox 62:
 
   - Initial GeckoView support and scalar persistence (`bug 1453591 <https://bugzilla.mozilla.org/show_bug.cgi?id=1453591>`_).
   - Persistence support for histograms (`bug 1457127 <https://bugzilla.mozilla.org/show_bug.cgi?id=1457127>`_).
-  - Preserve the semantics of scalar operations when restoring the persisted state (`bug 1454606 <https://bugzilla.mozilla.org/show_bug.cgi?id=1454606>`_)
--- a/toolkit/components/telemetry/geckoview/TelemetryGeckoViewPersistence.cpp
+++ b/toolkit/components/telemetry/geckoview/TelemetryGeckoViewPersistence.cpp
@@ -441,19 +441,16 @@ PersistenceThreadLoadData()
   nsAutoCString fileContent;
   auto scopedArmTimer = MakeScopeExit([&] {
     NS_DispatchToMainThread(
       NS_NewRunnableFunction("MainThreadArmPersistenceTimer", [fileContent]() -> void {
         // Try to parse the probes if the file was not empty.
         if (!fileContent.IsEmpty()) {
           MainThreadParsePersistedProbes(fileContent);
         }
-
-        TelemetryScalar::ApplyPendingOperations();
-
         // Arm the timer.
         MainThreadArmPersistenceTimer();
         // Notify that we're good to take snapshots!
         nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
         if (os) {
           os->NotifyObservers(nullptr, kLoadCompleteTopic, nullptr);
         }
       }));
@@ -511,19 +508,16 @@ TelemetryGeckoViewPersistence::InitPersi
     NS_NewNamedThread("TelemetryGVIO", getter_AddRefs(thread));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     ANDROID_LOG("InitPersistence -  Failed to instantiate the worker thread.");
     return;
   }
 
   gPersistenceThread = thread.forget();
 
-  // From now on all scalar operations should be recorded.
-  TelemetryScalar::DeserializationStarted();
-
   // Trigger the loading of the persistence data. After the function
   // completes it will automatically arm the persistence timer.
   gPersistenceThread->Dispatch(
     NS_NewRunnableFunction("PersistenceThreadLoadData", &PersistenceThreadLoadData));
 }
 
 void
 TelemetryGeckoViewPersistence::DeInitPersistence()
--- a/toolkit/components/telemetry/geckoview/gtest/TestGeckoView.cpp
+++ b/toolkit/components/telemetry/geckoview/gtest/TestGeckoView.cpp
@@ -470,178 +470,8 @@ TEST_F(TelemetryGeckoViewFixture, TimerH
 
   // Verify that the scalars were correctly persisted and restored.
   CheckUintScalar("telemetry.persistence_timer_hit_count", cx.GetJSContext(),
                   scalarsSnapshot, 2);
 
   // Cleanup/remove the files.
   RemovePersistenceFile();
 }
-
-TEST_F(TelemetryGeckoViewFixture, EmptyPendingOperations) {
-  AutoJSContextWithGlobal cx(mCleanGlobal);
-
-  Unused << mTelemetry->ClearScalars();
-
-  // Force loading mode
-  TelemetryScalar::DeserializationStarted();
-
-  // Do nothing explicitely
-
-  // Force pending operations to be applied and end load mode.
-  // It should not crash and don't change any scalars.
-  TelemetryScalar::ApplyPendingOperations();
-
-  // Check that the snapshot is empty
-  JS::RootedValue scalarsSnapshot(cx.GetJSContext());
-  GetScalarsSnapshot(false, cx.GetJSContext(), &scalarsSnapshot);
-
-  JS::RootedObject scalarsSnapshotObj(cx.GetJSContext(), &scalarsSnapshot.toObject());
-  ASSERT_TRUE(scalarsSnapshot.isUndefined()) << "Scalars snapshot should not contain any data.";
-}
-
-TEST_F(TelemetryGeckoViewFixture, SimpleAppendOperation) {
-  AutoJSContextWithGlobal cx(mCleanGlobal);
-
-  Unused << mTelemetry->ClearScalars();
-
-  // Set an initial value, so we can test that it is not overwritten.
-  uint32_t initialValue = 1;
-  Telemetry::ScalarSet(Telemetry::ScalarID::TELEMETRY_TEST_UNSIGNED_INT_KIND, initialValue);
-
-  // Force loading mode
-  TelemetryScalar::DeserializationStarted();
-
-  // Add to a scalar
-  uint32_t value = 37;
-  Telemetry::ScalarAdd(Telemetry::ScalarID::TELEMETRY_TEST_UNSIGNED_INT_KIND, value);
-
-  // Verify that this was not yet applied.
-  JS::RootedValue scalarsSnapshot(cx.GetJSContext());
-  GetScalarsSnapshot(false, cx.GetJSContext(), &scalarsSnapshot);
-
-  CheckUintScalar("telemetry.test.unsigned_int_kind", cx.GetJSContext(), scalarsSnapshot, initialValue);
-
-  // Force pending operations to be applied and end load mode
-  TelemetryScalar::ApplyPendingOperations();
-
-  // Verify recorded operations are applied
-  GetScalarsSnapshot(false, cx.GetJSContext(), &scalarsSnapshot);
-  CheckUintScalar("telemetry.test.unsigned_int_kind", cx.GetJSContext(), scalarsSnapshot, initialValue+value);
-}
-
-TEST_F(TelemetryGeckoViewFixture, ApplyPendingOperationsAfterLoad) {
-  AutoJSContextWithGlobal cx(mCleanGlobal);
-
-  Unused << mTelemetry->ClearScalars();
-
-  const char persistedData[] = R"({
- "scalars": {
-  "parent": {
-   "telemetry.test.unsigned_int_kind": 14
-  }
- }
-})";
-
-  // Force loading mode
-  TelemetryScalar::DeserializationStarted();
-
-  // Add to a scalar, this should be recorded
-  uint32_t addValue = 10;
-  Telemetry::ScalarAdd(Telemetry::ScalarID::TELEMETRY_TEST_UNSIGNED_INT_KIND, addValue);
-
-  // Load persistence file
-  RefPtr<DataLoadedObserver> loadingFinished = new DataLoadedObserver();
-  WritePersistenceFile(nsDependentCString(persistedData));
-  TelemetryGeckoViewPersistence::InitPersistence();
-  loadingFinished->WaitForNotification();
-
-  // At this point all pending operations should have been applied.
-
-  // Increment again, now directly applied
-  uint32_t val = 1;
-  Telemetry::ScalarAdd(Telemetry::ScalarID::TELEMETRY_TEST_UNSIGNED_INT_KIND, val);
-
-
-  JS::RootedValue scalarsSnapshot(cx.GetJSContext());
-  GetScalarsSnapshot(false, cx.GetJSContext(), &scalarsSnapshot);
-
-  uint32_t expectedValue = 25;
-  CheckUintScalar("telemetry.test.unsigned_int_kind", cx.GetJSContext(), scalarsSnapshot, expectedValue);
-}
-
-TEST_F(TelemetryGeckoViewFixture, MultipleAppendOperations) {
-  AutoJSContextWithGlobal cx(mCleanGlobal);
-
-  Unused << mTelemetry->ClearScalars();
-
-  // Force loading mode
-  TelemetryScalar::DeserializationStarted();
-
-  // Modify all kinds of scalars
-  uint32_t startValue = 35;
-  uint32_t expectedValue = 40;
-  Telemetry::ScalarSet(Telemetry::ScalarID::TELEMETRY_TEST_UNSIGNED_INT_KIND, startValue);
-  Telemetry::ScalarSetMaximum(Telemetry::ScalarID::TELEMETRY_TEST_UNSIGNED_INT_KIND, startValue + 2);
-  Telemetry::ScalarAdd(Telemetry::ScalarID::TELEMETRY_TEST_UNSIGNED_INT_KIND, 3);
-
-  Telemetry::ScalarSet(Telemetry::ScalarID::TELEMETRY_TEST_BOOLEAN_KIND, true);
-  Telemetry::ScalarSet(Telemetry::ScalarID::TELEMETRY_TEST_STRING_KIND, NS_LITERAL_STRING("Star Wars VI"));
-
-  // Modify all kinds of keyed scalars
-  Telemetry::ScalarSet(Telemetry::ScalarID::TELEMETRY_TEST_KEYED_UNSIGNED_INT,
-      NS_LITERAL_STRING("chewbacca"), startValue);
-  Telemetry::ScalarSetMaximum(Telemetry::ScalarID::TELEMETRY_TEST_KEYED_UNSIGNED_INT,
-      NS_LITERAL_STRING("chewbacca"), startValue + 2);
-  Telemetry::ScalarAdd(Telemetry::ScalarID::TELEMETRY_TEST_KEYED_UNSIGNED_INT,
-      NS_LITERAL_STRING("chewbacca"), 3);
-
-  Telemetry::ScalarSet(Telemetry::ScalarID::TELEMETRY_TEST_KEYED_BOOLEAN_KIND,
-      NS_LITERAL_STRING("chewbacca"),
-      true);
-
-  // Force pending operations to be applied and end load mode
-  TelemetryScalar::ApplyPendingOperations();
-
-  JS::RootedValue scalarsSnapshot(cx.GetJSContext());
-  JS::RootedValue keyedScalarsSnapshot(cx.GetJSContext());
-  GetScalarsSnapshot(false, cx.GetJSContext(), &scalarsSnapshot);
-  GetScalarsSnapshot(true, cx.GetJSContext(), &keyedScalarsSnapshot);
-
-  CheckUintScalar("telemetry.test.unsigned_int_kind", cx.GetJSContext(), scalarsSnapshot, expectedValue);
-  CheckBoolScalar("telemetry.test.boolean_kind", cx.GetJSContext(), scalarsSnapshot, true);
-  CheckStringScalar("telemetry.test.string_kind", cx.GetJSContext(), scalarsSnapshot, "Star Wars VI");
-
-  CheckKeyedUintScalar("telemetry.test.keyed_unsigned_int", "chewbacca",
-      cx.GetJSContext(), keyedScalarsSnapshot, expectedValue);
-  CheckKeyedBoolScalar("telemetry.test.keyed_boolean_kind", "chewbacca",
-      cx.GetJSContext(), keyedScalarsSnapshot, true);
-}
-
-TEST_F(TelemetryGeckoViewFixture, PendingOperationsHighWater) {
-  AutoJSContextWithGlobal cx(mCleanGlobal);
-
-  Unused << mTelemetry->ClearScalars();
-
-  uint32_t initialValue = 0;
-  Telemetry::ScalarSet(Telemetry::ScalarID::TELEMETRY_TEST_UNSIGNED_INT_KIND, initialValue);
-
-  // Force loading mode
-  TelemetryScalar::DeserializationStarted();
-
-  // Fill up the pending operations list
-  uint32_t expectedValue = 10000;
-  for (uint32_t i=0; i < expectedValue; i++) {
-    Telemetry::ScalarAdd(Telemetry::ScalarID::TELEMETRY_TEST_UNSIGNED_INT_KIND, 1);
-  }
-
-  // Nothing should be applied yet
-  JS::RootedValue scalarsSnapshot(cx.GetJSContext());
-  GetScalarsSnapshot(false, cx.GetJSContext(), &scalarsSnapshot);
-  CheckUintScalar("telemetry.test.unsigned_int_kind", cx.GetJSContext(), scalarsSnapshot, 0);
-
-  // Spill over the buffer to immediately apply all operations
-  Telemetry::ScalarAdd(Telemetry::ScalarID::TELEMETRY_TEST_UNSIGNED_INT_KIND, 1);
-
-  // Now we should see all values
-  GetScalarsSnapshot(false, cx.GetJSContext(), &scalarsSnapshot);
-  CheckUintScalar("telemetry.test.unsigned_int_kind", cx.GetJSContext(), scalarsSnapshot, expectedValue+1);
-}
--- a/toolkit/components/telemetry/ipc/TelemetryComms.h
+++ b/toolkit/components/telemetry/ipc/TelemetryComms.h
@@ -5,17 +5,16 @@
 
 #ifndef Telemetry_Comms_h__
 #define Telemetry_Comms_h__
 
 #include "ipc/IPCMessageUtils.h"
 #include "nsITelemetry.h"
 #include "nsVariant.h"
 #include "mozilla/TimeStamp.h"
-#include "mozilla/TelemetryProcessEnums.h"
 
 namespace mozilla {
 namespace Telemetry {
 
 // Histogram accumulation types.
 enum HistogramID : uint32_t;
 
 struct HistogramAccumulation
@@ -45,33 +44,27 @@ typedef mozilla::Variant<uint32_t, bool,
 struct ScalarAction
 {
   uint32_t mId;
   bool mDynamic;
   ScalarActionType mActionType;
   // We need to wrap mData in a Maybe otherwise the IPC system
   // is unable to instantiate a ScalarAction.
   Maybe<ScalarVariant> mData;
-  // The process type this scalar should be recorded for.
-  // The IPC system will determine the process this action was coming from later.
-  mozilla::Telemetry::ProcessID mProcessType;
 };
 
 struct KeyedScalarAction
 {
   uint32_t mId;
   bool mDynamic;
   ScalarActionType mActionType;
   nsCString mKey;
   // We need to wrap mData in a Maybe otherwise the IPC system
   // is unable to instantiate a ScalarAction.
   Maybe<ScalarVariant> mData;
-  // The process type this scalar should be recorded for.
-  // The IPC system will determine the process this action was coming from later.
-  mozilla::Telemetry::ProcessID mProcessType;
 };
 
 // Dynamic scalars support.
 struct DynamicScalarDefinition
 {
   uint32_t type;
   uint32_t dataset;
   bool expired;
--- a/toolkit/components/telemetry/ipc/TelemetryIPCAccumulator.cpp
+++ b/toolkit/components/telemetry/ipc/TelemetryIPCAccumulator.cpp
@@ -186,18 +186,18 @@ TelemetryIPCAccumulator::RecordChildScal
   if (gChildScalarsActions->Length() >=
       kWaterMarkDiscardFactor * kScalarActionsArrayHighWaterMark) {
     gDiscardedData.mDiscardedScalarActions++;
     return;
   }
   if (gChildScalarsActions->Length() == kScalarActionsArrayHighWaterMark) {
     DispatchIPCTimerFired();
   }
-  // Store the action. The ProcessID will be determined by the receiver.
-  gChildScalarsActions->AppendElement(ScalarAction{aId, aDynamic, aAction, Some(aValue), Telemetry::ProcessID::Count});
+  // Store the action.
+  gChildScalarsActions->AppendElement(ScalarAction{aId, aDynamic, aAction, Some(aValue)});
   ArmIPCTimer(locker);
 }
 
 void
 TelemetryIPCAccumulator::RecordChildKeyedScalarAction(uint32_t aId, bool aDynamic,
                                                       const nsAString& aKey,
                                                       ScalarActionType aAction,
                                                       const ScalarVariant& aValue)
@@ -210,19 +210,19 @@ TelemetryIPCAccumulator::RecordChildKeye
   if (gChildKeyedScalarsActions->Length() >=
       kWaterMarkDiscardFactor * kScalarActionsArrayHighWaterMark) {
     gDiscardedData.mDiscardedKeyedScalarActions++;
     return;
   }
   if (gChildKeyedScalarsActions->Length() == kScalarActionsArrayHighWaterMark) {
     DispatchIPCTimerFired();
   }
-  // Store the action. The ProcessID will be determined by the receiver.
+  // Store the action.
   gChildKeyedScalarsActions->AppendElement(
-    KeyedScalarAction{aId, aDynamic, aAction, NS_ConvertUTF16toUTF8(aKey), Some(aValue), Telemetry::ProcessID::Count});
+    KeyedScalarAction{aId, aDynamic, aAction, NS_ConvertUTF16toUTF8(aKey), Some(aValue)});
   ArmIPCTimer(locker);
 }
 
 void
 TelemetryIPCAccumulator::RecordChildEvent(const mozilla::TimeStamp& timestamp,
                                           const nsACString& category,
                                           const nsACString& method,
                                           const nsACString& object,