Bug 1892041 - Part 1: Update test262 features. r=spidermonkey-reviewers,dminor
[gecko.git] / dom / serviceworkers / ServiceWorkerShutdownState.h
blobeec55fab8dd44b8839c1450b5041d21fb43232ff
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 DOM_SERVICEWORKERS_SERVICEWORKERSHUTDOWNSTATE_H_
8 #define DOM_SERVICEWORKERS_SERVICEWORKERSHUTDOWNSTATE_H_
10 #include <cstdint>
12 #include "ipc/EnumSerializer.h"
13 #include "mozilla/dom/ServiceWorkerOpArgs.h"
15 namespace mozilla::dom {
17 class ServiceWorkerShutdownState {
18 public:
19 // Represents the "location" of the shutdown message or completion of
20 // shutdown.
21 enum class Progress {
22 ParentProcessMainThread,
23 ParentProcessIpdlBackgroundThread,
24 ContentProcessWorkerLauncherThread,
25 ContentProcessMainThread,
26 ShutdownCompleted,
27 EndGuard_,
30 ServiceWorkerShutdownState();
32 ~ServiceWorkerShutdownState();
34 const char* GetProgressString() const;
36 void SetProgress(Progress aProgress);
38 private:
39 Progress mProgress;
42 // Asynchronously reports that shutdown has progressed to the calling thread
43 // if aArgs is for shutdown. If aShutdownCompleted is true, aArgs must be for
44 // shutdown.
45 void MaybeReportServiceWorkerShutdownProgress(const ServiceWorkerOpArgs& aArgs,
46 bool aShutdownCompleted = false);
48 } // namespace mozilla::dom
50 namespace IPC {
52 using Progress = mozilla::dom::ServiceWorkerShutdownState::Progress;
54 template <>
55 struct ParamTraits<Progress>
56 : public ContiguousEnumSerializer<
57 Progress, Progress::ParentProcessMainThread, Progress::EndGuard_> {};
59 } // namespace IPC
61 #endif // DOM_SERVICEWORKERS_SERVICEWORKERSHUTDOWNSTATE_H_