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
;
24 class CacheOpChild final
: public PCacheOpChild
,
27 friend class CacheChild
;
28 friend class CacheStorageChild
;
29 friend class PCacheOpChild
;
32 // This class must be constructed by CacheChild or CacheStorageChild using
33 // their ExecuteOp() factory method.
34 CacheOpChild(SafeRefPtr
<CacheWorkerRef
> aWorkerRef
, nsIGlobalObject
* aGlobal
,
35 nsISupports
* aParent
, Promise
* aPromise
);
38 // PCacheOpChild methods
39 virtual void ActorDestroy(ActorDestroyReason aReason
) override
;
41 mozilla::ipc::IPCResult
Recv__delete__(ErrorResult
&& aRv
,
42 const CacheOpResult
& aResult
);
45 virtual void StartDestroy() override
;
48 virtual nsIGlobalObject
* GetGlobalObject() const override
;
51 virtual void AssertOwningThread() const override
;
54 virtual mozilla::ipc::PBackgroundChild
* GetIPCManager() override
;
57 void HandleResponse(const Maybe
<CacheResponse
>& aMaybeResponse
);
59 void HandleResponseList(const nsTArray
<CacheResponse
>& aResponseList
);
61 void HandleRequestList(const nsTArray
<CacheRequest
>& aRequestList
);
63 nsCOMPtr
<nsIGlobalObject
> mGlobal
;
64 // Hold the parent Cache or CacheStorage object alive until this async
65 // operation completes.
66 nsCOMPtr
<nsISupports
> mParent
;
67 RefPtr
<Promise
> mPromise
;
74 } // namespace mozilla
76 #endif // mozilla_dom_cache_CacheOpChild_h