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_
12 #include "ipc/EnumSerializer.h"
13 #include "mozilla/dom/ServiceWorkerOpArgs.h"
15 namespace mozilla::dom
{
17 class ServiceWorkerShutdownState
{
19 // Represents the "location" of the shutdown message or completion of
22 ParentProcessMainThread
,
23 ParentProcessIpdlBackgroundThread
,
24 ContentProcessWorkerLauncherThread
,
25 ContentProcessMainThread
,
30 ServiceWorkerShutdownState();
32 ~ServiceWorkerShutdownState();
34 const char* GetProgressString() const;
36 void SetProgress(Progress aProgress
);
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
45 void MaybeReportServiceWorkerShutdownProgress(const ServiceWorkerOpArgs
& aArgs
,
46 bool aShutdownCompleted
= false);
48 } // namespace mozilla::dom
52 using Progress
= mozilla::dom::ServiceWorkerShutdownState::Progress
;
55 struct ParamTraits
<Progress
>
56 : public ContiguousEnumSerializer
<
57 Progress
, Progress::ParentProcessMainThread
, Progress::EndGuard_
> {};
61 #endif // DOM_SERVICEWORKERS_SERVICEWORKERSHUTDOWNSTATE_H_