xpcom/io/nsDirectoryService.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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/. */
     6 #ifndef nsDirectoryService_h___
     7 #define nsDirectoryService_h___
     9 #include "nsIDirectoryService.h"
    10 #include "nsInterfaceHashtable.h"
    11 #include "nsIFile.h"
    12 #include "nsIAtom.h"
    13 #include "nsTArray.h"
    14 #include "mozilla/Attributes.h"
    16 #define NS_XPCOM_INIT_CURRENT_PROCESS_DIR       "MozBinD"   // Can be used to set NS_XPCOM_CURRENT_PROCESS_DIR
    17                                                             // CANNOT be used to GET a location
    18 #define NS_DIRECTORY_SERVICE_CID  {0xf00152d0,0xb40b,0x11d3,{0x8c, 0x9c, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
    20 class nsDirectoryService MOZ_FINAL : public nsIDirectoryService,
    21                                      public nsIProperties,
    22                                      public nsIDirectoryServiceProvider2
    23 {
    24   public:
    26   // nsISupports interface
    27   NS_DECL_THREADSAFE_ISUPPORTS
    29   NS_DECL_NSIPROPERTIES  
    31   NS_DECL_NSIDIRECTORYSERVICE
    33   NS_DECL_NSIDIRECTORYSERVICEPROVIDER
    35   NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
    37   nsDirectoryService();
    38    ~nsDirectoryService();
    40   static void RealInit();
    41   void RegisterCategoryProviders();
    43   static nsresult
    44   Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
    46   static nsDirectoryService* gService;
    48 private:
    49     nsresult GetCurrentProcessDirectory(nsIFile** aFile);
    51     nsInterfaceHashtable<nsCStringHashKey, nsIFile> mHashtable;
    52     nsTArray<nsCOMPtr<nsIDirectoryServiceProvider> > mProviders;
    54 public:
    56 #define DIR_ATOM(name_, value_) static nsIAtom* name_;
    57 #include "nsDirectoryServiceAtomList.h"
    58 #undef DIR_ATOM
    60 };
    63 #endif

mercurial