BackgroundStarterParent.h (1669B)
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 file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_ipc_BackgroundStarterParent_h 8 #define mozilla_ipc_BackgroundStarterParent_h 9 10 #include "mozilla/ipc/PBackgroundStarterParent.h" 11 #include "mozilla/dom/ContentParent.h" 12 #include "nsISupportsImpl.h" 13 14 namespace mozilla::ipc { 15 16 class BackgroundStarterParent final : public PBackgroundStarterParent { 17 public: 18 NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_DELETE_ON_MAIN_THREAD( 19 BackgroundStarterParent, override) 20 21 // Implemented in BackgroundImpl.cpp 22 BackgroundStarterParent(mozilla::dom::ThreadsafeContentParentHandle* aContent, 23 bool aCrossProcess); 24 25 void SetLiveActorArray(nsTArray<IToplevelProtocol*>* aLiveActorArray); 26 27 private: 28 friend class PBackgroundStarterParent; 29 ~BackgroundStarterParent() = default; 30 31 // Implemented in BackgroundImpl.cpp 32 void ActorDestroy(ActorDestroyReason aReason) override; 33 34 // Implemented in BackgroundImpl.cpp 35 IPCResult RecvInitBackground(Endpoint<PBackgroundParent>&& aEndpoint); 36 37 const bool mCrossProcess; 38 39 const RefPtr<mozilla::dom::ThreadsafeContentParentHandle> mContent; 40 41 // Set when the actor is opened successfully and used to handle shutdown 42 // hangs. Only touched on the background thread. 43 nsTArray<IToplevelProtocol*>* mLiveActorArray = nullptr; 44 }; 45 46 } // namespace mozilla::ipc 47 48 #endif // mozilla_ipc_BackgroundStarterParent_h