Bug 1651165 - Rename and redocument _scheduleArbitrarilyLateIdleTasks r=Gijs
authorDoug Thayer <dothayer@mozilla.com>
Mon, 20 Jul 2020 16:07:06 +0000
changeset 541397 d67baa90813190ce036daa12ffe0f93700c5a5c4
parent 541396 2a646a7936e7ffbe168a3a354e3bf31b536ff815
child 541398 d191744781919c8df8099927b61667d76cca3db2
push id122216
push userdothayer@mozilla.com
push dateTue, 21 Jul 2020 04:34:14 +0000
treeherderautoland@d67baa908131 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1651165
milestone80.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 1651165 - Rename and redocument _scheduleArbitrarilyLateIdleTasks r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D83414
browser/components/BrowserGlue.jsm
--- a/browser/components/BrowserGlue.jsm
+++ b/browser/components/BrowserGlue.jsm
@@ -2244,17 +2244,17 @@ BrowserGlue.prototype = {
     this._scheduleStartupIdleTasks();
     this._lateTasksIdleObserver = (idleService, topic, data) => {
       if (topic == "idle") {
         idleService.removeIdleObserver(
           this._lateTasksIdleObserver,
           LATE_TASKS_IDLE_TIME_SEC
         );
         delete this._lateTasksIdleObserver;
-        this._scheduleArbitrarilyLateIdleTasks();
+        this._scheduleBestEffortUserIdleTasks();
       }
     };
     this._userIdleService.addIdleObserver(
       this._lateTasksIdleObserver,
       LATE_TASKS_IDLE_TIME_SEC
     );
 
     this._monitorScreenshotsPref();
@@ -2281,18 +2281,19 @@ BrowserGlue.prototype = {
    *
    * The functions scheduled here will fire from idle callbacks
    * once every window has finished being restored by session
    * restore, and it's guaranteed that they will run before
    * the equivalent per-window idle tasks
    * (from _schedulePerWindowIdleTasks in browser.js).
    *
    * If you have something that can wait even further than the
-   * per-window initialization, please schedule them using
-   * _scheduleArbitrarilyLateIdleTasks.
+   * per-window initialization, and is okay with not being run in some
+   * sessions, please schedule them using
+   * _scheduleBestEffortUserIdleTasks.
    * Don't be fooled by thinking that the use of the timeout parameter
    * will delay your function: it will just ensure that it potentially
    * happens _earlier_ than expected (when the timeout limit has been reached),
    * but it will not make it happen later (and out of order) compared
    * to the other ones scheduled together.
    */
   _scheduleStartupIdleTasks() {
     const idleTasks = [
@@ -2540,27 +2541,29 @@ BrowserGlue.prototype = {
           }
         },
         task.timeout ? { timeout: task.timeout } : undefined
       );
     }
   },
 
   /**
-   * Use this function as an entry point to schedule tasks that need
-   * to run once per session, at any arbitrary point in time.
+   * Use this function as an entry point to schedule tasks that we hope
+   * to run once per session, at any arbitrary point in time, and which we
+   * are okay with sometimes not running at all.
+   *
    * This function will be called from an idle observer. Check the value of
    * LATE_TASKS_IDLE_TIME_SEC to see the current value for this idle
    * observer.
    *
    * Note: this function may never be called if the user is never idle for the
-   * full length of the period of time specified. But given a reasonably low
-   * value, this is unlikely.
+   * requisite time (LATE_TASKS_IDLE_TIME_SEC). Be certain before adding
+   * something here that it's okay that it never be run.
    */
-  _scheduleArbitrarilyLateIdleTasks() {
+  _scheduleBestEffortUserIdleTasks() {
     const idleTasks = [
       () => {
         this._sendMediaTelemetry();
       },
 
       () => {
         // Telemetry for master-password - we do this after a delay as it
         // can cause IO if NSS/PSM has not already initialized.