xpfe/components/windowds/nsWindowDataSource.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: 4; 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/. */
     6 #include "nsIRDFDataSource.h"
     7 #include "nsIWindowMediatorListener.h"
     8 #include "nsIWindowDataSource.h"
     9 #include "nsIObserver.h"
    11 #include "nsHashKeys.h"
    12 #include "nsIRDFService.h"
    13 #include "nsIRDFContainer.h"
    14 #include "nsInterfaceHashtable.h"
    15 #include "nsCycleCollectionParticipant.h"
    17 // {C744CA3D-840B-460a-8D70-7CE63C51C958}
    18 #define NS_WINDOWDATASOURCE_CID \
    19 { 0xc744ca3d, 0x840b, 0x460a, \
    20  { 0x8d, 0x70, 0x7c, 0xe6, 0x3c, 0x51, 0xc9, 0x58 } }
    23 class nsWindowDataSource : public nsIRDFDataSource,
    24                            public nsIObserver,
    25                            public nsIWindowMediatorListener,
    26                            public nsIWindowDataSource
    27 {
    28  public:
    29     nsWindowDataSource() { }
    30     virtual ~nsWindowDataSource();
    32     nsresult Init();
    34     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
    35     NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsWindowDataSource,
    36                                              nsIRDFDataSource)
    37     NS_DECL_NSIOBSERVER
    38     NS_DECL_NSIWINDOWMEDIATORLISTENER
    39     NS_DECL_NSIWINDOWDATASOURCE
    40     NS_DECL_NSIRDFDATASOURCE
    42  private:
    44     // mapping of window -> RDF resource
    45     nsInterfaceHashtable<nsPtrHashKey<nsIXULWindow>, nsIRDFResource> mWindowResources;
    47     static uint32_t windowCount;
    48     static uint32_t gRefCnt;
    50     nsCOMPtr<nsIRDFDataSource> mInner;
    51     nsCOMPtr<nsIRDFContainer> mContainer;
    53     static nsIRDFResource* kNC_Name;
    54     static nsIRDFResource* kNC_KeyIndex;
    55     static nsIRDFResource* kNC_WindowRoot;
    56     static nsIRDFService* gRDFService;
    57 };

mercurial