Bug 1629602 - Include reason for failure when describing features. r=aosmond
☠☠ backed out by 6686cea71a14 ☠ ☠
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Tue, 14 Apr 2020 00:05:30 +0000
changeset 523753 502e83464c91a6be88fb524c1378799e19e32101
parent 523752 dc5251d30a38f0905de1826a366b4e2b68ad5b9c
child 523754 b09ad6ab0220b4024fbbb927efd95bd7a6fcf384
push id112791
push userjmuizelaar@mozilla.com
push dateTue, 14 Apr 2020 00:36:26 +0000
treeherderautoland@502e83464c91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaosmond
bugs1629602
milestone77.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 1629602 - Include reason for failure when describing features. r=aosmond This should give us more information in telemetry. Differential Revision: https://phabricator.services.mozilla.com/D70706
widget/GfxInfoBase.cpp
widget/GfxInfoBase.h
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -1599,54 +1599,60 @@ bool GfxInfoBase::BuildFeatureStateLog(J
   });
 
   return true;
 }
 
 void GfxInfoBase::DescribeFeatures(JSContext* aCx, JS::Handle<JSObject*> aObj) {
   JS::Rooted<JSObject*> obj(aCx);
 
-  gfx::FeatureStatus gpuProcess =
-      gfxConfig::GetValue(gfx::Feature::GPU_PROCESS);
+  gfx::FeatureState& gpuProcess =
+      gfxConfig::GetFeature(gfx::Feature::GPU_PROCESS);
   InitFeatureObject(aCx, aObj, "gpuProcess", gpuProcess, &obj);
 
-  gfx::FeatureStatus wrQualified =
-      gfxConfig::GetValue(gfx::Feature::WEBRENDER_QUALIFIED);
+  gfx::FeatureState& wrQualified =
+      gfxConfig::GetFeature(gfx::Feature::WEBRENDER_QUALIFIED);
   InitFeatureObject(aCx, aObj, "wrQualified", wrQualified, &obj);
 
-  gfx::FeatureStatus webrender = gfxConfig::GetValue(gfx::Feature::WEBRENDER);
+  gfx::FeatureState& webrender = gfxConfig::GetFeature(gfx::Feature::WEBRENDER);
   InitFeatureObject(aCx, aObj, "webrender", webrender, &obj);
 
   // Only include AL if the platform attempted to use it.
-  gfx::FeatureStatus advancedLayers =
-      gfxConfig::GetValue(gfx::Feature::ADVANCED_LAYERS);
-  if (advancedLayers != FeatureStatus::Unused) {
+  gfx::FeatureState& advancedLayers =
+      gfxConfig::GetFeature(gfx::Feature::ADVANCED_LAYERS);
+  if (advancedLayers.GetValue() != FeatureStatus::Unused) {
     InitFeatureObject(aCx, aObj, "advancedLayers", advancedLayers, &obj);
 
     if (gfxConfig::UseFallback(Fallback::NO_CONSTANT_BUFFER_OFFSETTING)) {
       JS::Rooted<JS::Value> trueVal(aCx, JS::BooleanValue(true));
       JS_SetProperty(aCx, obj, "noConstantBufferOffsetting", trueVal);
     }
   }
 }
 
 bool GfxInfoBase::InitFeatureObject(JSContext* aCx,
                                     JS::Handle<JSObject*> aContainer,
                                     const char* aName,
-                                    mozilla::gfx::FeatureStatus& aFeatureStatus,
+                                    mozilla::gfx::FeatureState& aFeatureState,
                                     JS::MutableHandle<JSObject*> aOutObj) {
   JS::Rooted<JSObject*> obj(aCx, JS_NewPlainObject(aCx));
   if (!obj) {
     return false;
   }
 
-  // Set "status".
-  const char* status = FeatureStatusToString(aFeatureStatus);
+  nsCString status;
+  if (!aFeatureState.IsEnabled()) {
+    status.AppendPrintf("%s:%s",
+                        FeatureStatusToString(aFeatureState.GetValue()),
+                        aFeatureState.GetFailureId().get());
+  } else {
+    status.Append(FeatureStatusToString(aFeatureState.GetValue()));
+  }
 
-  JS::Rooted<JSString*> str(aCx, JS_NewStringCopyZ(aCx, status));
+  JS::Rooted<JSString*> str(aCx, JS_NewStringCopyZ(aCx, status.get()));
   JS::Rooted<JS::Value> val(aCx, JS::StringValue(str));
   JS_SetProperty(aCx, obj, "status", val);
 
   // Add the feature object to the container.
   {
     JS::Rooted<JS::Value> val(aCx, JS::ObjectValue(*obj));
     JS_SetProperty(aCx, aContainer, aName, val);
   }
--- a/widget/GfxInfoBase.h
+++ b/widget/GfxInfoBase.h
@@ -136,17 +136,17 @@ class GfxInfoBase : public nsIGfxInfo,
   bool DoesVendorMatch(const nsAString& aBlocklistVendor,
                        const nsAString& aAdapterVendor);
 
   virtual bool DoesDriverVendorMatch(const nsAString& aBlocklistVendor,
                                      const nsAString& aDriverVendor);
 
   bool InitFeatureObject(JSContext* aCx, JS::Handle<JSObject*> aContainer,
                          const char* aName,
-                         mozilla::gfx::FeatureStatus& aKnownStatus,
+                         mozilla::gfx::FeatureState& aFeatureState,
                          JS::MutableHandle<JSObject*> aOutObj);
 
   NS_IMETHOD ControlGPUProcessForXPCShell(bool aEnable, bool* _retval) override;
 
   // Total number of pixels for all detected screens at startup.
   int64_t mScreenPixels;
 
  private: