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

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
       2             :  *
       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 _nsCacheSession_h_
       8             : #define _nsCacheSession_h_
       9             : 
      10             : #include "nspr.h"
      11             : #include "nsError.h"
      12             : #include "nsCOMPtr.h"
      13             : #include "nsICacheSession.h"
      14             : #include "nsIFile.h"
      15             : #include "nsString.h"
      16             : 
      17             : class nsCacheSession : public nsICacheSession
      18             : {
      19             :     virtual ~nsCacheSession();
      20             : 
      21             : public:
      22             :     NS_DECL_ISUPPORTS
      23             :     NS_DECL_NSICACHESESSION
      24             : 
      25             :     nsCacheSession(const char * clientID, nsCacheStoragePolicy storagePolicy, bool streamBased);
      26             : 
      27           0 :     nsCString *           ClientID()      { return &mClientID; }
      28             : 
      29             :     enum SessionInfo {
      30             :         eStoragePolicyMask        = 0x000000FF,
      31             :         eStreamBasedMask          = 0x00000100,
      32             :         eDoomEntriesIfExpiredMask = 0x00001000,
      33             :         ePrivateMask              = 0x00010000
      34             :     };
      35             : 
      36           0 :     void   MarkStreamBased()  { mInfo |=  eStreamBasedMask; }
      37             :     void   ClearStreamBased() { mInfo &= ~eStreamBasedMask; }
      38           0 :     bool IsStreamBased()    { return (mInfo & eStreamBasedMask) != 0; }
      39             : 
      40           0 :     void   MarkDoomEntriesIfExpired()  { mInfo |=  eDoomEntriesIfExpiredMask; }
      41           0 :     void   ClearDoomEntriesIfExpired() { mInfo &= ~eDoomEntriesIfExpiredMask; }
      42           0 :     bool WillDoomEntriesIfExpired()  { return (0 != (mInfo & eDoomEntriesIfExpiredMask)); }
      43             : 
      44           0 :     void   MarkPrivate() { mInfo |= ePrivateMask; }
      45           0 :     void   MarkPublic() { mInfo &= ~ePrivateMask; }
      46           0 :     bool IsPrivate() { return (mInfo & ePrivateMask) != 0; }
      47           0 :     nsCacheStoragePolicy  StoragePolicy()
      48             :     {
      49           0 :         return (nsCacheStoragePolicy)(mInfo & eStoragePolicyMask);
      50             :     }
      51             : 
      52           0 :     void SetStoragePolicy(nsCacheStoragePolicy policy)
      53             :     {
      54           0 :         NS_ASSERTION(policy <= 0xFF, "too many bits in nsCacheStoragePolicy");
      55           0 :         mInfo &= ~eStoragePolicyMask; // clear storage policy bits
      56           0 :         mInfo |= policy;
      57           0 :     }
      58             : 
      59           0 :     nsIFile* ProfileDir() { return mProfileDir; }
      60             : 
      61             : private:
      62             :     nsCString               mClientID;
      63             :     uint32_t                mInfo;
      64             :     nsCOMPtr<nsIFile>       mProfileDir;
      65             : };
      66             : 
      67             : #endif // _nsCacheSession_h_

Generated by: LCOV version 1.13