LCOV - code coverage report
Current view: top level - netwerk/base - nsTemporaryFileInputStream.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 12 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       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 nsTemporaryFileInputStream_h__
       7             : #define nsTemporaryFileInputStream_h__
       8             : 
       9             : #include "mozilla/Mutex.h"
      10             : #include "nsAutoPtr.h"
      11             : #include "nsIInputStream.h"
      12             : #include "nsIIPCSerializableInputStream.h"
      13             : #include "nsISeekableStream.h"
      14             : #include "prio.h"
      15             : 
      16             : class nsTemporaryFileInputStream : public nsIInputStream
      17             :                                  , public nsISeekableStream
      18             :                                  , public nsIIPCSerializableInputStream
      19             : {
      20             : public:
      21             :   //used to release a PRFileDesc
      22             :   class FileDescOwner
      23             :   {
      24             :     friend class nsTemporaryFileInputStream;
      25             :   public:
      26           0 :     NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FileDescOwner)
      27           0 :     explicit FileDescOwner(PRFileDesc* aFD)
      28           0 :       : mFD(aFD),
      29           0 :         mMutex("FileDescOwner::mMutex")
      30             :     {
      31           0 :       MOZ_ASSERT(aFD);
      32           0 :     }
      33             :   private:
      34           0 :     ~FileDescOwner()
      35           0 :     {
      36           0 :       PR_Close(mFD);
      37           0 :     }
      38             :   public:
      39           0 :     mozilla::Mutex& FileMutex() { return mMutex; }
      40             : 
      41             :   private:
      42             :     PRFileDesc* mFD;
      43             :     mozilla::Mutex mMutex;
      44             :   };
      45             : 
      46             :   nsTemporaryFileInputStream(FileDescOwner* aFileDescOwner, uint64_t aStartPos, uint64_t aEndPos);
      47             :   nsTemporaryFileInputStream();
      48             : 
      49             :   NS_DECL_THREADSAFE_ISUPPORTS
      50             :   NS_DECL_NSIINPUTSTREAM
      51             :   NS_DECL_NSISEEKABLESTREAM
      52             :   NS_DECL_NSIIPCSERIALIZABLEINPUTSTREAM
      53             : 
      54             : private:
      55           0 :   virtual ~nsTemporaryFileInputStream() { }
      56             : 
      57             :   RefPtr<FileDescOwner> mFileDescOwner;
      58             :   uint64_t mStartPos;
      59             :   uint64_t mCurPos;
      60             :   uint64_t mEndPos;
      61             :   bool mClosed;
      62             : };
      63             : 
      64             : #endif // nsTemporaryFileInputStream_h__

Generated by: LCOV version 1.13