Source code

Revision control

Other Tools

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_fetcheventopchild_h__
8
#define mozilla_dom_fetcheventopchild_h__
9
10
#include "nsCOMPtr.h"
11
12
#include "mozilla/MozPromise.h"
13
#include "mozilla/RefPtr.h"
14
#include "mozilla/dom/PFetchEventOpChild.h"
15
#include "mozilla/dom/ServiceWorkerOpArgs.h"
16
17
class nsIInterceptedChannel;
18
19
namespace mozilla {
20
namespace dom {
21
22
class KeepAliveToken;
23
class PRemoteWorkerControllerChild;
24
class ServiceWorkerRegistrationInfo;
25
26
/**
27
* FetchEventOpChild represents an in-flight FetchEvent operation.
28
*/
29
class FetchEventOpChild final : public PFetchEventOpChild {
30
friend class PFetchEventOpChild;
31
32
public:
33
static RefPtr<GenericPromise> SendFetchEvent(
34
PRemoteWorkerControllerChild* aManager,
35
ServiceWorkerFetchEventOpArgs&& aArgs,
36
nsCOMPtr<nsIInterceptedChannel> aInterceptedChannel,
37
RefPtr<ServiceWorkerRegistrationInfo> aRegistrationInfo,
38
RefPtr<KeepAliveToken>&& aKeepAliveToken);
39
40
~FetchEventOpChild();
41
42
private:
43
FetchEventOpChild(ServiceWorkerFetchEventOpArgs&& aArgs,
44
nsCOMPtr<nsIInterceptedChannel>&& aInterceptedChannel,
45
RefPtr<ServiceWorkerRegistrationInfo>&& aRegistrationInfo,
46
RefPtr<KeepAliveToken>&& aKeepAliveToken);
47
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);
53
54
mozilla::ipc::IPCResult RecvRespondWith(
55
IPCFetchEventRespondWithResult&& aResult);
56
57
mozilla::ipc::IPCResult Recv__delete__(
58
const ServiceWorkerFetchEventOpResult& aResult) override;
59
60
void ActorDestroy(ActorDestroyReason) override;
61
62
nsresult StartSynthesizedResponse(IPCSynthesizeResponseArgs&& aArgs);
63
64
void SynthesizeResponse(IPCSynthesizeResponseArgs&& aArgs);
65
66
void ResetInterception();
67
68
void CancelInterception(nsresult aStatus);
69
70
void MaybeScheduleRegistrationUpdate() const;
71
72
const ServiceWorkerFetchEventOpArgs mArgs;
73
nsCOMPtr<nsIInterceptedChannel> mInterceptedChannel;
74
RefPtr<ServiceWorkerRegistrationInfo> mRegistration;
75
RefPtr<KeepAliveToken> mKeepAliveToken;
76
bool mInterceptedChannelHandled = false;
77
MozPromiseHolder<GenericPromise> mPromiseHolder;
78
};
79
80
} // namespace dom
81
} // namespace mozilla
82
83
#endif // mozilla_dom_fetcheventopchild_h__