2019-08-15 20:27:07 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_fetcheventopproxychild_h__
|
|
|
|
#define mozilla_dom_fetcheventopproxychild_h__
|
|
|
|
|
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
|
2019-08-15 20:27:08 +03:00
|
|
|
#include "ServiceWorkerOp.h"
|
2019-08-15 20:27:07 +03:00
|
|
|
#include "ServiceWorkerOpPromise.h"
|
2021-11-09 23:24:27 +03:00
|
|
|
#include "mozilla/MozPromise.h"
|
2019-08-15 20:27:07 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
|
|
|
#include "mozilla/dom/InternalRequest.h"
|
|
|
|
#include "mozilla/dom/PFetchEventOpProxyChild.h"
|
|
|
|
|
2022-05-09 23:41:13 +03:00
|
|
|
namespace mozilla::dom {
|
2019-08-15 20:27:07 +03:00
|
|
|
|
|
|
|
class InternalRequest;
|
2021-11-09 23:24:27 +03:00
|
|
|
class InternalResponse;
|
2021-11-19 19:45:19 +03:00
|
|
|
class ParentToChildServiceWorkerFetchEventOpArgs;
|
2019-08-15 20:27:07 +03:00
|
|
|
|
|
|
|
class FetchEventOpProxyChild final : public PFetchEventOpProxyChild {
|
|
|
|
friend class PFetchEventOpProxyChild;
|
|
|
|
|
|
|
|
public:
|
2021-11-08 16:29:32 +03:00
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FetchEventOpProxyChild, override);
|
2019-08-15 20:27:07 +03:00
|
|
|
|
|
|
|
FetchEventOpProxyChild() = default;
|
|
|
|
|
2021-11-19 19:45:19 +03:00
|
|
|
void Initialize(const ParentToChildServiceWorkerFetchEventOpArgs& aArgs);
|
2019-08-15 20:27:07 +03:00
|
|
|
|
|
|
|
// Must only be called once and on a worker thread.
|
2020-05-11 15:10:53 +03:00
|
|
|
SafeRefPtr<InternalRequest> ExtractInternalRequest();
|
2019-08-15 20:27:07 +03:00
|
|
|
|
2022-05-11 22:40:47 +03:00
|
|
|
RefPtr<FetchEventPreloadResponseAvailablePromise>
|
|
|
|
GetPreloadResponseAvailablePromise();
|
|
|
|
|
2023-02-23 05:52:54 +03:00
|
|
|
RefPtr<FetchEventPreloadResponseTimingPromise>
|
|
|
|
GetPreloadResponseTimingPromise();
|
|
|
|
|
2022-05-11 22:40:47 +03:00
|
|
|
RefPtr<FetchEventPreloadResponseEndPromise> GetPreloadResponseEndPromise();
|
2021-11-09 23:24:27 +03:00
|
|
|
|
2019-08-15 20:27:07 +03:00
|
|
|
private:
|
|
|
|
~FetchEventOpProxyChild() = default;
|
|
|
|
|
2021-11-19 19:45:19 +03:00
|
|
|
mozilla::ipc::IPCResult RecvPreloadResponse(
|
2022-05-11 22:40:47 +03:00
|
|
|
ParentToChildInternalResponse&& aResponse);
|
|
|
|
|
2023-02-23 05:52:54 +03:00
|
|
|
mozilla::ipc::IPCResult RecvPreloadResponseTiming(ResponseTiming&& aTiming);
|
|
|
|
|
2022-05-11 22:40:47 +03:00
|
|
|
mozilla::ipc::IPCResult RecvPreloadResponseEnd(ResponseEndArgs&& aArgs);
|
2021-11-09 23:24:27 +03:00
|
|
|
|
2019-08-15 20:27:07 +03:00
|
|
|
void ActorDestroy(ActorDestroyReason) override;
|
|
|
|
|
|
|
|
MozPromiseRequestHolder<FetchEventRespondWithPromise>
|
|
|
|
mRespondWithPromiseRequestHolder;
|
|
|
|
|
2019-08-15 20:27:08 +03:00
|
|
|
RefPtr<FetchEventOp> mOp;
|
|
|
|
|
2019-08-15 20:27:07 +03:00
|
|
|
// Initialized on RemoteWorkerService::Thread, read on a worker thread.
|
2020-05-11 15:10:53 +03:00
|
|
|
SafeRefPtr<InternalRequest> mInternalRequest;
|
2021-11-09 23:24:27 +03:00
|
|
|
|
2022-05-11 22:40:47 +03:00
|
|
|
RefPtr<FetchEventPreloadResponseAvailablePromise::Private>
|
|
|
|
mPreloadResponseAvailablePromise;
|
2023-02-23 05:52:54 +03:00
|
|
|
RefPtr<FetchEventPreloadResponseTimingPromise::Private>
|
|
|
|
mPreloadResponseTimingPromise;
|
2022-05-11 22:40:47 +03:00
|
|
|
RefPtr<FetchEventPreloadResponseEndPromise::Private>
|
|
|
|
mPreloadResponseEndPromise;
|
|
|
|
|
|
|
|
Maybe<ServiceWorkerOpResult> mCachedOpResult;
|
2019-08-15 20:27:07 +03:00
|
|
|
};
|
|
|
|
|
2022-05-09 23:41:13 +03:00
|
|
|
} // namespace mozilla::dom
|
2019-08-15 20:27:07 +03:00
|
|
|
|
|
|
|
#endif // mozilla_dom_fetcheventopproxychild_h__
|