LCOV - code coverage report
Current view: top level - dom/quota - FileStreams.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 27 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 24 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 mozilla_dom_quota_filestreams_h__
       8             : #define mozilla_dom_quota_filestreams_h__
       9             : 
      10             : #include "QuotaCommon.h"
      11             : 
      12             : #include "nsFileStreams.h"
      13             : 
      14             : #include "PersistenceType.h"
      15             : #include "QuotaObject.h"
      16             : 
      17             : BEGIN_QUOTA_NAMESPACE
      18             : 
      19             : template <class FileStreamBase>
      20           0 : class FileQuotaStream : public FileStreamBase
      21             : {
      22             : public:
      23             :   // nsFileStreamBase override
      24             :   NS_IMETHOD
      25             :   SetEOF() override;
      26             : 
      27             :   NS_IMETHOD
      28             :   Close() override;
      29             : 
      30             : protected:
      31           0 :   FileQuotaStream(PersistenceType aPersistenceType, const nsACString& aGroup,
      32             :                   const nsACString& aOrigin)
      33           0 :   : mPersistenceType(aPersistenceType), mGroup(aGroup), mOrigin(aOrigin)
      34           0 :   { }
      35             : 
      36             :   // nsFileStreamBase override
      37             :   virtual nsresult
      38             :   DoOpen() override;
      39             : 
      40             :   PersistenceType mPersistenceType;
      41             :   nsCString mGroup;
      42             :   nsCString mOrigin;
      43             :   RefPtr<QuotaObject> mQuotaObject;
      44             : };
      45             : 
      46             : template <class FileStreamBase>
      47           0 : class FileQuotaStreamWithWrite : public FileQuotaStream<FileStreamBase>
      48             : {
      49             : public:
      50             :   // nsFileStreamBase override
      51             :   NS_IMETHOD
      52             :   Write(const char* aBuf, uint32_t aCount, uint32_t* _retval) override;
      53             : 
      54             : protected:
      55           0 :   FileQuotaStreamWithWrite(PersistenceType aPersistenceType,
      56             :                            const nsACString& aGroup, const nsACString& aOrigin)
      57           0 :   : FileQuotaStream<FileStreamBase>(aPersistenceType, aGroup, aOrigin)
      58           0 :   { }
      59             : };
      60             : 
      61             : class FileInputStream : public FileQuotaStream<nsFileInputStream>
      62             : {
      63             : public:
      64             :   NS_DECL_ISUPPORTS_INHERITED
      65             : 
      66             :   static already_AddRefed<FileInputStream>
      67             :   Create(PersistenceType aPersistenceType, const nsACString& aGroup,
      68             :          const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags = -1,
      69             :          int32_t aPerm = -1, int32_t aBehaviorFlags = 0);
      70             : 
      71             : private:
      72           0 :   FileInputStream(PersistenceType aPersistenceType, const nsACString& aGroup,
      73             :                   const nsACString& aOrigin)
      74           0 :   : FileQuotaStream<nsFileInputStream>(aPersistenceType, aGroup, aOrigin)
      75           0 :   { }
      76             : 
      77           0 :   virtual ~FileInputStream() {
      78           0 :     Close();
      79           0 :   }
      80             : };
      81             : 
      82             : class FileOutputStream : public FileQuotaStreamWithWrite<nsFileOutputStream>
      83             : {
      84             : public:
      85             :   NS_DECL_ISUPPORTS_INHERITED
      86             : 
      87             :   static already_AddRefed<FileOutputStream>
      88             :   Create(PersistenceType aPersistenceType, const nsACString& aGroup,
      89             :          const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags = -1,
      90             :          int32_t aPerm = -1, int32_t aBehaviorFlags = 0);
      91             : 
      92             : private:
      93           0 :   FileOutputStream(PersistenceType aPersistenceType, const nsACString& aGroup,
      94             :                    const nsACString& aOrigin)
      95           0 :   : FileQuotaStreamWithWrite<nsFileOutputStream>(aPersistenceType, aGroup,
      96           0 :                                                  aOrigin)
      97           0 :   { }
      98             : 
      99           0 :   virtual ~FileOutputStream() {
     100           0 :     Close();
     101           0 :   }
     102             : };
     103             : 
     104             : class FileStream : public FileQuotaStreamWithWrite<nsFileStream>
     105             : {
     106             : public:
     107             :   NS_DECL_ISUPPORTS_INHERITED
     108             : 
     109             :   static already_AddRefed<FileStream>
     110             :   Create(PersistenceType aPersistenceType, const nsACString& aGroup,
     111             :          const nsACString& aOrigin, nsIFile* aFile, int32_t aIOFlags = -1,
     112             :          int32_t aPerm = -1, int32_t aBehaviorFlags = 0);
     113             : 
     114             : private:
     115           0 :   FileStream(PersistenceType aPersistenceType, const nsACString& aGroup,
     116             :              const nsACString& aOrigin)
     117           0 :   : FileQuotaStreamWithWrite<nsFileStream>(aPersistenceType, aGroup, aOrigin)
     118           0 :   { }
     119             : 
     120           0 :   virtual ~FileStream() {
     121           0 :     Close();
     122           0 :   }
     123             : };
     124             : 
     125             : END_QUOTA_NAMESPACE
     126             : 
     127             : #endif /* mozilla_dom_quota_filestreams_h__ */

Generated by: LCOV version 1.13