Bug 1247327. Add WebGL acceptance rates to telemetry. r=vladan,milan a=lizzard
authorJeff Muizelaar <jmuizelaar@mozilla.com>
Thu, 24 Mar 2016 13:15:21 -0400
changeset 317611 077b2fd8626d7e5c292afc452fed7b0147434d80
parent 317610 78c4ca9fd5a245de4421546df176ff25a71853c2
child 317612 b997674eb5463d224fbaf7807a1aa6513678f225
push id5810
push userjmuizelaar@mozilla.com
push dateThu, 24 Mar 2016 17:20:39 +0000
treeherdermozilla-beta@077b2fd8626d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvladan, milan, lizzard
bugs1247327
milestone46.0
Bug 1247327. Add WebGL acceptance rates to telemetry. r=vladan,milan a=lizzard
dom/canvas/CanvasRenderingContextHelper.cpp
toolkit/components/telemetry/Histograms.json
--- a/dom/canvas/CanvasRenderingContextHelper.cpp
+++ b/dom/canvas/CanvasRenderingContextHelper.cpp
@@ -193,18 +193,26 @@ CanvasRenderingContextHelper::GetContext
     mCurrentContext = context.forget();
     mCurrentContextType = contextType;
 
     nsresult rv = UpdateContext(aCx, aContextOptions, aRv);
     if (NS_FAILED(rv)) {
       // See bug 645792 and bug 1215072.
       // We want to throw only if dictionary initialization fails,
       // so only in case aRv has been set to some error value.
+      if (contextType == CanvasContextType::WebGL1)
+        Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_SUCCESS, 0);
+      else if (contextType == CanvasContextType::WebGL2)
+        Telemetry::Accumulate(Telemetry::CANVAS_WEBGL2_SUCCESS, 0);
       return nullptr;
     }
+    if (contextType == CanvasContextType::WebGL1)
+      Telemetry::Accumulate(Telemetry::CANVAS_WEBGL_SUCCESS, 1);
+    else if (contextType == CanvasContextType::WebGL2)
+      Telemetry::Accumulate(Telemetry::CANVAS_WEBGL2_SUCCESS, 1);
   } else {
     // We already have a context of some type.
     if (contextType != mCurrentContextType)
       return nullptr;
   }
 
   nsCOMPtr<nsICanvasRenderingContextInternal> context = mCurrentContext;
   return context.forget();
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -978,16 +978,30 @@
     "kind": "boolean",
     "description": "2D canvas used"
   },
   "CANVAS_WEBGL_USED": {
     "expires_in_version": "never",
     "kind": "boolean",
     "description": "WebGL canvas used"
   },
+  "CANVAS_WEBGL_SUCCESS": {
+    "alert_emails": ["jmuizelaar@mozilla.com"],
+    "expires_in_version": "never",
+    "kind": "boolean",
+    "description": "WebGL1 creation success",
+    "bug_numbers": [1247327]
+  },
+  "CANVAS_WEBGL2_SUCCESS": {
+    "alert_emails": ["jmuizelaar@mozilla.com"],
+    "expires_in_version": "never",
+    "kind": "boolean",
+    "description": "WebGL2 creation success",
+    "bug_numbers": [1247327]
+  },
   "TOTAL_CONTENT_PAGE_LOAD_TIME": {
     "alert_emails": ["perf-telemetry-alerts@mozilla.com"],
     "expires_in_version": "never",
     "kind": "exponential",
     "low": 100,
     "high": "30000",
     "n_buckets": 100,
     "description": "HTTP: Total page load time (ms)"