Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef mozilla_devtools_FileDescriptorOutputStream_h
7 : #define mozilla_devtools_FileDescriptorOutputStream_h
8 :
9 : #include <prio.h>
10 :
11 : #include "mozilla/AlreadyAddRefed.h"
12 : #include "mozilla/ipc/FileDescriptor.h"
13 : #include "nsIOutputStream.h"
14 :
15 : namespace mozilla {
16 : namespace devtools {
17 :
18 : class FileDescriptorOutputStream final : public nsIOutputStream
19 : {
20 : private:
21 : PRFileDesc* fd;
22 :
23 : public:
24 : static already_AddRefed<FileDescriptorOutputStream>
25 : Create(const ipc::FileDescriptor& fileDescriptor);
26 :
27 : private:
28 0 : explicit FileDescriptorOutputStream(PRFileDesc* prfd)
29 0 : : fd(prfd)
30 0 : { }
31 :
32 0 : virtual ~FileDescriptorOutputStream() { }
33 :
34 : NS_DECL_THREADSAFE_ISUPPORTS
35 : NS_DECL_NSIOUTPUTSTREAM
36 : };
37 :
38 : } // namespace devtools
39 : } // namespace mozilla
40 :
41 : #endif // mozilla_devtools_FileDescriptorOutputStream_h
|