FileDescriptorOutputStream.h (1074B)
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 private: 20 PRFileDesc* fd; 21 22 public: 23 static already_AddRefed<FileDescriptorOutputStream> Create( 24 const ipc::FileDescriptor& fileDescriptor); 25 26 private: 27 explicit FileDescriptorOutputStream(PRFileDesc* prfd) : fd(prfd) {} 28 29 virtual ~FileDescriptorOutputStream() {} 30 31 NS_DECL_THREADSAFE_ISUPPORTS 32 NS_DECL_NSIOUTPUTSTREAM 33 }; 34 35 } // namespace devtools 36 } // namespace mozilla 37 38 #endif // mozilla_devtools_FileDescriptorOutputStream_h