WorkerStatus.h (2185B)
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/. */ 6 7 #ifndef mozilla_dom_workers_WorkerStatus_h 8 #define mozilla_dom_workers_WorkerStatus_h 9 10 namespace mozilla::dom { 11 12 /** 13 * Use this chart to help figure out behavior during each of the closing 14 * statuses. Details below. 15 * 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 * +-------------+-------------+-----------------+----------+ 27 */ 28 29 enum WorkerStatus { 30 // Not yet scheduled. 31 Pending = 0, 32 33 // This status means that the worker is active. 34 Running, 35 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, 42 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, 47 48 // The application is shutting down. Setting this status causes the worker to 49 // abort immediately. 50 Killing, 51 52 // The worker is effectively dead. 53 Dead 54 }; 55 56 } // namespace mozilla::dom 57 58 #endif /* mozilla_dom_workers_WorkerStatus_h */