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

#ifndef PFileSystemManagerChild_h
#define PFileSystemManagerChild_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"
// Headers for things that cannot be forward declared
#include "mozilla/dom/FileSystemTypes.h"

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

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

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

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

namespace mozilla {
namespace dom {
class PFileSystemWritableFileStreamChild;
} // 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 PFileSystemManagerChild :
    public mozilla::ipc::IToplevelProtocol
{
private:
    friend class ::mozilla::dom::PFileSystemAccessHandleChild;
    friend class ::mozilla::dom::PFileSystemWritableFileStreamChild;
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 MozPromise<FileSystemGetHandleResponse, ResponseRejectReason, true> GetRootHandlePromise;
    typedef MozPromise<FileSystemGetHandleResponse, ResponseRejectReason, true> GetDirectoryHandlePromise;
    typedef MozPromise<FileSystemGetHandleResponse, ResponseRejectReason, true> GetFileHandlePromise;
    typedef MozPromise<FileSystemGetFileResponse, ResponseRejectReason, true> GetFilePromise;
    typedef MozPromise<FileSystemGetAccessHandleResponse, ResponseRejectReason, true> GetAccessHandlePromise;
    typedef MozPromise<FileSystemGetWritableFileStreamResponse, ResponseRejectReason, true> GetWritablePromise;
    typedef MozPromise<FileSystemResolveResponse, ResponseRejectReason, true> ResolvePromise;
    typedef MozPromise<FileSystemGetEntriesResponse, ResponseRejectReason, true> GetEntriesPromise;
    typedef MozPromise<FileSystemRemoveEntryResponse, ResponseRejectReason, true> RemoveEntryPromise;
    typedef MozPromise<FileSystemMoveEntryResponse, ResponseRejectReason, true> MoveEntryPromise;
    typedef MozPromise<FileSystemMoveEntryResponse, ResponseRejectReason, true> RenameEntryPromise;
    typedef std::function<void(const nsresult&)> CloseAllResolver;

protected:
    virtual mozilla::ipc::IPCResult
    RecvPFileSystemWritableFileStreamConstructor(PFileSystemWritableFileStreamChild* actor);
    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 PFileSystemManagerChild();

    virtual ~PFileSystemManagerChild();

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

    void
    ManagedPFileSystemWritableFileStreamChild(nsTArray<PFileSystemWritableFileStreamChild*>& aArr) const;
    const ManagedContainer<PFileSystemWritableFileStreamChild>&
    ManagedPFileSystemWritableFileStreamChild() const;

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

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

    void
    RejectPendingResponses(ResponseRejectReason aReason) final;

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

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

    virtual void
    SendGetRootHandle(
            mozilla::ipc::ResolveCallback<FileSystemGetHandleResponse>&& aResolve,
            mozilla::ipc::RejectCallback&& aReject);

    virtual RefPtr<GetRootHandlePromise>
    SendGetRootHandle();

    virtual void
    SendGetDirectoryHandle(
            const FileSystemGetHandleRequest& request,
            mozilla::ipc::ResolveCallback<FileSystemGetHandleResponse>&& aResolve,
            mozilla::ipc::RejectCallback&& aReject);

    virtual RefPtr<GetDirectoryHandlePromise>
    SendGetDirectoryHandle(const FileSystemGetHandleRequest& request);

    virtual void
    SendGetFileHandle(
            const FileSystemGetHandleRequest& request,
            mozilla::ipc::ResolveCallback<FileSystemGetHandleResponse>&& aResolve,
            mozilla::ipc::RejectCallback&& aReject);

    virtual RefPtr<GetFileHandlePromise>
    SendGetFileHandle(const FileSystemGetHandleRequest& request);

    virtual void
    SendGetFile(
            const FileSystemGetFileRequest& request,
            mozilla::ipc::ResolveCallback<FileSystemGetFileResponse>&& aResolve,
            mozilla::ipc::RejectCallback&& aReject);

    virtual RefPtr<GetFilePromise>
    SendGetFile(const FileSystemGetFileRequest& request);

    virtual void
    SendGetAccessHandle(
            const FileSystemGetAccessHandleRequest& request,
            mozilla::ipc::ResolveCallback<FileSystemGetAccessHandleResponse>&& aResolve,
            mozilla::ipc::RejectCallback&& aReject);

    virtual RefPtr<GetAccessHandlePromise>
    SendGetAccessHandle(const FileSystemGetAccessHandleRequest& request);

    virtual void
    SendGetWritable(
            const FileSystemGetWritableRequest& request,
            mozilla::ipc::ResolveCallback<FileSystemGetWritableFileStreamResponse>&& aResolve,
            mozilla::ipc::RejectCallback&& aReject);

    virtual RefPtr<GetWritablePromise>
    SendGetWritable(const FileSystemGetWritableRequest& request);

    virtual void
    SendResolve(
            const FileSystemResolveRequest& request,
            mozilla::ipc::ResolveCallback<FileSystemResolveResponse>&& aResolve,
            mozilla::ipc::RejectCallback&& aReject);

    virtual RefPtr<ResolvePromise>
    SendResolve(const FileSystemResolveRequest& request);

    virtual void
    SendGetEntries(
            const FileSystemGetEntriesRequest& request,
            mozilla::ipc::ResolveCallback<FileSystemGetEntriesResponse>&& aResolve,
            mozilla::ipc::RejectCallback&& aReject);

    virtual RefPtr<GetEntriesPromise>
    SendGetEntries(const FileSystemGetEntriesRequest& request);

    virtual void
    SendRemoveEntry(
            const FileSystemRemoveEntryRequest& request,
            mozilla::ipc::ResolveCallback<FileSystemRemoveEntryResponse>&& aResolve,
            mozilla::ipc::RejectCallback&& aReject);

    virtual RefPtr<RemoveEntryPromise>
    SendRemoveEntry(const FileSystemRemoveEntryRequest& request);

    void
    SendMoveEntry(
            const FileSystemMoveEntryRequest& request,
            mozilla::ipc::ResolveCallback<FileSystemMoveEntryResponse>&& aResolve,
            mozilla::ipc::RejectCallback&& aReject);

    RefPtr<MoveEntryPromise>
    SendMoveEntry(const FileSystemMoveEntryRequest& request);

    void
    SendRenameEntry(
            const FileSystemRenameEntryRequest& request,
            mozilla::ipc::ResolveCallback<FileSystemMoveEntryResponse>&& aResolve,
            mozilla::ipc::RejectCallback&& aReject);

    RefPtr<RenameEntryPromise>
    SendRenameEntry(const FileSystemRenameEntryRequest& request);

    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<PFileSystemAccessHandleChild> mManagedPFileSystemAccessHandleChild;
    ManagedContainer<PFileSystemWritableFileStreamChild> mManagedPFileSystemWritableFileStreamChild;
};


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

#endif // ifndef PFileSystemManagerChild_h
