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_cache_CacheOpChild_h
8 #define mozilla_dom_cache_CacheOpChild_h
10 #include "mozilla/dom/cache/ActorChild.h"
11 #include "mozilla/dom/cache/PCacheOpChild.h"
12 #include "mozilla/dom/cache/TypeUtils.h"
13 #include "mozilla/RefPtr.h"
15 class nsIGlobalObject
;
17 namespace mozilla::dom
{
23 class CacheOpChild final
: public PCacheOpChild
,
26 friend class CacheChild
;
27 friend class CacheStorageChild
;
28 friend class PCacheOpChild
;
31 NS_INLINE_DECL_REFCOUNTING(CacheOpChild
, override
)
34 // This class must be constructed by CacheChild or CacheStorageChild using
35 // their ExecuteOp() factory method.
36 CacheOpChild(SafeRefPtr
<CacheWorkerRef
> aWorkerRef
, nsIGlobalObject
* aGlobal
,
37 nsISupports
* aParent
, Promise
* aPromise
,
38 ActorChild
* aParentActor
);
41 // PCacheOpChild methods
42 virtual void ActorDestroy(ActorDestroyReason aReason
) override
;
44 mozilla::ipc::IPCResult
Recv__delete__(ErrorResult
&& aRv
,
45 const CacheOpResult
& aResult
);
48 virtual void StartDestroy() override
;
51 virtual nsIGlobalObject
* GetGlobalObject() const override
;
54 virtual void AssertOwningThread() const override
;
57 virtual mozilla::ipc::PBackgroundChild
* GetIPCManager() override
;
60 void HandleResponse(const Maybe
<CacheResponse
>& aMaybeResponse
);
62 void HandleResponseList(const nsTArray
<CacheResponse
>& aResponseList
);
64 void HandleRequestList(const nsTArray
<CacheRequest
>& aRequestList
);
66 nsCOMPtr
<nsIGlobalObject
> mGlobal
;
67 // Hold the parent Cache or CacheStorage object alive until this async
68 // operation completes.
69 nsCOMPtr
<nsISupports
> mParent
;
70 RefPtr
<Promise
> mPromise
;
71 ActorChild
* mParentActor
;
75 } // namespace mozilla::dom
77 #endif // mozilla_dom_cache_CacheOpChild_h