CacheStreamControlChild.h (2031B)
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_cache_CacheStreamControlChild_h 8 #define mozilla_dom_cache_CacheStreamControlChild_h 9 10 #include "mozilla/dom/cache/ActorChild.h" 11 #include "mozilla/dom/cache/PCacheStreamControlChild.h" 12 #include "mozilla/dom/cache/StreamControl.h" 13 #include "nsTObserverArray.h" 14 15 namespace mozilla::dom::cache { 16 17 class ReadStream; 18 19 class CacheStreamControlChild final : public PCacheStreamControlChild, 20 public StreamControl, 21 public CacheActorChild { 22 friend class PCacheStreamControlChild; 23 24 public: 25 explicit CacheStreamControlChild(ActorChild* aParentActor = nullptr); 26 27 // ActorChild methods 28 virtual void StartDestroy() override; 29 30 // StreamControl methods 31 virtual void SerializeControl(CacheReadStream* aReadStreamOut) override; 32 33 virtual void SerializeStream(CacheReadStream* aReadStreamOut, 34 nsIInputStream* aStream) override; 35 36 virtual void OpenStream(const nsID& aId, 37 InputStreamResolver&& aResolver) override; 38 39 NS_DECL_OWNINGTHREAD 40 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CacheStreamControlChild, override) 41 private: 42 ~CacheStreamControlChild(); 43 virtual void NoteClosedAfterForget(const nsID& aId) override; 44 45 #ifdef DEBUG 46 virtual void AssertOwningThread() override; 47 #endif 48 49 // PCacheStreamControlChild methods 50 virtual void ActorDestroy(ActorDestroyReason aReason) override; 51 mozilla::ipc::IPCResult RecvClose(const nsID& aId); 52 mozilla::ipc::IPCResult RecvCloseAll(); 53 54 ActorChild* mParentActor; 55 bool mDestroyStarted; 56 bool mDestroyDelayed; 57 }; 58 59 } // namespace mozilla::dom::cache 60 61 #endif // mozilla_dom_cache_CacheStreamControlChild_h