WebBrowserPersistResourcesParent.h (1952B)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * 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 WebBrowserPersistResourcesParent_h__ 8 #define WebBrowserPersistResourcesParent_h__ 9 10 #include "WebBrowserPersistDocumentParent.h" 11 #include "mozilla/PWebBrowserPersistResourcesParent.h" 12 #include "nsCOMPtr.h" 13 #include "nsIWebBrowserPersistDocument.h" 14 15 namespace mozilla { 16 17 class WebBrowserPersistResourcesParent final 18 : public PWebBrowserPersistResourcesParent, 19 public nsIWebBrowserPersistDocumentReceiver { 20 public: 21 WebBrowserPersistResourcesParent( 22 nsIWebBrowserPersistDocument* aDocument, 23 nsIWebBrowserPersistResourceVisitor* aVisitor); 24 25 virtual mozilla::ipc::IPCResult RecvVisitResource( 26 const nsACString& aURI, 27 const nsContentPolicyType& aContentPolicyType) override; 28 29 virtual mozilla::ipc::IPCResult RecvVisitDocument( 30 NotNull<PWebBrowserPersistDocumentParent*> aSubDocument) override; 31 32 virtual mozilla::ipc::IPCResult RecvVisitBrowsingContext( 33 const dom::MaybeDiscarded<dom::BrowsingContext>& aContext) override; 34 35 virtual mozilla::ipc::IPCResult Recv__delete__( 36 const nsresult& aStatus) override; 37 38 virtual void ActorDestroy(ActorDestroyReason aWhy) override; 39 40 NS_DECL_NSIWEBBROWSERPERSISTDOCUMENTRECEIVER 41 NS_DECL_ISUPPORTS 42 43 private: 44 // Note: even if the XPIDL didn't need mDocument for visitor 45 // callbacks, this object still needs to hold a strong reference 46 // to it to defer actor subtree deletion until after the 47 // visitation is finished. 48 nsCOMPtr<nsIWebBrowserPersistDocument> mDocument; 49 nsCOMPtr<nsIWebBrowserPersistResourceVisitor> mVisitor; 50 51 virtual ~WebBrowserPersistResourcesParent(); 52 }; 53 54 } // namespace mozilla 55 56 #endif // WebBrowserPersistResourcesParent_h__