Bug 1950710 - Migrate histograms to use Glean APIs for FULLSCREEN_CHANGE_MS, r=chutten,pip-reviewers,mconley.
Differential Revision: https://phabricator.services.mozilla.com/D242233
This commit is contained in:
@@ -174,7 +174,8 @@ export class DOMFullscreenParent extends JSWindowActorParent {
|
|||||||
this.waitingForChildExitFullscreen = false;
|
this.waitingForChildExitFullscreen = false;
|
||||||
Services.obs.notifyObservers(window, "fullscreen-painted");
|
Services.obs.notifyObservers(window, "fullscreen-painted");
|
||||||
this.sendAsyncMessage("DOMFullscreen:Painted", {});
|
this.sendAsyncMessage("DOMFullscreen:Painted", {});
|
||||||
TelemetryStopwatch.finish("FULLSCREEN_CHANGE_MS");
|
Glean.fullscreen.change.stopAndAccumulate(this.timerId);
|
||||||
|
this.timerId = null;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -215,7 +216,7 @@ export class DOMFullscreenParent extends JSWindowActorParent {
|
|||||||
window.gXPInstallObserver.removeAllNotifications(browser);
|
window.gXPInstallObserver.removeAllNotifications(browser);
|
||||||
}
|
}
|
||||||
|
|
||||||
TelemetryStopwatch.start("FULLSCREEN_CHANGE_MS");
|
this.timerId = Glean.fullscreen.change.start();
|
||||||
window.FullScreen.enterDomFullscreen(browser, this);
|
window.FullScreen.enterDomFullscreen(browser, this);
|
||||||
this.updateFullscreenWindowReference(window);
|
this.updateFullscreenWindowReference(window);
|
||||||
|
|
||||||
@@ -227,7 +228,7 @@ export class DOMFullscreenParent extends JSWindowActorParent {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "MozDOMFullscreen:Exited": {
|
case "MozDOMFullscreen:Exited": {
|
||||||
TelemetryStopwatch.start("FULLSCREEN_CHANGE_MS");
|
this.timerId = Glean.fullscreen.change.start();
|
||||||
|
|
||||||
// Make sure that the actor has not been destroyed before
|
// Make sure that the actor has not been destroyed before
|
||||||
// accessing its browsing context. Otherwise, a error may
|
// accessing its browsing context. Otherwise, a error may
|
||||||
|
|||||||
30
browser/actors/metrics.yaml
Normal file
30
browser/actors/metrics.yaml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
|
# Adding a new metric? We have docs for that!
|
||||||
|
# https://firefox-source-docs.mozilla.org/toolkit/components/glean/user/new_definitions_file.html
|
||||||
|
|
||||||
|
---
|
||||||
|
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0
|
||||||
|
$tags:
|
||||||
|
- 'Firefox :: General'
|
||||||
|
|
||||||
|
fullscreen:
|
||||||
|
change:
|
||||||
|
type: timing_distribution
|
||||||
|
description: >
|
||||||
|
The time content uses to enter/exit fullscreen regardless of fullscreen
|
||||||
|
transition timeout
|
||||||
|
|
||||||
|
This metric was generated to correspond to the Legacy Telemetry
|
||||||
|
exponential histogram FULLSCREEN_CHANGE_MS.
|
||||||
|
time_unit: millisecond
|
||||||
|
bugs:
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1271160
|
||||||
|
data_reviews:
|
||||||
|
- https://bugzilla.mozilla.org/show_bug.cgi?id=1271160
|
||||||
|
notification_emails:
|
||||||
|
- mozilla-telemetry@upsuper.org
|
||||||
|
expires: never
|
||||||
|
telemetry_mirror: FULLSCREEN_CHANGE_MS
|
||||||
@@ -525,7 +525,7 @@ var FullScreen = {
|
|||||||
// If there is no appropriate actor to send the message we have
|
// If there is no appropriate actor to send the message we have
|
||||||
// no way to complete the transition and should abort by exiting
|
// no way to complete the transition and should abort by exiting
|
||||||
// fullscreen.
|
// fullscreen.
|
||||||
this._abortEnterFullscreen();
|
this._abortEnterFullscreen(aActor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Record that the actor is waiting for its child to enter
|
// Record that the actor is waiting for its child to enter
|
||||||
@@ -552,7 +552,7 @@ var FullScreen = {
|
|||||||
// full-screen was made. Cancel full-screen.
|
// full-screen was made. Cancel full-screen.
|
||||||
Services.focus.activeWindow != window
|
Services.focus.activeWindow != window
|
||||||
) {
|
) {
|
||||||
this._abortEnterFullscreen();
|
this._abortEnterFullscreen(aActor);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -670,17 +670,18 @@ var FullScreen = {
|
|||||||
return needToWaitForChildExit;
|
return needToWaitForChildExit;
|
||||||
},
|
},
|
||||||
|
|
||||||
_abortEnterFullscreen() {
|
_abortEnterFullscreen(aActor) {
|
||||||
// This function is called synchronously in fullscreen change, so
|
// This function is called synchronously in fullscreen change, so
|
||||||
// we have to avoid calling exitFullscreen synchronously here.
|
// we have to avoid calling exitFullscreen synchronously here.
|
||||||
//
|
//
|
||||||
// This could reject if we're not currently in fullscreen
|
// This could reject if we're not currently in fullscreen
|
||||||
// so just ignore rejection.
|
// so just ignore rejection.
|
||||||
setTimeout(() => document.exitFullscreen().catch(() => {}), 0);
|
setTimeout(() => document.exitFullscreen().catch(() => {}), 0);
|
||||||
if (TelemetryStopwatch.running("FULLSCREEN_CHANGE_MS")) {
|
if (aActor.timerId) {
|
||||||
// Cancel the stopwatch for any fullscreen change to avoid
|
// Cancel the stopwatch for any fullscreen change to avoid
|
||||||
// errors if it is started again.
|
// errors if it is started again.
|
||||||
TelemetryStopwatch.cancel("FULLSCREEN_CHANGE_MS");
|
Glean.fullscreen.change.cancel(aActor.timerId);
|
||||||
|
aActor.timerId = null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1332,7 +1332,9 @@ add_task(async function test_dom_full_screen() {
|
|||||||
await exited;
|
await exited;
|
||||||
|
|
||||||
await BrowserTestUtils.waitForCondition(() => {
|
await BrowserTestUtils.waitForCondition(() => {
|
||||||
return !TelemetryStopwatch.running("FULLSCREEN_CHANGE_MS");
|
return !gBrowser.selectedBrowser.browsingContext.currentWindowGlobal.getActor(
|
||||||
|
"DOMFullscreen"
|
||||||
|
).timerId;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (AppConstants.platform == "macosx") {
|
if (AppConstants.platform == "macosx") {
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ gecko_metrics = [
|
|||||||
# Metrics that are sent by Firefox Desktop
|
# Metrics that are sent by Firefox Desktop
|
||||||
# Order is lexicographical, enforced by t/c/glean/tests/pytest/test_yaml_indices.py
|
# Order is lexicographical, enforced by t/c/glean/tests/pytest/test_yaml_indices.py
|
||||||
firefox_desktop_metrics = [
|
firefox_desktop_metrics = [
|
||||||
|
"browser/actors/metrics.yaml",
|
||||||
"browser/components/asrouter/metrics.yaml",
|
"browser/components/asrouter/metrics.yaml",
|
||||||
"browser/components/backup/metrics.yaml",
|
"browser/components/backup/metrics.yaml",
|
||||||
"browser/components/doh/metrics.yaml",
|
"browser/components/doh/metrics.yaml",
|
||||||
|
|||||||
@@ -873,7 +873,9 @@ async function promiseFullscreenEntered(window, asyncFn) {
|
|||||||
await entered;
|
await entered;
|
||||||
|
|
||||||
await BrowserTestUtils.waitForCondition(() => {
|
await BrowserTestUtils.waitForCondition(() => {
|
||||||
return !TelemetryStopwatch.running("FULLSCREEN_CHANGE_MS");
|
return !gBrowser.selectedBrowser.browsingContext.currentWindowGlobal.getActor(
|
||||||
|
"DOMFullscreen"
|
||||||
|
).timerId;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (AppConstants.platform == "macosx") {
|
if (AppConstants.platform == "macosx") {
|
||||||
@@ -907,7 +909,9 @@ async function promiseFullscreenExited(window, asyncFn) {
|
|||||||
await exited;
|
await exited;
|
||||||
|
|
||||||
await BrowserTestUtils.waitForCondition(() => {
|
await BrowserTestUtils.waitForCondition(() => {
|
||||||
return !TelemetryStopwatch.running("FULLSCREEN_CHANGE_MS");
|
return !gBrowser.selectedBrowser.browsingContext.currentWindowGlobal.getActor(
|
||||||
|
"DOMFullscreen"
|
||||||
|
).timerId;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (AppConstants.platform == "macosx") {
|
if (AppConstants.platform == "macosx") {
|
||||||
|
|||||||
Reference in New Issue
Block a user