FileSystemWritableFileStreamParent.h (1922B)
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_PARENT_FILESYSTEMWRITABLEFILESTREAM_H_ 8 #define DOM_FS_PARENT_FILESYSTEMWRITABLEFILESTREAM_H_ 9 10 #include "mozilla/dom/FileSystemParentTypes.h" 11 #include "mozilla/dom/FileSystemTypes.h" 12 #include "mozilla/dom/FlippedOnce.h" 13 #include "mozilla/dom/PFileSystemWritableFileStreamParent.h" 14 15 class nsIInterfaceRequestor; 16 17 namespace mozilla::dom { 18 19 class FileSystemManagerParent; 20 21 class FileSystemWritableFileStreamParent 22 : public PFileSystemWritableFileStreamParent { 23 public: 24 FileSystemWritableFileStreamParent(RefPtr<FileSystemManagerParent> aManager, 25 const fs::EntryId& aEntryId, 26 const fs::FileId& aTemporaryFileId, 27 bool aIsExclusive); 28 29 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FileSystemWritableFileStreamParent, 30 override) 31 32 mozilla::ipc::IPCResult RecvClose(bool aAbort, CloseResolver&& aResolver); 33 34 void ActorDestroy(ActorDestroyReason aWhy) override; 35 36 nsIInterfaceRequestor* GetOrCreateStreamCallbacks(); 37 38 private: 39 class FileSystemWritableFileStreamCallbacks; 40 41 virtual ~FileSystemWritableFileStreamParent(); 42 43 bool IsClosed() const { return mClosed; } 44 45 void Close(bool aAbort); 46 47 const RefPtr<FileSystemManagerParent> mManager; 48 49 RefPtr<FileSystemWritableFileStreamCallbacks> mStreamCallbacks; 50 51 const fs::EntryId mEntryId; 52 53 const fs::FileId mTemporaryFileId; 54 55 const bool mIsExclusive; 56 57 FlippedOnce<false> mClosed; 58 }; 59 60 } // namespace mozilla::dom 61 62 #endif // DOM_FS_PARENT_FILESYSTEMWRITABLEFILESTREAM_H_