Closed Bug 1672431 Opened 4 years ago Closed 4 years ago

Update AsyncShutdown blockers to allow IO until the end of the before profile change phase

Categories

(Toolkit :: Async Tooling, task, P2)

task

Tracking

()

RESOLVED FIXED
89 Branch
Tracking Status
firefox89 --- fixed

People

(Reporter: emmamalysz, Assigned: barret)

References

Details

Attachments

(2 files, 1 obsolete file)

See: https://bugzilla.mozilla.org/show_bug.cgi?id=1649595#c8

This will allow us to replace instances of OS.File.profileBeforeChange.addBlocker with AsyncShutdown.profileBeforeChange.addBlocker

Blocks: 1649601
Severity: -- → N/A
Blocks: 1231711, 1649617
Assignee: nobody → brennie
Status: NEW → ASSIGNED
Blocks: 1649606
No longer blocks: 1649617
Blocks: 1649598
Blocks: 1649604
Blocks: 1649593

IOUtils now provides a shutdown client for clients to register IO jobs with
that need to run before shutdown finishes. This allows IO jobs to run during
the profileBeforeChange phase.

IOUtils' event queuing has been refactored into a singleton EventQueue class,
which is responsible for running tasks and setting up shutdown blockers. It is
now guarded behind a StaticDataMutex so that is more explicitly clear what is
and is not re-entrant. (The atomic sShutdownFinished cannot be placed behind
the mutex because we need to keep track of that state even when we do not have
an EventQueue.)

Depends on D103972

Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/65397d9e0ff3 Remove unsued InvokeToIOPromise r=nika https://hg.mozilla.org/integration/autoland/rev/1f5a77c484b0 Provide a shutdown client for IOUtils r=xpcom-reviewers,nika

Previously we were intializing IOUtils lazily when we received our first IO
request, but that could run into problems when

  1. shutdown starts before submitting any IO requests, which would then fail to
    add shutdown blockers for phases we have already passed; or
  2. the first IO request comes from off-main-thread, which can not tell if the
    shutdown blockers are added succesfully.

Now we register an observer to initialize the event queue and add all startup
blockers in the profile-after-change phase. We can then be sure that IOUtils
will have its blockers added before profile-after-change.

Depends on D103973

Flags: needinfo?(brennie)
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/d223c887b0b6 Remove unsued InvokeToIOPromise r=nika https://hg.mozilla.org/integration/autoland/rev/b1b467fd5aeb Provide a shutdown client for IOUtils r=xpcom-reviewers,nika https://hg.mozilla.org/integration/autoland/rev/ef2e347ff4f0 Initialize IOUtils during startup r=nika
Attachment #9204088 - Attachment is obsolete: true
Flags: needinfo?(brennie)
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/fa79148301f5 Remove unsued InvokeToIOPromise r=nika https://hg.mozilla.org/integration/autoland/rev/9d117ef49249 Provide a shutdown client for IOUtils r=xpcom-reviewers,nika
Flags: needinfo?(brennie)
Attachment #9201027 - Attachment description: Bug 1672431 - Remove unsued InvokeToIOPromise r?nika → Bug 1672431 - Remove unused InvokeToIOPromise r?nika
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f4ca5feb7e35 Remove unused InvokeToIOPromise r=nika https://hg.mozilla.org/integration/autoland/rev/b9b380d9a847 Provide a shutdown client for IOUtils r=xpcom-reviewers,nika
Attachment #9201027 - Attachment description: Bug 1672431 - Remove unused InvokeToIOPromise r?nika → Bug 1672431 - Remove unsued InvokeToIOPromise r?nika
Pushed by brennie@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/33a2d9a28a54 Remove unsued InvokeToIOPromise r=nika https://hg.mozilla.org/integration/autoland/rev/f0b2f3fad47a Provide a shutdown client for IOUtils r=xpcom-reviewers,nika
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 89 Branch
Flags: needinfo?(brennie)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: