Bug 1491047 - Add a telemetry probe for measuring how many browsing sessions have had a private window opened in them; data-review=francois r=jdm
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 25 Sep 2018 04:53:40 +0000
changeset 438066 7a7b481a00f4bfcc735eaec0d589f029bfa1efa0
parent 438065 5beded4f989844615c6c009308667d1b5273a76c
child 438067 eae95de0eabec99b772fd01ac873880cc96425d9
push id108220
push userebalazs@mozilla.com
push dateTue, 25 Sep 2018 09:51:30 +0000
treeherdermozilla-inbound@b87feca48db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1491047
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1491047 - Add a telemetry probe for measuring how many browsing sessions have had a private window opened in them; data-review=francois r=jdm Differential Revision: https://phabricator.services.mozilla.com/D6063
dom/ipc/ContentParent.cpp
toolkit/components/telemetry/Scalars.yaml
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -566,16 +566,19 @@ nsDataHashtable<nsUint32HashKey, Content
 nsTArray<ContentParent*>* ContentParent::sPrivateContent;
 StaticAutoPtr<LinkedList<ContentParent> > ContentParent::sContentParents;
 #if defined(XP_LINUX) && defined(MOZ_CONTENT_SANDBOX)
 UniquePtr<SandboxBrokerPolicyFactory> ContentParent::sSandboxBrokerPolicyFactory;
 #endif
 uint64_t ContentParent::sNextTabParentId = 0;
 nsDataHashtable<nsUint64HashKey, TabParent*> ContentParent::sNextTabParents;
 
+// Whether a private docshell has been seen before.
+static bool sHasSeenPrivateDocShell = false;
+
 // This is true when subprocess launching is enabled.  This is the
 // case between StartUp() and ShutDown().
 static bool sCanLaunchSubprocesses;
 
 // Set to true if the DISABLE_UNSAFE_CPOW_WARNINGS environment variable is
 // set.
 static bool sDisableUnsafeCPOWWarnings = false;
 
@@ -4204,18 +4207,23 @@ ContentParent::RecvScriptErrorInternal(c
 
   consoleService->LogMessageWithMode(msg, nsConsoleService::SuppressLog);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 ContentParent::RecvPrivateDocShellsExist(const bool& aExist)
 {
-  if (!sPrivateContent)
+  if (!sPrivateContent) {
     sPrivateContent = new nsTArray<ContentParent*>();
+    if (!sHasSeenPrivateDocShell) {
+      sHasSeenPrivateDocShell = true;
+      Telemetry::ScalarSet(Telemetry::ScalarID::DOM_PARENTPROCESS_PRIVATE_WINDOW_USED, true);
+    }
+  }
   if (aExist) {
     sPrivateContent->AppendElement(this);
   } else {
     sPrivateContent->RemoveElement(this);
 
     // Only fire the notification if we have private and non-private
     // windows: if privatebrowsing.autostart is true, all windows are
     // private.
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -991,16 +991,32 @@ dom.contentprocess:
     expires: never
     kind: uint
     notification_emails:
       - spohl@mozilla.com
     release_channel_collection: opt-out
     record_in_processes:
       - 'main'
 
+# The following section contains parent process base counters.
+dom.parentprocess:
+  private_window_used:
+    bug_numbers:
+      - 1491047
+    description: >
+      Whether a private browsing window has been used in the session.
+    expires: never
+    kind: boolean
+    notification_emails:
+      - seceng-telemetry@mozilla.com
+      - ehsan+telemetry@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - 'main'
+
 devtools.toolbar.eyedropper:
   opened:
     bug_numbers:
       - 1247985
       - 1352115
     description: Number of times the DevTools Eyedropper has been opened via the inspector toolbar.
     expires: never
     kind: uint