Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/xpcom/io/FileDescriptorFile.h
Line
Count
Source (jump to first uncovered line)
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 _FileDescriptorFile_h
8
#define _FileDescriptorFile_h
9
10
#include "mozilla/Attributes.h"
11
#include "mozilla/ipc/FileDescriptor.h"
12
#include "nsIFile.h"
13
#include "nsIFileURL.h"
14
#include "nsIURI.h"
15
#include "private/pprio.h"
16
17
namespace mozilla {
18
namespace net {
19
20
/**
21
 * A limited implementation of nsIFile that wraps a FileDescriptor object
22
 * allowing the file to be read from. Added to allow a child process to use
23
 * an nsIFile object for a file it does not have access to on the filesystem
24
 * but has been provided a FileDescriptor for from the parent. Many nsIFile
25
 * methods are not implemented and this is not intended to be a general
26
 * purpose file implementation.
27
 */
28
class FileDescriptorFile final : public nsIFile
29
{
30
  typedef mozilla::ipc::FileDescriptor FileDescriptor;
31
32
public:
33
  FileDescriptorFile(const FileDescriptor& aFD, nsIFile* aFile);
34
35
  NS_DECL_THREADSAFE_ISUPPORTS
36
  NS_DECL_NSIFILE
37
38
private:
39
  ~FileDescriptorFile()
40
0
  {}
41
42
  FileDescriptorFile(const FileDescriptorFile& other);
43
44
  // regular nsIFile object, that we forward most calls to.
45
  nsCOMPtr<nsIFile> mFile;
46
  FileDescriptor mFD;
47
};
48
49
} // namespace net
50
} // namespace mozilla
51
52
#endif // _FileDescriptorFile_h