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/. */
7 #ifndef _FileDescriptorFile_h
8 #define _FileDescriptorFile_h
10 #include "mozilla/Attributes.h"
11 #include "mozilla/ipc/FileDescriptor.h"
13 #include "private/pprio.h"
19 * A limited implementation of nsIFile that wraps a FileDescriptor object
20 * allowing the file to be read from. Added to allow a child process to use
21 * an nsIFile object for a file it does not have access to on the filesystem
22 * but has been provided a FileDescriptor for from the parent. Many nsIFile
23 * methods are not implemented and this is not intended to be a general
24 * purpose file implementation.
26 class FileDescriptorFile final
: public nsIFile
{
27 typedef mozilla::ipc::FileDescriptor FileDescriptor
;
30 FileDescriptorFile(const FileDescriptor
& aFD
, nsIFile
* aFile
);
32 NS_DECL_THREADSAFE_ISUPPORTS
36 ~FileDescriptorFile() = default;
38 FileDescriptorFile(const FileDescriptorFile
& other
);
40 // regular nsIFile object, that we forward most calls to.
41 nsCOMPtr
<nsIFile
> mFile
;
46 } // namespace mozilla
48 #endif // _FileDescriptorFile_h