/src/mozilla-central/gfx/thebes/gfxFontSrcURI.h
Line | Count | Source (jump to first uncovered line) |
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_FONTSRCURI_H |
7 | | #define MOZILLA_GFX_FONTSRCURI_H |
8 | | |
9 | | #include "nsCOMPtr.h" |
10 | | #include "nsIURI.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 nsIURI that can be used OMT, which has cached information |
21 | | * useful for the gfxUserFontSet. |
22 | | */ |
23 | | class gfxFontSrcURI |
24 | | { |
25 | | public: |
26 | | explicit gfxFontSrcURI(nsIURI* aURI); |
27 | | |
28 | | NS_INLINE_DECL_THREADSAFE_REFCOUNTING(gfxFontSrcURI) |
29 | | |
30 | 0 | nsIURI* get() { return mURI; } |
31 | | |
32 | | bool Equals(gfxFontSrcURI* aOther); |
33 | | nsresult GetSpec(nsACString& aResult); |
34 | | nsCString GetSpecOrDefault(); |
35 | | |
36 | 0 | PLDHashNumber Hash() const { return mHash; } |
37 | 0 | bool InheritsSecurityContext() const { return mInheritsSecurityContext; } |
38 | 0 | bool SyncLoadIsOK() const { return mSyncLoadIsOK; } |
39 | | |
40 | | private: |
41 | | ~gfxFontSrcURI(); |
42 | | |
43 | | // The URI. |
44 | | nsCOMPtr<nsIURI> mURI; |
45 | | |
46 | | // If the nsIURI is an nsSimpleURI for a data: URL, this is a pointer to it. |
47 | | // (Just a weak reference since mURI holds the strong reference.) |
48 | | // |
49 | | // We store this so that we don't duplicate the URL spec for data: URLs, |
50 | | // which can be much larger than other URLs. |
51 | | mozilla::net::nsSimpleURI* mSimpleURI; |
52 | | |
53 | | // If the nsIURI is not an nsSimpleURI, this is its spec. |
54 | | nsCString mSpec; |
55 | | |
56 | | // Precomputed hash for mURI. |
57 | | PLDHashNumber mHash; |
58 | | |
59 | | // Whether the nsIURI's protocol handler has the URI_INHERITS_SECURITY_CONTEXT |
60 | | // flag. |
61 | | bool mInheritsSecurityContext; |
62 | | |
63 | | // Whether the nsIURI's protocol handler has teh URI_SYNC_LOAD_IS_OK flag. |
64 | | bool mSyncLoadIsOK; |
65 | | }; |
66 | | |
67 | | #endif // MOZILLA_GFX_FONTSRCURI_H |