Bug 1302240 - Report content backend to telemetry. r=dvander
authorMason Chang <mchang@mozilla.com>
Mon, 12 Sep 2016 16:23:28 -0700
changeset 354950 682489fca27b508ecd41dd27815cf317604d7a46
parent 354949 7ba36633092ec91c05451a10322732628658a8b7
child 354951 f2a771eb073aff5c9b0dd63c48f27fabab280417
push id6570
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:26:13 +0000
treeherdermozilla-beta@f455459b2ae5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs1302240
milestone51.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 1302240 - Report content backend to telemetry. r=dvander
toolkit/components/telemetry/TelemetryEnvironment.jsm
widget/GfxInfoBase.cpp
widget/GfxInfoBase.h
widget/nsIGfxInfo.idl
--- a/toolkit/components/telemetry/TelemetryEnvironment.jsm
+++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm
@@ -1311,16 +1311,17 @@ EnvironmentCache.prototype = {
   /**
    * Get the GFX information.
    * @return Object containing the GFX data.
    */
   _getGFXData: function () {
     let gfxData = {
       D2DEnabled: getGfxField("D2DEnabled", null),
       DWriteEnabled: getGfxField("DWriteEnabled", null),
+      ContentBackend: getGfxField("ContentBackend", null),
       // The following line is disabled due to main thread jank and will be enabled
       // again as part of bug 1154500.
       //DWriteVersion: getGfxField("DWriteVersion", null),
       adapters: [],
       monitors: [],
       features: {},
     };
 
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -1395,16 +1395,43 @@ GfxInfoBase::GetActiveCrashGuards(JSCont
     if (!AppendJSElement(aCx, array, obj)) {
       return;
     }
   });
 
   return NS_OK;
 }
 
+NS_IMETHODIMP
+GfxInfoBase::GetContentBackend(nsAString & aContentBackend)
+{
+  BackendType backend = gfxPlatform::GetPlatform()->GetDefaultContentBackend();
+  nsString outStr;
+
+  switch (backend) {
+  case BackendType::DIRECT2D1_1: {
+    outStr.AppendPrintf("Direct2D 1.1");
+    break;
+  }
+  case BackendType::SKIA: {
+    outStr.AppendPrintf("Skia");
+    break;
+  }
+  case BackendType::CAIRO: {
+    outStr.AppendPrintf("Cairo");
+    break;
+  }
+  default:
+    return NS_ERROR_FAILURE;
+  }
+
+  aContentBackend.Assign(outStr);
+  return NS_OK;
+}
+
 GfxInfoCollectorBase::GfxInfoCollectorBase()
 {
   GfxInfoBase::AddCollector(this);
 }
 
 GfxInfoCollectorBase::~GfxInfoCollectorBase()
 {
   GfxInfoBase::RemoveCollector(this);
--- a/widget/GfxInfoBase.h
+++ b/widget/GfxInfoBase.h
@@ -53,16 +53,17 @@ public:
 
   NS_IMETHOD GetMonitors(JSContext* cx, JS::MutableHandleValue _retval) override;
   NS_IMETHOD GetFailures(uint32_t *failureCount, int32_t** indices, char ***failures) override;
   NS_IMETHOD_(void) LogFailure(const nsACString &failure) override;
   NS_IMETHOD GetInfo(JSContext*, JS::MutableHandle<JS::Value>) override;
   NS_IMETHOD GetFeatures(JSContext*, JS::MutableHandle<JS::Value>) override;
   NS_IMETHOD GetFeatureLog(JSContext*, JS::MutableHandle<JS::Value>) override;
   NS_IMETHOD GetActiveCrashGuards(JSContext*, JS::MutableHandle<JS::Value>) override;
+  NS_IMETHOD GetContentBackend(nsAString & aContentBackend) override;
 
   // Initialization function. If you override this, you must call this class's
   // version of Init first.
   // We need Init to be called separately from the constructor so we can
   // register as an observer after all derived classes have been constructed
   // and we know we have a non-zero refcount.
   // Ideally, Init() would be void-return, but the rules of
   // NS_GENERIC_FACTORY_CONSTRUCTOR_INIT require it be nsresult return.
--- a/widget/nsIGfxInfo.idl
+++ b/widget/nsIGfxInfo.idl
@@ -13,16 +13,21 @@ interface nsIGfxInfo : nsISupports
   /*
    * These are win32-specific
    */
   readonly attribute boolean D2DEnabled;
   readonly attribute boolean DWriteEnabled;
   readonly attribute DOMString DWriteVersion;
   readonly attribute DOMString cleartypeParameters;
 
+  /*
+   * These are valid across all platforms.
+   */
+  readonly attribute DOMString ContentBackend;
+
   // XXX: Switch to a list of devices, rather than explicitly numbering them.
 
   /**
    * The name of the display adapter.
    */
   readonly attribute DOMString adapterDescription;
   readonly attribute DOMString adapterDescription2;