Backed out changeset 223a0be48369 (bug 1313326)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Wed, 01 Mar 2017 19:47:19 +0100
changeset 345348 a54020e769ed87a70568aebaf01cbc6aa205b311
parent 345347 a756569e4a3c12b7ce5b34ddf9437f7ac64f64bc
child 345349 5a561476eed268ed19b7364e15be437254ad89c8
push id87567
push userarchaeopteryx@coole-files.de
push dateWed, 01 Mar 2017 18:48:28 +0000
treeherdermozilla-inbound@5a561476eed2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1313326
milestone54.0a1
backs out223a0be483694b387c57f662a4639da28dab3a97
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 changeset 223a0be48369 (bug 1313326)
toolkit/components/telemetry/EventInfo.h
toolkit/components/telemetry/Events.yaml
toolkit/components/telemetry/ScalarInfo.h
toolkit/components/telemetry/TelemetryCommon.cpp
toolkit/components/telemetry/TelemetryCommon.h
toolkit/components/telemetry/TelemetryEvent.cpp
toolkit/components/telemetry/TelemetryScalar.cpp
toolkit/components/telemetry/gen-event-data.py
toolkit/components/telemetry/parse_events.py
toolkit/components/telemetry/parse_scalars.py
toolkit/components/telemetry/shared_telemetry_utils.py
toolkit/components/telemetry/tests/unit/test_ChildEvents.js
--- a/toolkit/components/telemetry/EventInfo.h
+++ b/toolkit/components/telemetry/EventInfo.h
@@ -1,18 +1,16 @@
 /* -*-  Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef TelemetryEventInfo_h__
 #define TelemetryEventInfo_h__
 
-#include "TelemetryCommon.h"
-
 // This module is internal to Telemetry. The structures here hold data that
 // describe events.
 // It should only be used by TelemetryEventData.h and TelemetryEvent.cpp.
 //
 // For the public interface to Telemetry functionality, see Telemetry.h.
 
 namespace {
 
@@ -26,19 +24,16 @@ struct CommonEventInfo {
   uint32_t extra_count;
 
   // The day since UNIX epoch that this probe expires on.
   uint32_t expiration_day;
 
   // The dataset this event is recorded in.
   uint32_t dataset;
 
-  // Which processes to record this event in.
-  mozilla::Telemetry::Common::RecordedProcessType record_in_processes;
-
   // Convenience functions for accessing event strings.
   const char* expiration_version() const;
   const char* category() const;
   const char* extra_key(uint32_t index) const;
 };
 
 struct EventInfo {
   // The corresponding CommonEventInfo.
--- a/toolkit/components/telemetry/Events.yaml
+++ b/toolkit/components/telemetry/Events.yaml
@@ -1,14 +1,13 @@
 navigation:
   search:
     objects: ["about_home", "about_newtab", "contextmenu", "oneoff",
               "suggestion", "alias", "enter", "searchbar", "urlbar"]
     release_channel_collection: opt-in
-    record_in_processes: ["main"]
     description: >
       This is recorded on each search navigation.
       The value field records the action used to trigger the search:
         "enter", "oneoff", "suggestion", "alias", null (for contextmenu)
     bug_numbers: [1316281]
     notification_emails: ["past@mozilla.com"]
     expiry_version: "58.0"
     extra_keys:
@@ -17,84 +16,54 @@ navigation:
 # This category contains event entries used for Telemetry tests.
 # They will not be sent out with any pings.
 telemetry.test:
   test:
     methods: ["test1", "test2"]
     objects: ["object1", "object2"]
     bug_numbers: [1286606]
     notification_emails: ["telemetry-client-dev@mozilla.com"]
-    record_in_processes: ["main"]
     description: This is a test entry for Telemetry.
     expiry_date: never
     extra_keys:
       key1: This is just a test description.
       key2: This is another test description.
   optout:
     objects: ["object1", "object2"]
     bug_numbers: [1286606]
     notification_emails: ["telemetry-client-dev@mozilla.com"]
-    release_channel_collection: opt-out
-    record_in_processes: ["main"]
     description: This is an opt-out test entry.
     expiry_date: never
+    release_channel_collection: opt-out
     extra_keys:
       key1: This is just a test description.
   expired_version:
     objects: ["object1", "object2"]
     bug_numbers: [1286606]
     notification_emails: ["telemetry-client-dev@mozilla.com"]
-    record_in_processes: ["main"]
     description: This is a test entry with an expired version.
     expiry_version: "3.6"
   expired_date:
     objects: ["object1", "object2"]
     bug_numbers: [1286606]
     notification_emails: ["telemetry-client-dev@mozilla.com"]
-    record_in_processes: ["main"]
     description: This is a test entry with an expired date.
     expiry_date: 2014-01-28
   not_expired_optout:
     objects: ["object1"]
     bug_numbers: [1286606]
     notification_emails: ["telemetry-client-dev@mozilla.com"]
     description: This is an opt-out test entry with unexpired date and version.
     release_channel_collection: opt-out
-    record_in_processes: ["main"]
     expiry_date: 2099-01-01
     expiry_version: "999.0"
-  main_only:
-    objects: ["object1"]
-    bug_numbers: [1313326]
-    notification_emails: ["telemetry-client-dev@mozilla.com"]
-    record_in_processes: ["main"]
-    description: This event is used to test main-process only recording.
-    expiry_version: never
-  content_only:
-    objects: ["object1"]
-    bug_numbers: [1313326]
-    notification_emails: ["telemetry-client-dev@mozilla.com"]
-    record_in_processes: ["content"]
-    description: This event is used to test content-process only recording.
-    expiry_version: never
-    extra_keys:
-      foo: This is just a test description.
-      bar: And this is another test description.
-  main_and_content:
-    objects: ["object1"]
-    bug_numbers: [1313326]
-    notification_emails: ["telemetry-client-dev@mozilla.com"]
-    record_in_processes: ["main", "content"]
-    description: This event is used to test main and content process recording.
-    expiry_version: never
 
 # This is a secondary category used for Telemetry tests.
 # The events here will not be sent out with any pings.
 telemetry.test.second:
   test:
     objects: ["object1", "object2", "object3"]
     bug_numbers: [1286606]
     notification_emails: ["telemetry-client-dev@mozilla.com"]
-    record_in_processes: ["main"]
     description: This is a test entry for Telemetry.
     expiry_date: never
     extra_keys:
       key1: This is just a test description.
--- a/toolkit/components/telemetry/ScalarInfo.h
+++ b/toolkit/components/telemetry/ScalarInfo.h
@@ -1,32 +1,40 @@
 /* -*-  Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef TelemetryScalarInfo_h__
 #define TelemetryScalarInfo_h__
 
-#include "TelemetryCommon.h"
+#include "nsXULAppAPI.h"
 
 // This module is internal to Telemetry. It defines a structure that holds the
 // scalar info. It should only be used by TelemetryScalarData.h automatically
 // generated file and TelemetryScalar.cpp. This should not be used anywhere else.
 // For the public interface to Telemetry functionality, see Telemetry.h.
 
 namespace {
 
+enum class RecordedProcessType : uint32_t {
+  Main       = (1 << GeckoProcessType_Default),  // Also known as "parent process"
+  Content    = (1 << GeckoProcessType_Content),
+  Gpu        = (1 << GeckoProcessType_GPU),
+  AllChilds  = 0xFFFFFFFF - 1,  // All the children processes (i.e. content, gpu, ...)
+  All        = 0xFFFFFFFF       // All the processes
+};
+MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RecordedProcessType)
+
 struct ScalarInfo {
   uint32_t kind;
   uint32_t name_offset;
   uint32_t expiration_offset;
   uint32_t dataset;
-  mozilla::Telemetry::Common::RecordedProcessType record_in_processes;
+  RecordedProcessType record_in_processes;
   bool keyed;
 
   const char *name() const;
   const char *expiration() const;
 };
-
 } // namespace
 
 #endif // TelemetryScalarInfo_h__
--- a/toolkit/components/telemetry/TelemetryCommon.cpp
+++ b/toolkit/components/telemetry/TelemetryCommon.cpp
@@ -61,28 +61,16 @@ CanRecordDataset(uint32_t aDataset, bool
       return true;
   }
 
   // We're not recording extended telemetry or this is not the base
   // dataset. Bail out.
   return false;
 }
 
-bool
-CanRecordInProcess(RecordedProcessType processes, GeckoProcessType processType)
-{
-  bool recordAllChild = !!(processes & RecordedProcessType::AllChilds);
-  // We can use (1 << ProcessType) due to the way RecordedProcessType is defined.
-  bool canRecordProcess =
-    !!(processes & static_cast<RecordedProcessType>(1 << processType));
-
-  return canRecordProcess ||
-         ((processType != GeckoProcessType_Default) && recordAllChild);
-}
-
 nsresult
 MsSinceProcessStart(double* aResult)
 {
   bool error;
   *aResult = (TimeStamp::NowLoRes() -
               TimeStamp::ProcessCreation(error)).ToMilliseconds();
   if (error) {
     return NS_ERROR_NOT_AVAILABLE;
--- a/toolkit/components/telemetry/TelemetryCommon.h
+++ b/toolkit/components/telemetry/TelemetryCommon.h
@@ -4,32 +4,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef TelemetryCommon_h__
 #define TelemetryCommon_h__
 
 #include "nsTHashtable.h"
 #include "jsapi.h"
 #include "nsIScriptError.h"
-#include "nsXULAppAPI.h"
-#include "mozilla/TypedEnumBits.h"
 
 namespace mozilla {
 namespace Telemetry {
 namespace Common {
 
-enum class RecordedProcessType : uint32_t {
-  Main       = (1 << GeckoProcessType_Default),  // Also known as "parent process"
-  Content    = (1 << GeckoProcessType_Content),
-  Gpu        = (1 << GeckoProcessType_GPU),
-  AllChilds  = 0xFFFFFFFF - 1,  // All the children processes (i.e. content, gpu, ...)
-  All        = 0xFFFFFFFF       // All the processes
-};
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(RecordedProcessType);
-
 template<class EntryType>
 class AutoHashtable : public nsTHashtable<EntryType>
 {
 public:
   explicit AutoHashtable(uint32_t initLength =
                          PLDHashTable::kDefaultInitialLength);
   typedef bool (*ReflectEntryFunc)(EntryType *entry, JSContext *cx, JS::Handle<JSObject*> obj);
   bool ReflectIntoJS(ReflectEntryFunc entryFunc, JSContext *cx, JS::Handle<JSObject*> obj);
@@ -56,17 +45,16 @@ AutoHashtable<EntryType>::ReflectIntoJS(
     }
   }
   return true;
 }
 
 bool IsExpiredVersion(const char* aExpiration);
 bool IsInDataset(uint32_t aDataset, uint32_t aContainingDataset);
 bool CanRecordDataset(uint32_t aDataset, bool aCanRecordBase, bool aCanRecordExtended);
-bool CanRecordInProcess(RecordedProcessType aProcesses, GeckoProcessType aProcess);
 
 /**
  * Return the number of milliseconds since process start using monotonic
  * timestamps (unaffected by system clock changes).
  *
  * @return NS_OK on success, NS_ERROR_NOT_AVAILABLE if TimeStamp doesn't have the data.
  */
 nsresult MsSinceProcessStart(double* aResult);
--- a/toolkit/components/telemetry/TelemetryEvent.cpp
+++ b/toolkit/components/telemetry/TelemetryEvent.cpp
@@ -32,17 +32,16 @@ using mozilla::Maybe;
 using mozilla::Nothing;
 using mozilla::StaticAutoPtr;
 using mozilla::Telemetry::Common::AutoHashtable;
 using mozilla::Telemetry::Common::IsExpiredVersion;
 using mozilla::Telemetry::Common::CanRecordDataset;
 using mozilla::Telemetry::Common::IsInDataset;
 using mozilla::Telemetry::Common::MsSinceProcessStart;
 using mozilla::Telemetry::Common::LogToBrowserConsole;
-using mozilla::Telemetry::Common::CanRecordInProcess;
 using mozilla::Telemetry::EventExtraEntry;
 using mozilla::Telemetry::ChildEventData;
 
 namespace TelemetryIPCAccumulator = mozilla::TelemetryIPCAccumulator;
 
 ////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////
 //
@@ -102,18 +101,16 @@ const uint32_t kMaxExtraValueByteLength 
 typedef nsDataHashtable<nsCStringHashKey, uint32_t> StringUintMap;
 typedef nsClassHashtable<nsCStringHashKey, nsCString> StringMap;
 
 enum class RecordEventResult {
   Ok,
   UnknownEvent,
   InvalidExtraKey,
   StorageLimitReached,
-  ExpiredEvent,
-  WrongProcess,
 };
 
 typedef nsTArray<EventExtraEntry> ExtraArray;
 
 class EventRecord {
 public:
   EventRecord(double timestamp, uint32_t eventId, const Maybe<nsCString>& value,
               const ExtraArray& extra)
@@ -271,85 +268,71 @@ nsClassHashtable<nsUint32HashKey, EventR
 ////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////
 //
 // PRIVATE: thread-safe helpers for event recording.
 
 namespace {
 
 bool
-CanRecordEvent(const StaticMutexAutoLock& lock, const CommonEventInfo& info,
-               GeckoProcessType process)
+CanRecordEvent(const StaticMutexAutoLock& lock, const CommonEventInfo& info)
 {
   if (!gCanRecordBase) {
     return false;
   }
 
   if (!CanRecordDataset(info.dataset, gCanRecordBase, gCanRecordExtended)) {
     return false;
   }
 
-  if (!CanRecordInProcess(info.record_in_processes, process)) {
-    return false;
-  }
-
   return gEnabledCategories.GetEntry(info.category_offset);
 }
 
 EventRecordArray*
 GetEventRecordsForProcess(const StaticMutexAutoLock& lock, GeckoProcessType processType)
 {
   EventRecordArray* eventRecords = nullptr;
   if (!gEventRecords.Get(processType, &eventRecords)) {
     eventRecords = new EventRecordArray();
     gEventRecords.Put(processType, eventRecords);
   }
   return eventRecords;
 }
 
-bool
-GetEventId(const StaticMutexAutoLock& lock, const nsACString& category,
-           const nsACString& method, const nsACString& object,
-           uint32_t* eventId)
-{
-  MOZ_ASSERT(eventId);
-  const nsCString& name = UniqueEventName(category, method, object);
-  return gEventNameIDMap.Get(name, eventId);
-}
-
 RecordEventResult
 RecordEvent(const StaticMutexAutoLock& lock, GeckoProcessType processType,
             double timestamp, const nsACString& category,
             const nsACString& method, const nsACString& object,
             const Maybe<nsCString>& value, const ExtraArray& extra)
 {
   EventRecordArray* eventRecords = GetEventRecordsForProcess(lock, processType);
 
   // Apply hard limit on event count in storage.
   if (eventRecords->Length() >= kMaxEventRecords) {
     return RecordEventResult::StorageLimitReached;
   }
 
   // Look up the event id.
+  const nsCString& name = UniqueEventName(category, method, object);
   uint32_t eventId;
-  if (!GetEventId(lock, category, method, object, &eventId)) {
+  if (!gEventNameIDMap.Get(name, &eventId)) {
     return RecordEventResult::UnknownEvent;
   }
 
-  // If the event is expired or not enabled for this process, we silently drop this call.
+  // If the event is expired, silently drop this call.
   // We don't want recording for expired probes to be an error so code doesn't
   // have to be removed at a specific time or version.
   // Even logging warnings would become very noisy.
   if (eventId == kExpiredEventId) {
-    return RecordEventResult::ExpiredEvent;
+    return RecordEventResult::Ok;
   }
 
   // Check whether we can record this event.
   const CommonEventInfo& common = gEventInfo[eventId].common_info;
-  if (!CanRecordEvent(lock, common, processType)) {
+  if (!CanRecordEvent(lock, common)) {
     return RecordEventResult::Ok;
   }
 
   // Check whether the extra keys passed are valid.
   nsTHashtable<nsCStringHashKey> validExtraKeys;
   for (uint32_t i = 0; i < common.extra_count; ++i) {
     validExtraKeys.PutEntry(nsDependentCString(common.extra_key(i)));
   }
@@ -360,37 +343,16 @@ RecordEvent(const StaticMutexAutoLock& l
     }
   }
 
   // Add event record.
   eventRecords->AppendElement(EventRecord(timestamp, eventId, value, extra));
   return RecordEventResult::Ok;
 }
 
-RecordEventResult
-ShouldRecordChildEvent(const StaticMutexAutoLock& lock, const nsACString& category,
-                       const nsACString& method, const nsACString& object)
-{
-  uint32_t eventId;
-  if (!GetEventId(lock, category, method, object, &eventId)) {
-    return RecordEventResult::UnknownEvent;
-  }
-
-  if (eventId == kExpiredEventId) {
-    return RecordEventResult::ExpiredEvent;
-  }
-
-  const auto processes = gEventInfo[eventId].common_info.record_in_processes;
-  if (!CanRecordInProcess(processes, XRE_GetProcessType())) {
-    return RecordEventResult::WrongProcess;
-  }
-
-  return RecordEventResult::Ok;
-}
-
 } // anonymous namespace
 
 ////////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////////
 //
 // PRIVATE: thread-unsafe helpers for event handling.
 
 namespace {
@@ -518,19 +480,18 @@ TelemetryEvent::InitializeGlobalState(bo
 
   // Populate the static event name->id cache. Note that the event names are
   // statically allocated and come from the automatically generated TelemetryEventData.h.
   const uint32_t eventCount = static_cast<uint32_t>(mozilla::Telemetry::EventID::EventCount);
   for (uint32_t i = 0; i < eventCount; ++i) {
     const EventInfo& info = gEventInfo[i];
     uint32_t eventId = i;
 
-    // If this event is expired or not recorded in this process, mark it with
-    // a special event id.
-    // This avoids doing repeated checks at runtime.
+    // If this event is expired, mark it with a special event id.
+    // This avoids doing expensive expiry checks at runtime.
     if (IsExpiredVersion(info.common_info.expiration_version()) ||
         IsExpiredDate(info.common_info.expiration_day)) {
       eventId = kExpiredEventId;
     }
 
     gEventNameIDMap.Put(UniqueEventName(info), eventId);
     if (!gCategoryNameIDMap.Contains(nsDependentCString(info.common_info.category()))) {
       gCategoryNameIDMap.Put(nsDependentCString(info.common_info.category()),
@@ -675,30 +636,26 @@ TelemetryEvent::RecordEvent(const nsACSt
                             NS_LITERAL_STRING("Extra value exceeds maximum string length, truncating."));
         TruncateToByteLength(str, kMaxExtraValueByteLength);
       }
 
       extra.AppendElement(EventExtraEntry{NS_ConvertUTF16toUTF8(key), str});
     }
   }
 
+  if (!XRE_IsParentProcess()) {
+    TelemetryIPCAccumulator::RecordChildEvent(timestamp, aCategory, aMethod, aObject, value, extra);
+    return NS_OK;
+  }
+
   // Lock for accessing internal data.
   // While the lock is being held, no complex calls like JS calls can be made,
   // as all of these could record Telemetry, which would result in deadlock.
   RecordEventResult res;
-  if (!XRE_IsParentProcess()) {
-    {
-      StaticMutexAutoLock lock(gTelemetryEventsMutex);
-      res = ::ShouldRecordChildEvent(lock, aCategory, aMethod, aObject);
-    }
-
-    if (res == RecordEventResult::Ok) {
-      TelemetryIPCAccumulator::RecordChildEvent(timestamp, aCategory, aMethod, aObject, value, extra);
-    }
-  } else {
+  {
     StaticMutexAutoLock lock(gTelemetryEventsMutex);
 
     if (!gInitDone) {
       return NS_ERROR_FAILURE;
     }
 
     res = ::RecordEvent(lock, GeckoProcessType_Default, timestamp, aCategory, aMethod, aObject, value, extra);
   }
--- a/toolkit/components/telemetry/TelemetryScalar.cpp
+++ b/toolkit/components/telemetry/TelemetryScalar.cpp
@@ -896,18 +896,26 @@ internal_IsKeyedScalar(mozilla::Telemetr
  *
  * @param aId The id of the scalar to check.
  * @return true if the scalar is allowed to be recorded in the current process, false
  *         otherwise.
  */
 bool
 internal_CanRecordProcess(mozilla::Telemetry::ScalarID aId)
 {
+  // Get the scalar info from the id.
   const ScalarInfo &info = internal_InfoForScalarID(aId);
-  return CanRecordInProcess(info.record_in_processes, XRE_GetProcessType());
+
+  bool recordAllChild = !!(info.record_in_processes & RecordedProcessType::AllChilds);
+  // We can use (1 << ProcessType) due to the way RecordedProcessType is defined
+  // in ScalarInfo.h
+  bool canRecordProcess =
+    !!(info.record_in_processes & static_cast<RecordedProcessType>(1 << XRE_GetProcessType()));
+
+  return canRecordProcess || (!XRE_IsParentProcess() && recordAllChild);
 }
 
 bool
 internal_CanRecordForScalarID(mozilla::Telemetry::ScalarID aId)
 {
   // Get the scalar info from the id.
   const ScalarInfo &info = internal_InfoForScalarID(aId);
 
--- a/toolkit/components/telemetry/gen-event-data.py
+++ b/toolkit/components/telemetry/gen-event-data.py
@@ -68,24 +68,23 @@ def write_common_event_table(events, out
     print("const CommonEventInfo %s[] = {" % table_name, file=output)
     for e,extras in zip(events, extra_table):
         # Write a comment to make the file human-readable.
         print("  // category: %s" % e.category, file=output)
         print("  // methods: [%s]" % ", ".join(e.methods), file=output)
         print("  // objects: [%s]" % ", ".join(e.objects), file=output)
 
         # Write the common info structure
-        print("  {%d, %d, %d, %d, %d, %s, %s}," %
+        print("  {%d, %d, %d, %d, %d, %s}," %
                 (string_table.stringIndex(e.category),
                  string_table.stringIndex(e.expiry_version),
                  extras[0], # extra keys index
                  extras[1], # extra keys count
                  e.expiry_day,
-                 e.dataset,
-                 " | ".join(e.record_in_processes_enum)),
+                 e.dataset),
               file=output)
 
     print("};", file=output)
     static_assert(output, "sizeof(%s) <= UINT32_MAX" % table_name,
                   "index overflow")
 
 def write_event_table(events, output, string_table):
     table_name = "gEventInfo"
--- a/toolkit/components/telemetry/parse_events.py
+++ b/toolkit/components/telemetry/parse_events.py
@@ -2,17 +2,17 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import re
 import yaml
 import itertools
 import datetime
 import string
-import shared_telemetry_utils as utils
+from shared_telemetry_utils import add_expiration_postfix
 
 MAX_CATEGORY_NAME_LENGTH = 30
 MAX_METHOD_NAME_LENGTH = 20
 MAX_OBJECT_NAME_LENGTH = 20
 MAX_EXTRA_KEYS_COUNT = 10
 MAX_EXTRA_KEY_NAME_LENGTH = 15
 
 IDENTIFIER_PATTERN = r'^[a-zA-Z][a-zA-Z0-9_.]+[a-zA-Z0-9]$'
@@ -93,17 +93,16 @@ class TypeChecker:
                                        nice_type_name(type(x)))
 
 def type_check_event_fields(identifier, name, definition):
     """Perform a type/schema check on the event definition."""
     REQUIRED_FIELDS = {
         'objects': TypeChecker(list, basestring),
         'bug_numbers': TypeChecker(list, int),
         'notification_emails': TypeChecker(list, basestring),
-        'record_in_processes': TypeChecker(list, basestring),
         'description': TypeChecker(basestring),
     }
     OPTIONAL_FIELDS = {
         'methods': TypeChecker(list, basestring),
         'release_channel_collection': TypeChecker(basestring),
         'expiry_date': TypeChecker(OneOf, basestring, datetime.date),
         'expiry_version': TypeChecker(basestring),
         'extra_keys': TypeChecker(dict, basestring, basestring),
@@ -161,22 +160,16 @@ class EventData:
         # Check release_channel_collection
         rcc_key = 'release_channel_collection'
         rcc = definition.get(rcc_key, 'opt-in')
         allowed_rcc = ["opt-in", "opt-out"]
         if not rcc in allowed_rcc:
             raise ValueError, "%s: value for %s should be one of: %s" %\
                               (self.identifier, rcc_key, ", ".join(allowed_rcc))
 
-        # Check record_in_processes.
-        record_in_processes = definition.get('record_in_processes')
-        for proc in record_in_processes:
-            if not utils.is_valid_process_name(proc):
-                raise ValueError(self.identifier + ': unknown value in record_in_processes: ' + proc)
-
         # Check extra_keys.
         extra_keys = definition.get('extra_keys', {})
         if len(extra_keys.keys()) > MAX_EXTRA_KEYS_COUNT:
             raise ValueError, "%s: number of extra_keys exceeds limit %d" %\
                               (self.identifier, MAX_EXTRA_KEYS_COUNT)
         for key in extra_keys.iterkeys():
             string_check(self.identifier, field='extra_keys', value=key,
                          min_length=1, max_length=MAX_EXTRA_KEY_NAME_LENGTH,
@@ -190,17 +183,17 @@ class EventData:
         if expiry_date and isinstance(expiry_date, basestring) and expiry_date != 'never':
             if not re.match(DATE_PATTERN, expiry_date):
                 raise ValueError, "%s: event has invalid expiry_date, it should be either 'never' or match this format: %s" %\
                                   (self.identifier, DATE_PATTERN)
             # Parse into date.
             definition['expiry_date'] = datetime.datetime.strptime(expiry_date, '%Y-%m-%d')
 
         # Finish setup.
-        definition['expiry_version'] = utils.add_expiration_postfix(definition.get('expiry_version', 'never'))
+        definition['expiry_version'] = add_expiration_postfix(definition.get('expiry_version', 'never'))
 
     @property
     def category(self):
         return self._category
 
     @property
     def category_cpp(self):
         # Transform e.g. category.example into CategoryExample.
@@ -218,25 +211,16 @@ class EventData:
     def methods(self):
         return self._definition.get('methods', [self.name])
 
     @property
     def objects(self):
         return self._definition.get('objects')
 
     @property
-    def record_in_processes(self):
-        return self._definition.get('record_in_processes')
-
-    @property
-    def record_in_processes_enum(self):
-        """Get the non-empty list of flags representing the processes to record data in"""
-        return [utils.process_name_to_enum(p) for p in self.record_in_processes]
-
-    @property
     def expiry_version(self):
         return self._definition.get('expiry_version')
 
     @property
     def expiry_day(self):
         date = self._definition.get('expiry_date')
         if not date:
             return 0
--- a/toolkit/components/telemetry/parse_scalars.py
+++ b/toolkit/components/telemetry/parse_scalars.py
@@ -1,41 +1,51 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import re
 import yaml
-import shared_telemetry_utils as utils
+from shared_telemetry_utils import add_expiration_postfix
 
 # The map of containing the allowed scalar types and their mapping to
 # nsITelemetry::SCALAR_* type constants.
 SCALAR_TYPES_MAP = {
     'uint': 'nsITelemetry::SCALAR_COUNT',
     'string': 'nsITelemetry::SCALAR_STRING',
     'boolean': 'nsITelemetry::SCALAR_BOOLEAN'
 }
 
+# This is a list of flags that determine which process the scalar is allowed
+# to record from.
+KNOWN_PROCESS_FLAGS = {
+    'all': 'RecordedProcessType::All',
+    'all_childs': 'RecordedProcessType::AllChilds',
+    'main': 'RecordedProcessType::Main',
+    'content': 'RecordedProcessType::Content',
+    'gpu': 'RecordedProcessType::Gpu',
+}
+
 class ScalarType:
     """A class for representing a scalar definition."""
 
     def __init__(self, group_name, probe_name, definition):
         # Validate and set the name, so we don't need to pass it to the other
         # validation functions.
         self.validate_names(group_name, probe_name)
         self._name = probe_name
         self._group_name = group_name
 
         # Validating the scalar definition.
         self.validate_types(definition)
         self.validate_values(definition)
 
         # Everything is ok, set the rest of the data.
         self._definition = definition
-        definition['expires'] = utils.add_expiration_postfix(definition['expires'])
+        definition['expires'] = add_expiration_postfix(definition['expires'])
 
     def validate_names(self, group_name, probe_name):
         """Validate the group and probe name:
             - Group name must be alpha-numeric + '.', no leading/trailing digit or '.'.
             - Probe name must be alpha-numeric + '_', no leading/trailing digit or '_'.
 
         :param group_name: the name of the group the probe is in.
         :param probe_name: the name of the scalar probe.
@@ -153,17 +163,17 @@ class ScalarType:
         # Validate the cpp_guard.
         cpp_guard = definition.get('cpp_guard')
         if cpp_guard and re.match(r'\W', cpp_guard):
             raise ValueError(self._name + ' - invalid cpp_guard: ' + cpp_guard)
 
         # Validate record_in_processes.
         record_in_processes = definition.get('record_in_processes', [])
         for proc in record_in_processes:
-            if not utils.is_valid_process_name(proc):
+            if proc not in KNOWN_PROCESS_FLAGS.keys():
                 raise ValueError(self._name + ' - unknown value in record_in_processes: ' + proc)
 
     @property
     def name(self):
         """Get the scalar name"""
         return self._name
 
     @property
@@ -219,17 +229,17 @@ class ScalarType:
     @property
     def record_in_processes(self):
         """Get the non-empty list of processes to record data in"""
         return self._definition['record_in_processes']
 
     @property
     def record_in_processes_enum(self):
         """Get the non-empty list of flags representing the processes to record data in"""
-        return [utils.process_name_to_enum(p) for p in self.record_in_processes]
+        return [KNOWN_PROCESS_FLAGS.get(p) for p in self.record_in_processes]
 
     @property
     def dataset(self):
         """Get the nsITelemetry constant equivalent to the chose release channel collection
         policy for the scalar.
         """
         # The collection policy is optional, but we still define a default
         # behaviour for it.
--- a/toolkit/components/telemetry/shared_telemetry_utils.py
+++ b/toolkit/components/telemetry/shared_telemetry_utils.py
@@ -4,34 +4,16 @@
 
 # This file contains utility functions shared by the scalars and the histogram generation
 # scripts.
 
 from __future__ import print_function
 
 import re
 
-# This is a list of flags that determine which process a measurement is allowed
-# to record from.
-KNOWN_PROCESS_FLAGS = {
-    'all': 'All',
-    'all_childs': 'AllChilds',
-    'main': 'Main',
-    'content': 'Content',
-    'gpu': 'Gpu',
-}
-
-PROCESS_ENUM_PREFIX = "mozilla::Telemetry::Common::RecordedProcessType::"
-
-def is_valid_process_name(name):
-    return (name in KNOWN_PROCESS_FLAGS)
-
-def process_name_to_enum(name):
-    return PROCESS_ENUM_PREFIX + KNOWN_PROCESS_FLAGS.get(name)
-
 class StringTable:
     """Manages a string table and allows C style serialization to a file."""
 
     def __init__(self):
         self.current_index = 0;
         self.table = {}
 
     def c_strlen(self, string):
--- a/toolkit/components/telemetry/tests/unit/test_ChildEvents.js
+++ b/toolkit/components/telemetry/tests/unit/test_ChildEvents.js
@@ -11,41 +11,24 @@ Cu.import("resource://testing-common/Con
 const MESSAGE_CHILD_TEST_DONE = "ChildTest:Done";
 
 const PLATFORM_VERSION = "1.9.2";
 const APP_VERSION = "1";
 const APP_ID = "xpcshell@tests.mozilla.org";
 const APP_NAME = "XPCShell";
 
 const RECORDED_CONTENT_EVENTS = [
-  ["telemetry.test", "content_only", "object1"],
-  ["telemetry.test", "main_and_content", "object1"],
-  ["telemetry.test", "content_only", "object1", "some value"],
-  ["telemetry.test", "content_only", "object1", null, {foo: "x", bar: "y"}],
-  ["telemetry.test", "content_only", "object1", "some value", {foo: "x", bar: "y"}],
-];
-
-const UNRECORDED_CONTENT_EVENTS = [
-  ["telemetry.test", "main_only", "object1"],
-];
-
-const RECORDED_PARENT_EVENTS = [
-  ["telemetry.test", "main_and_content", "object1"],
-  ["telemetry.test", "main_only", "object1"],
-];
-
-const UNRECORDED_PARENT_EVENTS = [
-  ["telemetry.test", "content_only", "object1"],
+  ["telemetry.test", "test1", "object1"],
+  ["telemetry.test", "test1", "object1", null, {"key1": "x", "key2": "y"}],
+  ["telemetry.test", "test1", "object1", "foo", {"key1": "x", "key2": "y"}],
 ];
 
 function run_child_test() {
   // Record some events in the "content" process.
   RECORDED_CONTENT_EVENTS.forEach(e => Telemetry.recordEvent(...e));
-  // These events should not be recorded for the content process.
-  UNRECORDED_CONTENT_EVENTS.forEach(e => Telemetry.recordEvent(...e));
 }
 
 /**
  * This function waits until content events are reported into the
  * events snapshot.
  */
 function* waitForContentEvents() {
   yield ContentTaskUtils.waitForCondition(() => {
@@ -78,43 +61,30 @@ add_task(function*() {
   run_test_in_child("test_ChildEvents.js");
   yield do_await_remote_message(MESSAGE_CHILD_TEST_DONE);
 
   // Once events are set by the content process, they don't immediately get
   // sent to the parent process. Wait for the Telemetry IPC Timer to trigger
   // and batch send the data back to the parent process.
   yield waitForContentEvents();
 
-  // Also record some events in the parent.
-  RECORDED_PARENT_EVENTS.forEach(e => Telemetry.recordEvent(...e));
-  UNRECORDED_PARENT_EVENTS.forEach(e => Telemetry.recordEvent(...e));
-
   // Get an "environment-changed" ping rather than a "test-ping", as
   // event measurements are only supported in subsession pings.
   const payload = TelemetrySession.getPayload("environment-change");
 
   // Validate the event data.
   Assert.ok("processes" in payload, "Should have processes section");
   Assert.ok("parent" in payload.processes, "Should have main process section");
   Assert.ok("events" in payload.processes.parent, "Main process section should have events.");
   Assert.ok("content" in payload.processes, "Should have child process section");
   Assert.ok("events" in payload.processes.content, "Child process section should have events.");
 
-  let contentEvents = payload.processes.content.events.map(e => e.slice(1));
-  Assert.equal(contentEvents.length, RECORDED_CONTENT_EVENTS.length, "Should match expected event count.");
-  for (let i = 0; i < RECORDED_CONTENT_EVENTS.length; ++i) {
-    Assert.deepEqual(contentEvents[i], RECORDED_CONTENT_EVENTS[i], "Should have recorded expected event.");
-  }
-
-  let parentEvents = payload.processes.parent.events.map(e => e.slice(1));
-  Assert.equal(parentEvents.length, RECORDED_PARENT_EVENTS.length, "Should match expected event count.");
-  for (let i = 0; i < RECORDED_PARENT_EVENTS.length; ++i) {
-    Assert.deepEqual(parentEvents[i], RECORDED_PARENT_EVENTS[i], "Should have recorded expected event.");
-  }
+  let events = payload.processes.content.events.map(e => e.slice(1));
+  Assert.deepEqual(events, RECORDED_CONTENT_EVENTS, "Should have recorded content events.");
 
   // Make sure all events are cleared from storage properly.
   let snapshot =
       Telemetry.snapshotBuiltinEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, true);
-  Assert.greaterOrEqual(Object.keys(snapshot).length, 2, "Should have events from at least two processes.");
+  Assert.equal(Object.keys(snapshot).length, 1, "Should have events from one process.");
   snapshot =
       Telemetry.snapshotBuiltinEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, true);
   Assert.equal(Object.keys(snapshot).length, 0, "Should have cleared all events from storage.");
 });