//
// Automatically generated by ipdlc.
// Edit at your own risk
//

#ifndef PFileSystemManagerParent_h
#define PFileSystemManagerParent_h

#include "mozilla/dom/PFileSystemManager.h"
#ifdef DEBUG
#include "prenv.h"
#endif  // DEBUG

#include "mozilla/Tainting.h"
#include "mozilla/ipc/MessageChannel.h"
#include "mozilla/ipc/ProtocolUtils.h"
class nsIFile;

// Headers for things that cannot be forward declared
#include "mozilla/dom/FileSystemTypes.h"

namespace mozilla {
namespace dom {
class PFileSystemAccessHandleParent;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
class PFileSystemAccessHandleChild;
} // namespace dom
} // namespace mozilla

namespace mozilla {
namespace dom {
class PFileSystemAccessHandleControlParent;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
class PFileSystemAccessHandleControlChild;
} // namespace dom
} // namespace mozilla

namespace mozilla {
namespace dom {
class PFileSystemWritableFileStreamParent;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace dom {
class PFileSystemWritableFileStreamChild;
} // namespace dom
} // namespace mozilla

namespace mozilla {
namespace dom {
class PFileSystemAccessHandleParent;
} // namespace dom
} // namespace mozilla

namespace mozilla {
namespace dom {
class PFileSystemWritableFileStreamParent;
} // namespace dom
} // namespace mozilla

namespace mozilla {
struct void_t;
} // namespace mozilla

namespace mozilla {
class RemoteLazyInputStream;
} // namespace mozilla

namespace mozilla {
struct void_t;
} // namespace mozilla

namespace mozilla {
namespace dom {


class PFileSystemManagerParent :
    public mozilla::ipc::IToplevelProtocol
{
private:
    friend class ::mozilla::dom::PFileSystemAccessHandleParent;
    friend class ::mozilla::dom::PFileSystemWritableFileStreamParent;
public:
    static constexpr ::mozilla::ipc::ProtocolId kProtocolId = PFileSystemManagerMsgStart;
protected:
    typedef mozilla::ipc::ActorId ActorId;
    typedef ::mozilla::ipc::ByteBuf ByteBuf;
    typedef ::mozilla::dom::fs::ContentType ContentType;
    template<class FooSide> using Endpoint = mozilla::ipc::Endpoint<FooSide>;
    typedef ::mozilla::dom::fs::EntryId EntryId;
    typedef ::mozilla::ipc::FileDescriptor FileDescriptor;
    typedef ::mozilla::ipc::FileRandomAccessStreamParams FileRandomAccessStreamParams;
    typedef ::mozilla::dom::fs::FileSystemAccessHandleProperties FileSystemAccessHandleProperties;
    typedef ::mozilla::dom::fs::FileSystemChildMetadata FileSystemChildMetadata;
    typedef ::mozilla::dom::fs::FileSystemDirectoryListing FileSystemDirectoryListing;
    typedef ::mozilla::dom::fs::FileSystemEntryMetadata FileSystemEntryMetadata;
    typedef ::mozilla::dom::fs::FileSystemEntryPair FileSystemEntryPair;
    typedef ::mozilla::dom::fs::FileSystemFileProperties FileSystemFileProperties;
    typedef ::mozilla::dom::fs::FileSystemGetAccessHandleRequest FileSystemGetAccessHandleRequest;
    typedef ::mozilla::dom::fs::FileSystemGetAccessHandleResponse FileSystemGetAccessHandleResponse;
    typedef ::mozilla::dom::fs::FileSystemGetEntriesRequest FileSystemGetEntriesRequest;
    typedef ::mozilla::dom::fs::FileSystemGetEntriesResponse FileSystemGetEntriesResponse;
    typedef ::mozilla::dom::fs::FileSystemGetFileRequest FileSystemGetFileRequest;
    typedef ::mozilla::dom::fs::FileSystemGetFileResponse FileSystemGetFileResponse;
    typedef ::mozilla::dom::fs::FileSystemGetHandleRequest FileSystemGetHandleRequest;
    typedef ::mozilla::dom::fs::FileSystemGetHandleResponse FileSystemGetHandleResponse;
    typedef ::mozilla::dom::fs::FileSystemGetWritableFileStreamResponse FileSystemGetWritableFileStreamResponse;
    typedef ::mozilla::dom::fs::FileSystemGetWritableRequest FileSystemGetWritableRequest;
    typedef ::mozilla::dom::fs::FileSystemMoveEntryRequest FileSystemMoveEntryRequest;
    typedef ::mozilla::dom::fs::FileSystemMoveEntryResponse FileSystemMoveEntryResponse;
    typedef ::mozilla::dom::fs::FileSystemPath FileSystemPath;
    typedef ::mozilla::dom::fs::FileSystemRemoveEntryRequest FileSystemRemoveEntryRequest;
    typedef ::mozilla::dom::fs::FileSystemRemoveEntryResponse FileSystemRemoveEntryResponse;
    typedef ::mozilla::dom::fs::FileSystemRenameEntryRequest FileSystemRenameEntryRequest;
    typedef ::mozilla::dom::fs::FileSystemResolveRequest FileSystemResolveRequest;
    typedef ::mozilla::dom::fs::FileSystemResolveResponse FileSystemResolveResponse;
    typedef ::mozilla::dom::fs::FileSystemWritableFileStreamProperties FileSystemWritableFileStreamProperties;
    typedef ::mozilla::dom::IPCBlob IPCBlob;
    typedef ::mozilla::dom::IPCFile IPCFile;
    typedef ::mozilla::ipc::LimitingFileRandomAccessStreamParams LimitingFileRandomAccessStreamParams;
    template<class FooSide> using ManagedEndpoint = mozilla::ipc::ManagedEndpoint<FooSide>;
    typedef ::mozilla::dom::fs::Name Name;
    typedef ::mozilla::dom::fs::Origin Origin;
    typedef ::mozilla::dom::PFileSystemAccessHandleChild PFileSystemAccessHandleChild;
    typedef ::mozilla::dom::PFileSystemAccessHandleControlChild PFileSystemAccessHandleControlChild;
    typedef ::mozilla::dom::PFileSystemAccessHandleControlParent PFileSystemAccessHandleControlParent;
    typedef ::mozilla::dom::PFileSystemAccessHandleParent PFileSystemAccessHandleParent;
    typedef ::mozilla::dom::PFileSystemWritableFileStreamChild PFileSystemWritableFileStreamChild;
    typedef ::mozilla::dom::PFileSystemWritableFileStreamParent PFileSystemWritableFileStreamParent;
    typedef ::mozilla::dom::fs::PageNumber PageNumber;
    typedef base::ProcessId ProcessId;
    typedef mozilla::ipc::ProtocolId ProtocolId;
    typedef ::mozilla::ipc::RandomAccessStreamParams RandomAccessStreamParams;
    typedef ::mozilla::RemoteLazyInputStream RemoteLazyInputStream;
    typedef ::mozilla::RemoteLazyStream RemoteLazyStream;
    typedef mozilla::ipc::ResponseRejectReason ResponseRejectReason;
    typedef ::mozilla::ipc::Shmem Shmem;
    typedef ::mozilla::dom::fs::TimeStamp TimeStamp;
    template<class T> using UniquePtr = mozilla::UniquePtr<T>;
    typedef ::int16_t int16_t;
    typedef ::int32_t int32_t;
    typedef ::int64_t int64_t;
    typedef ::int8_t int8_t;
    typedef ::intptr_t intptr_t;
    typedef ::nsCString nsCString;
    typedef ::nsString nsString;
    typedef ::nsresult nsresult;
    typedef ::uint16_t uint16_t;
    typedef ::uint32_t uint32_t;
    typedef ::uint64_t uint64_t;
    typedef ::uint8_t uint8_t;
    typedef ::uintptr_t uintptr_t;
    typedef ::mozilla::void_t void_t;

public:
    typedef std::function<void(const FileSystemGetHandleResponse&)> GetRootHandleResolver;
    typedef std::function<void(const FileSystemGetHandleResponse&)> GetDirectoryHandleResolver;
    typedef std::function<void(const FileSystemGetHandleResponse&)> GetFileHandleResolver;
    typedef std::function<void(const FileSystemGetFileResponse&)> GetFileResolver;
    typedef std::function<void(FileSystemGetAccessHandleResponse&&)> GetAccessHandleResolver;
    typedef std::function<void(FileSystemGetWritableFileStreamResponse&&)> GetWritableResolver;
    typedef std::function<void(const FileSystemResolveResponse&)> ResolveResolver;
    typedef std::function<void(const FileSystemGetEntriesResponse&)> GetEntriesResolver;
    typedef std::function<void(const FileSystemRemoveEntryResponse&)> RemoveEntryResolver;
    typedef std::function<void(const FileSystemMoveEntryResponse&)> MoveEntryResolver;
    typedef std::function<void(const FileSystemMoveEntryResponse&)> RenameEntryResolver;
    typedef MozPromise<nsresult, ResponseRejectReason, true> CloseAllPromise;

protected:
    void
    ProcessingError(
            Result aCode,
            const char* aReason) override;
    bool
    ShouldContinueFromReplyTimeout() override;

public:
    typedef mozilla::ipc::IProtocol IProtocol;
    typedef IPC::Message Message;
    typedef base::ProcessHandle ProcessHandle;
    typedef mozilla::ipc::MessageChannel MessageChannel;

public:
    MOZ_IMPLICIT PFileSystemManagerParent();

    virtual ~PFileSystemManagerParent();

protected:
    void
    ActorAlloc() final;
    void
    ActorDealloc() final;
public:
    void
    ManagedPFileSystemAccessHandleParent(nsTArray<PFileSystemAccessHandleParent*>& aArr) const;
    const ManagedContainer<PFileSystemAccessHandleParent>&
    ManagedPFileSystemAccessHandleParent() const;

    void
    ManagedPFileSystemWritableFileStreamParent(nsTArray<PFileSystemWritableFileStreamParent*>& aArr) const;
    const ManagedContainer<PFileSystemWritableFileStreamParent>&
    ManagedPFileSystemWritableFileStreamParent() const;

    mozilla::Span<mozilla::ipc::ProtocolId const>
    ManagedProtocolIds() const final;

    UntypedManagedContainer*
    GetManagedActors(mozilla::ipc::ProtocolId aProtocol) final;

    void
    RejectPendingResponses(ResponseRejectReason aReason) final;

    ManagedEndpoint<PFileSystemAccessHandleChild>
    OpenPFileSystemAccessHandleEndpoint(PFileSystemAccessHandleParent* aActor);
    bool
    BindPFileSystemAccessHandleEndpoint(
            ManagedEndpoint<PFileSystemAccessHandleParent> aEndpoint,
            PFileSystemAccessHandleParent* aActor);

    ManagedEndpoint<PFileSystemWritableFileStreamChild>
    OpenPFileSystemWritableFileStreamEndpoint(PFileSystemWritableFileStreamParent* aActor);
    bool
    BindPFileSystemWritableFileStreamEndpoint(
            ManagedEndpoint<PFileSystemWritableFileStreamParent> aEndpoint,
            PFileSystemWritableFileStreamParent* aActor);

    [[nodiscard]] PFileSystemWritableFileStreamParent*
    SendPFileSystemWritableFileStreamConstructor(PFileSystemWritableFileStreamParent* actor);

    void
    SendCloseAll(
            mozilla::ipc::ResolveCallback<nsresult>&& aResolve,
            mozilla::ipc::RejectCallback&& aReject);

    [[nodiscard]] RefPtr<CloseAllPromise>
    SendCloseAll();

    void
    DeallocManagee(
            mozilla::ipc::ProtocolId aProtocolId,
            IProtocol* aListener) override;

    Result
    OnMessageReceived(const Message& msg__) override;

    Result
    OnMessageReceived(
            const Message& msg__,
            UniquePtr<Message>& reply__) override;

private:
    mozilla::ipc::IPDLAsyncReturnsCallbacks mAsyncCallbacks;

    ManagedContainer<PFileSystemAccessHandleParent> mManagedPFileSystemAccessHandleParent;
    ManagedContainer<PFileSystemWritableFileStreamParent> mManagedPFileSystemWritableFileStreamParent;
};


} // namespace dom
} // namespace mozilla
namespace IPC {
template<>
struct ParamTraits <::mozilla::dom::PFileSystemManagerParent*>
{
    typedef ::mozilla::dom::PFileSystemManagerParent* paramType;
    static void
    Write(
            IPC::MessageWriter* aWriter,
            const paramType& aVar);
    static IPC::ReadResult<paramType>
    Read(IPC::MessageReader* aReader);
};
} // namespace IPC

#endif // ifndef PFileSystemManagerParent_h
