Skip to content

Commit

Permalink
Bug 1672431 - Provide a shutdown client for IOUtils r=xpcom-reviewers…
Browse files Browse the repository at this point in the history
…,nika

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.)

Differential Revision: https://phabricator.services.mozilla.com/D103973
  • Loading branch information
Barret Rennie committed Feb 22, 2021
1 parent f5d842d commit 483ccc2
Show file tree
Hide file tree
Showing 3 changed files with 397 additions and 225 deletions.
8 changes: 8 additions & 0 deletions dom/chrome-webidl/IOUtils.webidl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/

interface nsIAsyncShutdownClient;

/**
* IOUtils is a simple, efficient interface for performing file I/O from a
* privileged chrome-only context. All asynchronous I/O tasks are run on
Expand Down Expand Up @@ -206,6 +208,12 @@ namespace IOUtils {
Promise<boolean> exists(DOMString path);
};

[Exposed=Window]
partial namespace IOUtils {
[Throws]
readonly attribute any profileBeforeChange;
};

/**
* Options to be passed to the |IOUtils.readUTF8| method.
*/
Expand Down
Loading

0 comments on commit 483ccc2

Please sign in to comment.