Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* vim: set sw=4 ts=8 et tw=80 : */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef nsDNSService2_h__ |
michael@0 | 8 | #define nsDNSService2_h__ |
michael@0 | 9 | |
michael@0 | 10 | #include "nsPIDNSService.h" |
michael@0 | 11 | #include "nsIIDNService.h" |
michael@0 | 12 | #include "nsIMemoryReporter.h" |
michael@0 | 13 | #include "nsIObserver.h" |
michael@0 | 14 | #include "nsHostResolver.h" |
michael@0 | 15 | #include "nsAutoPtr.h" |
michael@0 | 16 | #include "nsString.h" |
michael@0 | 17 | #include "nsTHashtable.h" |
michael@0 | 18 | #include "nsHashKeys.h" |
michael@0 | 19 | #include "nsIObserverService.h" |
michael@0 | 20 | #include "nsProxyRelease.h" |
michael@0 | 21 | #include "mozilla/Mutex.h" |
michael@0 | 22 | #include "mozilla/Attributes.h" |
michael@0 | 23 | |
michael@0 | 24 | class nsDNSService MOZ_FINAL : public nsPIDNSService |
michael@0 | 25 | , public nsIObserver |
michael@0 | 26 | , public nsIMemoryReporter |
michael@0 | 27 | { |
michael@0 | 28 | public: |
michael@0 | 29 | NS_DECL_THREADSAFE_ISUPPORTS |
michael@0 | 30 | NS_DECL_NSPIDNSSERVICE |
michael@0 | 31 | NS_DECL_NSIDNSSERVICE |
michael@0 | 32 | NS_DECL_NSIOBSERVER |
michael@0 | 33 | NS_DECL_NSIMEMORYREPORTER |
michael@0 | 34 | |
michael@0 | 35 | nsDNSService(); |
michael@0 | 36 | ~nsDNSService(); |
michael@0 | 37 | |
michael@0 | 38 | static nsIDNSService* GetXPCOMSingleton(); |
michael@0 | 39 | |
michael@0 | 40 | size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const; |
michael@0 | 41 | |
michael@0 | 42 | private: |
michael@0 | 43 | static nsDNSService* GetSingleton(); |
michael@0 | 44 | |
michael@0 | 45 | uint16_t GetAFForLookup(const nsACString &host, uint32_t flags); |
michael@0 | 46 | |
michael@0 | 47 | nsRefPtr<nsHostResolver> mResolver; |
michael@0 | 48 | nsCOMPtr<nsIIDNService> mIDN; |
michael@0 | 49 | |
michael@0 | 50 | // mLock protects access to mResolver and mIPv4OnlyDomains |
michael@0 | 51 | mozilla::Mutex mLock; |
michael@0 | 52 | |
michael@0 | 53 | // mIPv4OnlyDomains is a comma-separated list of domains for which only |
michael@0 | 54 | // IPv4 DNS lookups are performed. This allows the user to disable IPv6 on |
michael@0 | 55 | // a per-domain basis and work around broken DNS servers. See bug 68796. |
michael@0 | 56 | nsAdoptingCString mIPv4OnlyDomains; |
michael@0 | 57 | bool mDisableIPv6; |
michael@0 | 58 | bool mDisablePrefetch; |
michael@0 | 59 | bool mFirstTime; |
michael@0 | 60 | bool mDisableDNS; |
michael@0 | 61 | bool mOffline; |
michael@0 | 62 | bool mNotifyResolution; |
michael@0 | 63 | nsMainThreadPtrHandle<nsIObserverService> mObserverService; |
michael@0 | 64 | nsTHashtable<nsCStringHashKey> mLocalDomains; |
michael@0 | 65 | }; |
michael@0 | 66 | |
michael@0 | 67 | #endif //nsDNSService2_h__ |