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_fetcheventopproxyparent_h__
8 #define mozilla_dom_fetcheventopproxyparent_h__
10 #include "mozilla/RefPtr.h"
11 #include "mozilla/dom/PFetchEventOpProxyParent.h"
12 #include "mozilla/dom/ServiceWorkerOpPromise.h"
14 namespace mozilla::dom
{
16 class FetchEventOpParent
;
17 class PRemoteWorkerParent
;
18 class ParentToParentServiceWorkerFetchEventOpArgs
;
21 * FetchEventOpProxyParent owns a FetchEventOpParent in order to propagate
22 * the respondWith() value by directly calling SendRespondWith on the
23 * FetchEventOpParent, but the call to Send__delete__ is handled via MozPromise.
24 * This is done because this actor may only be created after its managing
25 * PRemoteWorker is created, which is asynchronous and may fail. We take on
26 * responsibility for the promise once we are created, but we may not be created
27 * if the RemoteWorker is never successfully launched.
29 class FetchEventOpProxyParent final
: public PFetchEventOpProxyParent
{
30 friend class PFetchEventOpProxyParent
;
33 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FetchEventOpProxyParent
, override
);
36 PRemoteWorkerParent
* aManager
,
37 RefPtr
<ServiceWorkerFetchEventOpPromise::Private
>&& aPromise
,
38 const ParentToParentServiceWorkerFetchEventOpArgs
& aArgs
,
39 RefPtr
<FetchEventOpParent
> aReal
, nsCOMPtr
<nsIInputStream
> aBodyStream
);
42 FetchEventOpProxyParent(
43 RefPtr
<FetchEventOpParent
>&& aReal
,
44 RefPtr
<ServiceWorkerFetchEventOpPromise::Private
>&& aPromise
);
46 ~FetchEventOpProxyParent();
48 mozilla::ipc::IPCResult
RecvAsyncLog(const nsCString
& aScriptSpec
,
49 const uint32_t& aLineNumber
,
50 const uint32_t& aColumnNumber
,
51 const nsCString
& aMessageName
,
52 nsTArray
<nsString
>&& aParams
);
54 mozilla::ipc::IPCResult
RecvRespondWith(
55 const ChildToParentFetchEventRespondWithResult
& aResult
);
57 mozilla::ipc::IPCResult
Recv__delete__(
58 const ServiceWorkerFetchEventOpResult
& aResult
);
60 void ActorDestroy(ActorDestroyReason
) override
;
62 RefPtr
<FetchEventOpParent
> mReal
;
63 RefPtr
<ServiceWorkerFetchEventOpPromise::Private
> mLifetimePromise
;
66 } // namespace mozilla::dom
68 #endif // mozilla_dom_fetcheventopproxyparent_h__