Bug 1885580 - Add a MenuGroup component for the menu redesign r=android-reviewers,007
[gecko.git] / dom / serviceworkers / FetchEventOpChild.h
blob0c75a399cc3ffd6b3f1dc148f6c5343a8ae62957
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_fetcheventopchild_h__
8 #define mozilla_dom_fetcheventopchild_h__
10 #include "nsCOMPtr.h"
12 #include "mozilla/MozPromise.h"
13 #include "mozilla/RefPtr.h"
14 #include "mozilla/dom/FetchService.h"
15 #include "mozilla/dom/PFetchEventOpChild.h"
16 #include "mozilla/dom/ServiceWorkerOpArgs.h"
18 class nsIInterceptedChannel;
20 namespace mozilla::dom {
22 class KeepAliveToken;
23 class PRemoteWorkerControllerChild;
24 class ServiceWorkerRegistrationInfo;
26 /**
27 * FetchEventOpChild represents an in-flight FetchEvent operation.
29 class FetchEventOpChild final : public PFetchEventOpChild {
30 friend class PFetchEventOpChild;
32 public:
33 static RefPtr<GenericPromise> SendFetchEvent(
34 PRemoteWorkerControllerChild* aManager,
35 ParentToParentServiceWorkerFetchEventOpArgs&& aArgs,
36 nsCOMPtr<nsIInterceptedChannel> aInterceptedChannel,
37 RefPtr<ServiceWorkerRegistrationInfo> aRegistrationInfo,
38 RefPtr<FetchServicePromises>&& aPreloadResponseReadyPromises,
39 RefPtr<KeepAliveToken>&& aKeepAliveToken);
41 ~FetchEventOpChild();
43 private:
44 FetchEventOpChild(
45 ParentToParentServiceWorkerFetchEventOpArgs&& aArgs,
46 nsCOMPtr<nsIInterceptedChannel>&& aInterceptedChannel,
47 RefPtr<ServiceWorkerRegistrationInfo>&& aRegistrationInfo,
48 RefPtr<FetchServicePromises>&& aPreloadResponseReadyPromises,
49 RefPtr<KeepAliveToken>&& aKeepAliveToken);
51 mozilla::ipc::IPCResult RecvAsyncLog(const nsCString& aScriptSpec,
52 const uint32_t& aLineNumber,
53 const uint32_t& aColumnNumber,
54 const nsCString& aMessageName,
55 nsTArray<nsString>&& aParams);
57 mozilla::ipc::IPCResult RecvRespondWith(
58 ParentToParentFetchEventRespondWithResult&& aResult);
60 mozilla::ipc::IPCResult Recv__delete__(
61 const ServiceWorkerFetchEventOpResult& aResult);
63 void ActorDestroy(ActorDestroyReason) override;
65 nsresult StartSynthesizedResponse(
66 ParentToParentSynthesizeResponseArgs&& aArgs);
68 void SynthesizeResponse(ParentToParentSynthesizeResponseArgs&& aArgs);
70 void ResetInterception(bool aBypass);
72 void CancelInterception(nsresult aStatus);
74 void MaybeScheduleRegistrationUpdate() const;
76 ParentToParentServiceWorkerFetchEventOpArgs mArgs;
77 nsCOMPtr<nsIInterceptedChannel> mInterceptedChannel;
78 RefPtr<ServiceWorkerRegistrationInfo> mRegistration;
79 RefPtr<KeepAliveToken> mKeepAliveToken;
80 bool mInterceptedChannelHandled = false;
81 MozPromiseHolder<GenericPromise> mPromiseHolder;
82 bool mWasSent = false;
83 MozPromiseRequestHolder<FetchServiceResponseAvailablePromise>
84 mPreloadResponseAvailablePromiseRequestHolder;
85 MozPromiseRequestHolder<FetchServiceResponseTimingPromise>
86 mPreloadResponseTimingPromiseRequestHolder;
87 MozPromiseRequestHolder<FetchServiceResponseEndPromise>
88 mPreloadResponseEndPromiseRequestHolder;
89 RefPtr<FetchServicePromises> mPreloadResponseReadyPromises;
92 } // namespace mozilla::dom
94 #endif // mozilla_dom_fetcheventopchild_h__