Bug 1359061 - Report WR state via ScopedGfxFeatureReporter in all processes. r?dvander draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 24 Apr 2017 10:06:06 -0400
changeset 567228 8639b5ced36040749cf07b3a3b52892ec7ab1adc
parent 567163 62b649c6b314f756f21cb95f2b0d491e2664e944
child 625556 a7b1e28551336fa242a571bfc761a0283acea7fb
push id55476
push userkgupta@mozilla.com
push dateMon, 24 Apr 2017 14:24:03 +0000
reviewersdvander
bugs1359061
milestone55.0a1
Bug 1359061 - Report WR state via ScopedGfxFeatureReporter in all processes. r?dvander We were only reporting the WR feature state in crash reports from the parent process. However, it would be useful to have in GPU and content process crash reports as well, so use the ScopedGfxFeatureReporter in those processes as well. MozReview-Commit-ID: Em37uLVPboK
gfx/thebes/gfxPlatform.cpp
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -705,19 +705,17 @@ gfxPlatform::Init()
 #elif defined(MOZ_WIDGET_GTK)
     gPlatform = new gfxPlatformGtk;
 #elif defined(ANDROID)
     gPlatform = new gfxAndroidPlatform;
 #else
     #error "No gfxPlatform implementation available"
 #endif
     gPlatform->InitAcceleration();
-    if (XRE_IsParentProcess()) {
-      gPlatform->InitWebRenderConfig();
-    }
+    gPlatform->InitWebRenderConfig();
 
     if (gfxConfig::IsEnabled(Feature::GPU_PROCESS)) {
       GPUProcessManager* gpu = GPUProcessManager::Get();
       gpu->LaunchGPUProcess();
     }
 
 #ifdef USE_SKIA
     SkGraphics::Init();
@@ -2332,30 +2330,40 @@ gfxPlatform::InitCompositorAccelerationP
     feature.ForceDisable(FeatureStatus::Blocked, "Acceleration blocked by safe-mode",
                          NS_LITERAL_CSTRING("FEATURE_FAILURE_COMP_SAFEMODE"));
   }
 }
 
 void
 gfxPlatform::InitWebRenderConfig()
 {
+  bool prefEnabled = Preferences::GetBool("gfx.webrender.enabled", false);
+
+  ScopedGfxFeatureReporter reporter("WR", prefEnabled);
+  if (!XRE_IsParentProcess()) {
+    // The parent process runs through all the real decision-making code
+    // later in this function. For other processes we still want to report
+    // the state of the feature for crash reports.
+    if (gfxVars::UseWebRender()) {
+      reporter.SetSuccessful();
+    }
+    return;
+  }
+
   FeatureState& featureWebRender = gfxConfig::GetFeature(Feature::WEBRENDER);
 
   featureWebRender.DisableByDefault(
       FeatureStatus::OptIn,
       "WebRender is an opt-in feature",
       NS_LITERAL_CSTRING("FEATURE_FAILURE_DEFAULT_OFF"));
 
-  bool prefEnabled = Preferences::GetBool("gfx.webrender.enabled", false);
   if (prefEnabled) {
     featureWebRender.UserEnable("Enabled by pref");
   }
 
-  ScopedGfxFeatureReporter reporter("WR", prefEnabled);
-
   // WebRender relies on the GPU process when on Windows
 #ifdef XP_WIN
   if (!gfxConfig::IsEnabled(Feature::GPU_PROCESS)) {
     featureWebRender.ForceDisable(
       FeatureStatus::Unavailable,
       "GPU Process is disabled",
       NS_LITERAL_CSTRING("FEATURE_FAILURE_GPU_PROCESS_DISABLED"));
   }