Bug 1457127 - Add an helper function for checking if the GPU process was used. r=janerik
authorAlessio Placitelli <alessio.placitelli@gmail.com>
Thu, 17 May 2018 08:56:16 +0200
changeset 419067 b49beaf72b1d69e0b6e0a982d74e8f02a0f4df9d
parent 419066 f97a89b40a5f736e85e76160e788a4b5cc4ed4fd
child 419068 8fcea2ebf26e787112dc211a51a094736e06994a
push id34025
push userapavel@mozilla.com
push dateMon, 21 May 2018 09:46:09 +0000
treeherdermozilla-central@8850728602d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjanerik
bugs1457127
milestone62.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 1457127 - Add an helper function for checking if the GPU process was used. r=janerik MozReview-Commit-ID: 1xcrk1sCXHE
toolkit/components/telemetry/TelemetryHistogram.cpp
--- a/toolkit/components/telemetry/TelemetryHistogram.cpp
+++ b/toolkit/components/telemetry/TelemetryHistogram.cpp
@@ -418,16 +418,26 @@ internal_CanRecordBase() {
   return gCanRecordBase;
 }
 
 bool
 internal_CanRecordExtended() {
   return gCanRecordExtended;
 }
 
+bool
+internal_AttemptedGPUProcess() {
+  // Check if it was tried to launch a process.
+  bool attemptedGPUProcess = false;
+  if (auto gpm = mozilla::gfx::GPUProcessManager::Get()) {
+    attemptedGPUProcess = gpm->AttemptedGPUProcess();
+  }
+  return attemptedGPUProcess;
+}
+
 // Note: this is completely unrelated to mozilla::IsEmpty.
 bool
 internal_IsEmpty(const Histogram *h)
 {
   return h->is_empty();
 }
 
 bool
@@ -2363,20 +2373,17 @@ TelemetryHistogram::CreateHistogramSnaps
   JS::Rooted<JSObject*> root_obj(aCx, JS_NewPlainObject(aCx));
   if (!root_obj) {
     return NS_ERROR_FAILURE;
   }
   aResult.setObject(*root_obj);
 
   // Include the GPU process in histogram snapshots only if we actually tried
   // to launch a process for it.
-  bool includeGPUProcess = false;
-  if (auto gpm = mozilla::gfx::GPUProcessManager::Get()) {
-    includeGPUProcess = gpm->AttemptedGPUProcess();
-  }
+  bool includeGPUProcess = internal_AttemptedGPUProcess();
 
   HistogramProcessSnapshotsArray processHistArray;
   {
     StaticMutexAutoLock locker(gTelemetryHistogramMutex);
     nsresult rv = internal_GetHistogramsSnapshot(locker,
                                                  aDataset,
                                                  aClearSubsession,
                                                  includeGPUProcess,
@@ -2432,20 +2439,17 @@ TelemetryHistogram::GetKeyedHistogramSna
   JS::Rooted<JSObject*> obj(aCx, JS_NewPlainObject(aCx));
   if (!obj) {
     return NS_ERROR_FAILURE;
   }
   aResult.setObject(*obj);
 
   // Include the GPU process in histogram snapshots only if we actually tried
   // to launch a process for it.
-  bool includeGPUProcess = false;
-  if (auto gpm = mozilla::gfx::GPUProcessManager::Get()) {
-    includeGPUProcess = gpm->AttemptedGPUProcess();
-  }
+  bool includeGPUProcess = internal_AttemptedGPUProcess();
 
   // Get a snapshot of all the data while holding the mutex.
   KeyedHistogramProcessSnapshotsArray processHistArray;
   {
     StaticMutexAutoLock locker(gTelemetryHistogramMutex);
     nsresult rv = internal_GetKeyedHistogramsSnapshot(locker,
                                                       aDataset,
                                                       aClearSubsession,