Line data Source code
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 "nsIPrincipal.h"
11 : #include "PLDHashTable.h"
12 :
13 : namespace mozilla {
14 : namespace net {
15 : class nsSimpleURI;
16 : } // namespace net
17 : } // namespace mozilla
18 :
19 : /**
20 : * A wrapper for an nsIPrincipal that can be used OMT, which has cached
21 : * information useful for the gfxUserFontSet.
22 : */
23 : class gfxFontSrcPrincipal
24 : {
25 : public:
26 : explicit gfxFontSrcPrincipal(nsIPrincipal* aPrincipal);
27 :
28 0 : NS_INLINE_DECL_THREADSAFE_REFCOUNTING(gfxFontSrcPrincipal)
29 :
30 0 : nsIPrincipal* get() { return mPrincipal; }
31 :
32 : bool Equals(gfxFontSrcPrincipal* aOther);
33 :
34 0 : PLDHashNumber Hash() const { return mHash; }
35 :
36 : private:
37 : ~gfxFontSrcPrincipal();
38 :
39 : // The principal.
40 : nsCOMPtr<nsIPrincipal> mPrincipal;
41 :
42 : // Precomputed hash for mPrincipal.
43 : PLDHashNumber mHash;
44 : };
45 :
46 : #endif // MOZILLA_GFX_FONTSRCPRINCIPAL_H
|