tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

gfxFontSrcPrincipal.h (1558B)


      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/. */
      5 
      6 #ifndef MOZILLA_GFX_FONTSRCPRINCIPAL_H
      7 #define MOZILLA_GFX_FONTSRCPRINCIPAL_H
      8 
      9 #include "nsCOMPtr.h"
     10 #include "PLDHashTable.h"
     11 
     12 class nsIPrincipal;
     13 
     14 namespace mozilla {
     15 namespace net {
     16 class nsSimpleURI;
     17 }  // namespace net
     18 }  // namespace mozilla
     19 
     20 /**
     21 * A wrapper for an nsIPrincipal that can be used OMT, which has cached
     22 * information useful for the gfxUserFontSet.
     23 *
     24 * TODO(emilio): This has grown a bit more complex, but nsIPrincipal is now
     25 * thread-safe, re-evaluate the existence of this class.
     26 */
     27 class gfxFontSrcPrincipal {
     28 public:
     29  explicit gfxFontSrcPrincipal(nsIPrincipal* aNodePrincipal,
     30                               nsIPrincipal* aStoragePrincipal);
     31 
     32  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(gfxFontSrcPrincipal)
     33 
     34  nsIPrincipal* NodePrincipal() const { return mNodePrincipal; }
     35 
     36  nsIPrincipal* StoragePrincipal() const { return mStoragePrincipal; }
     37 
     38  bool Equals(gfxFontSrcPrincipal* aOther);
     39 
     40  PLDHashNumber Hash() const { return mHash; }
     41 
     42 private:
     43  ~gfxFontSrcPrincipal();
     44 
     45  // The principal of the node.
     46  nsCOMPtr<nsIPrincipal> mNodePrincipal;
     47 
     48  // The principal used for storage.
     49  nsCOMPtr<nsIPrincipal> mStoragePrincipal;
     50 
     51  // Precomputed hash for mStoragePrincipal.
     52  PLDHashNumber mHash;
     53 };
     54 
     55 #endif  // MOZILLA_GFX_FONTSRCPRINCIPAL_H