Bug 1861467 - [wpt-sync] Update web-platform-tests to eedf737ce39c512d0ca3471f988972e...
[gecko.git] / dom / workers / WorkerStatus.h
blob696abc5d2c2f02fe38d8614f83f16e5cead01cf3
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_workers_WorkerStatus_h
8 #define mozilla_dom_workers_WorkerStatus_h
10 namespace mozilla::dom {
12 /**
13 * Use this chart to help figure out behavior during each of the closing
14 * statuses. Details below.
16 * +========================================================+
17 * | Closing Statuses |
18 * +=============+=============+=================+==========+
19 * | status | clear queue | abort execution | notified |
20 * +=============+=============+=================+==========+
21 * | Closing | yes | no | no |
22 * +-------------+-------------+-----------------+----------+
23 * | Canceling | yes | yes | yes |
24 * +-------------+-------------+-----------------+----------+
25 * | Killing | yes | yes | yes |
26 * +-------------+-------------+-----------------+----------+
29 enum WorkerStatus {
30 // Not yet scheduled.
31 Pending = 0,
33 // This status means that the worker is active.
34 Running,
36 // Inner script called close() on the worker global scope. Setting this
37 // status causes the worker to clear its queue of events but does not abort
38 // the currently running script. WorkerRef objects are not going to be
39 // notified because the behavior of APIs/Components should not change during
40 // this status yet.
41 Closing,
43 // Either the user navigated away from the owning page or the owning page fell
44 // out of bfcache. Setting this status causes the worker to abort immediately.
45 // Since the page has gone away the worker may not post any messages.
46 Canceling,
48 // The application is shutting down. Setting this status causes the worker to
49 // abort immediately.
50 Killing,
52 // The worker is effectively dead.
53 Dead
56 } // namespace mozilla::dom
58 #endif /* mozilla_dom_workers_WorkerStatus_h */