Bug 1866777 - Disable test_race_cache_with_network.js on windows opt for frequent...
[gecko.git] / gfx / thebes / gfxFontSrcPrincipal.h
blob44170701a16f9bb7f583e531da1358758e66077a
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 MOZILLA_GFX_FONTSRCPRINCIPAL_H
7 #define MOZILLA_GFX_FONTSRCPRINCIPAL_H
9 #include "nsCOMPtr.h"
10 #include "PLDHashTable.h"
12 class nsIPrincipal;
14 namespace mozilla {
15 namespace net {
16 class nsSimpleURI;
17 } // namespace net
18 } // namespace mozilla
20 /**
21 * A wrapper for an nsIPrincipal that can be used OMT, which has cached
22 * information useful for the gfxUserFontSet.
24 * TODO(emilio): This has grown a bit more complex, but nsIPrincipal is now
25 * thread-safe, re-evaluate the existence of this class.
27 class gfxFontSrcPrincipal {
28 public:
29 explicit gfxFontSrcPrincipal(nsIPrincipal* aNodePrincipal,
30 nsIPrincipal* aStoragePrincipal);
32 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(gfxFontSrcPrincipal)
34 nsIPrincipal* NodePrincipal() const { return mNodePrincipal; }
36 nsIPrincipal* StoragePrincipal() const { return mStoragePrincipal; }
38 bool Equals(gfxFontSrcPrincipal* aOther);
40 PLDHashNumber Hash() const { return mHash; }
42 private:
43 ~gfxFontSrcPrincipal();
45 // The principal of the node.
46 nsCOMPtr<nsIPrincipal> mNodePrincipal;
48 // The principal used for storage.
49 nsCOMPtr<nsIPrincipal> mStoragePrincipal;
51 // Precomputed hash for mStoragePrincipal.
52 PLDHashNumber mHash;
55 #endif // MOZILLA_GFX_FONTSRCPRINCIPAL_H