Bug 1874684 - Part 4: Prefer const references instead of copying Instant values....
[gecko.git] / netwerk / ipc / DocumentChannelParent.h
blob7537c9529557554831a1a0ea2fa00435124e6cd9
1 /* vim: set sw=2 ts=8 et 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_net_DocumentChannelParent_h
8 #define mozilla_net_DocumentChannelParent_h
10 #include "mozilla/net/DocumentLoadListener.h"
11 #include "mozilla/net/PDocumentChannelParent.h"
13 namespace mozilla {
14 namespace dom {
15 class CanonicalBrowsingContext;
17 namespace net {
19 class EarlyHintConnectArgs;
21 /**
22 * An actor that forwards all changes across to DocumentChannelChild, the
23 * nsIChannel implementation owned by a content process docshell.
25 class DocumentChannelParent final
26 : public PDocumentChannelParent,
27 public DocumentLoadListener::ObjectUpgradeHandler {
28 public:
29 NS_INLINE_DECL_REFCOUNTING(DocumentChannelParent, override);
31 explicit DocumentChannelParent();
33 bool Init(dom::CanonicalBrowsingContext* aContext,
34 const DocumentChannelCreationArgs& aArgs);
36 // PDocumentChannelParent
37 ipc::IPCResult RecvCancel(const nsresult& aStatus, const nsCString& aReason) {
38 if (mDocumentLoadListener) {
39 mDocumentLoadListener->Cancel(aStatus, aReason);
41 return IPC_OK();
43 void ActorDestroy(ActorDestroyReason aWhy) override {
44 if (mDocumentLoadListener) {
45 mDocumentLoadListener->Cancel(NS_BINDING_ABORTED,
46 "DocumentChannelParent::ActorDestroy"_ns);
50 private:
51 RefPtr<ObjectUpgradePromise> UpgradeObjectLoad() override;
53 RefPtr<PDocumentChannelParent::RedirectToRealChannelPromise>
54 RedirectToRealChannel(
55 nsTArray<ipc::Endpoint<extensions::PStreamFilterParent>>&&
56 aStreamFilterEndpoints,
57 uint32_t aRedirectFlags, uint32_t aLoadFlags,
58 uint32_t aEarlyHintLinkType);
60 virtual ~DocumentChannelParent();
62 RefPtr<DocumentLoadListener> mDocumentLoadListener;
65 } // namespace net
66 } // namespace mozilla
68 #endif // mozilla_net_DocumentChannelParent_h