FileSystemBackgroundRequestHandler.h (2141B)
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 DOM_FS_CHILD_FILESYSTEMBACKGROUNDREQUESTHANDLER_H_ 8 #define DOM_FS_CHILD_FILESYSTEMBACKGROUNDREQUESTHANDLER_H_ 9 10 #include "mozilla/MozPromise.h" 11 #include "mozilla/UniquePtr.h" 12 #include "mozilla/dom/FileSystemManagerChild.h" 13 #include "mozilla/dom/quota/ForwardDecls.h" 14 #include "mozilla/ipc/PBackgroundChild.h" 15 16 template <class T> 17 class RefPtr; 18 19 namespace mozilla { 20 21 namespace ipc { 22 class PrincipalInfo; 23 } // namespace ipc 24 25 namespace dom { 26 27 namespace fs { 28 class FileSystemChildFactory; 29 } 30 31 class FileSystemBackgroundRequestHandler { 32 public: 33 explicit FileSystemBackgroundRequestHandler( 34 fs::FileSystemChildFactory* aChildFactory); 35 36 explicit FileSystemBackgroundRequestHandler( 37 RefPtr<FileSystemManagerChild> aFileSystemManagerChild); 38 39 FileSystemBackgroundRequestHandler(); 40 41 NS_INLINE_DECL_REFCOUNTING(FileSystemBackgroundRequestHandler) 42 43 void ClearActor(); 44 45 void Shutdown(); 46 47 const RefPtr<FileSystemManagerChild>& FileSystemManagerChildStrongRef() const; 48 49 virtual RefPtr<FileSystemManagerChild::ActorPromise> 50 CreateFileSystemManagerChild( 51 const mozilla::ipc::PrincipalInfo& aPrincipalInfo); 52 53 protected: 54 virtual ~FileSystemBackgroundRequestHandler(); 55 56 const UniquePtr<fs::FileSystemChildFactory> mChildFactory; 57 58 MozPromiseRequestHolder< 59 mozilla::ipc::PBackgroundChild::CreateFileSystemManagerParentPromise> 60 mCreateFileSystemManagerParentPromiseRequestHolder; 61 MozPromiseHolder<FileSystemManagerChild::ActorPromise> 62 mCreateFileSystemManagerChildPromiseHolder; 63 64 RefPtr<FileSystemManagerChild> mFileSystemManagerChild; 65 66 FlippedOnce<false> mShutdown; 67 68 bool mCreatingFileSystemManagerChild; 69 }; // class FileSystemBackgroundRequestHandler 70 71 } // namespace dom 72 } // namespace mozilla 73 74 #endif // DOM_FS_CHILD_FILESYSTEMBACKGROUNDREQUESTHANDLER_H_