Commit 9adda172 authored by Gijs Kruitbosch's avatar Gijs Kruitbosch
Browse files

Bug 1730040 - drop PLACES_BOOKMARKS_TOOLBAR_RENDER_DELAY_MS probe, r=mak

parent c141635e
Loading
Loading
Loading
Loading
+5 −53
Original line number Diff line number Diff line
@@ -1123,19 +1123,17 @@ var PlacesToolbarHelper = {
   * show toolbars.
   */
  async init() {
    let telemetryKey = await PlacesUIUtils.canLoadToolbarContentPromise;
    let didCreate = this._realInit();
    this._measureToolbarPaintDelay(telemetryKey, didCreate);
    await PlacesUIUtils.canLoadToolbarContentPromise;
    this._realInit();
  },

  /**
   * @return whether we actually initialized the places view (and
   * aren't collapsed).
   * Actually initialize the places view (if needed; we might still no-op).
   */
  _realInit() {
    let viewElt = this._viewElt;
    if (!viewElt || viewElt._placesView || window.closed) {
      return false;
      return;
    }

    // CustomizableUI.addListener is idempotent, so we can safely
@@ -1160,7 +1158,7 @@ var PlacesToolbarHelper = {
      this._isCustomizing ||
      getComputedStyle(toolbar, "").display == "none"
    ) {
      return false;
      return;
    }

    if (
@@ -1172,52 +1170,6 @@ var PlacesToolbarHelper = {
    }

    new PlacesToolbar(`place:parent=${PlacesUtils.bookmarks.toolbarGuid}`);
    return true;
  },

  // Only measure once per window:
  _shouldMeasure: true,
  _measureToolbarPaintDelay(telemetryKey, didCreate) {
    if (!this._shouldMeasure) {
      return;
    }
    this._shouldMeasure = false;
    // If we create and show the toolbar later, we don't want to measure how
    // long it took, so it's important this check happens after setting
    // _shouldMeasure.
    if (!didCreate) {
      return;
    }

    let recordDelay = time => {
      let entries = window.performance.getEntriesByType("paint");
      let timeEntry = entries.find(e => e.name == "first-contentful-paint");
      let histogram = Services.telemetry.getKeyedHistogramById(
        "PLACES_BOOKMARKS_TOOLBAR_RENDER_DELAY_MS"
      );
      if (timeEntry) {
        let delay = time - timeEntry.startTime - timeEntry.duration;
        histogram.add(telemetryKey, Math.round(delay));
      } else {
        // If there is no base time, we haven't painted yet, so we rendered
        // before paint:
        histogram.add(telemetryKey, 0);
      }
    };
    if (!window.windowUtils.isMozAfterPaintPending) {
      recordDelay(performance.now());
      return;
    }
    let removeListeners = () => {
      window.removeEventListener("unload", removeListeners);
      window.removeEventListener("MozAfterPaint", paintHandler);
    };
    let paintHandler = ev => {
      removeListeners();
      recordDelay(ev.paintTimeStamp);
    };
    window.addEventListener("MozAfterPaint", paintHandler);
    window.addEventListener("unload", removeListeners);
  },

  handleEvent(event) {
+1 −9
Original line number Diff line number Diff line
@@ -1619,17 +1619,9 @@ var PlacesUIUtils = {
 * Promise used by the toolbar view browser-places to determine whether we
 * can start loading its content (which involves IO, and so is postponed
 * during startup).
 * This promise's resolution value indicates whether toolbar initialization
 * waited on sessionstore-windows-restored and then an idle task, or happened
 * immediately as the window was opened. This is used for telemetry.
 */
PlacesUIUtils.canLoadToolbarContentPromise = new Promise(resolve => {
  PlacesUIUtils.unblockToolbars = () => {
    resolve("waited-for-session-idle");
    // Overwrite the property with the new promise, as the session has
    // now been restored:
    PlacesUIUtils.canLoadToolbarContentPromise = Promise.resolve("immediate");
  };
  PlacesUIUtils.unblockToolbars = resolve;
});

// These are lazy getters to avoid importing PlacesUtils immediately.
+0 −14
Original line number Diff line number Diff line
@@ -6640,20 +6640,6 @@
    "n_buckets" : 100,
    "description": "PLACES: Size of favicon files without a specific file type probe, loaded from the web (Bytes)"
  },
  "PLACES_BOOKMARKS_TOOLBAR_RENDER_DELAY_MS": {
    "alert_emails": ["gkruitbosch@mozilla.com", "esmyth@mozilla.com"],
    "bug_numbers": [1680216],
    "releaseChannelCollection": "opt-out",
    "record_in_processes": ["main"],
    "products": ["firefox"],
    "expires_in_version": "95",
    "keyed": true,
    "kind": "exponential",
    "low": 1,
    "high": 60000,
    "n_buckets": 30,
    "description": "Number of ms between initial rendering and when we show the bookmarks toolbar items. Will record once per window opened (so may never record in a given subsession, or multiple times). Keyed by whether we waited for idle or not."
  },
  "LINK_ICON_SIZES_ATTR_USAGE": {
    "record_in_processes": ["main", "content"],
    "products": ["firefox", "fennec"],