2013-12-11 23:03:51 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* vim: set sw=4 ts=8 et tw=80 : */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2003-09-12 00:32:33 +04:00
|
|
|
|
2012-08-29 04:24:06 +04:00
|
|
|
#ifndef nsDNSService2_h__
|
|
|
|
#define nsDNSService2_h__
|
|
|
|
|
2005-04-06 05:33:28 +04:00
|
|
|
#include "nsPIDNSService.h"
|
2003-09-12 00:32:33 +04:00
|
|
|
#include "nsIIDNService.h"
|
2013-11-07 09:35:30 +04:00
|
|
|
#include "nsIMemoryReporter.h"
|
2003-09-12 00:32:33 +04:00
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsHostResolver.h"
|
|
|
|
#include "nsAutoPtr.h"
|
2004-03-09 23:31:54 +03:00
|
|
|
#include "nsString.h"
|
2012-05-11 23:59:19 +04:00
|
|
|
#include "nsTHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
Rollup of bug 645263 and bug 646259: Switch to mozilla:: sync primitives. r=cjones,dbaron,doublec,ehsan src=bsmedberg
Bug 645263, part 0: Count sync primitive ctor/dtors. r=dbaron
Bug 645263, part 1: Migrate content/media to mozilla:: sync primitives. r=doublec
Bug 645263, part 2: Migrate modules/plugin to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 3: Migrate nsComponentManagerImpl to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 4: Migrate everything else to mozilla:: sync primitives. r=dbaron
Bug 645263, part 5: Remove nsAutoLock.*. sr=bsmedberg
Bug 645263, part 6: Make editor test be nicer to deadlock detector. r=ehsan
Bug 645263, part 7: Disable tracemalloc backtraces for xpcshell tests. r=dbaron
Bug 646259: Fix nsCacheService to use a CondVar for notifying. r=cjones
2011-04-01 08:29:02 +04:00
|
|
|
#include "mozilla/Mutex.h"
|
2012-06-06 07:18:25 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2003-09-12 00:32:33 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsDNSService final : public nsPIDNSService
|
2015-03-27 21:52:19 +03:00
|
|
|
, public nsIObserver
|
|
|
|
, public nsIMemoryReporter
|
2003-09-12 00:32:33 +04:00
|
|
|
{
|
|
|
|
public:
|
2013-07-19 06:24:13 +04:00
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2005-04-06 05:33:28 +04:00
|
|
|
NS_DECL_NSPIDNSSERVICE
|
2003-09-12 00:32:33 +04:00
|
|
|
NS_DECL_NSIDNSSERVICE
|
|
|
|
NS_DECL_NSIOBSERVER
|
2013-12-08 10:09:10 +04:00
|
|
|
NS_DECL_NSIMEMORYREPORTER
|
2003-09-12 00:32:33 +04:00
|
|
|
|
|
|
|
nsDNSService();
|
|
|
|
|
2013-12-11 23:03:51 +04:00
|
|
|
static nsIDNSService* GetXPCOMSingleton();
|
|
|
|
|
2013-11-25 03:24:12 +04:00
|
|
|
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
|
|
|
|
2003-09-12 00:32:33 +04:00
|
|
|
private:
|
2014-06-24 20:36:44 +04:00
|
|
|
~nsDNSService();
|
|
|
|
|
2013-12-11 23:03:51 +04:00
|
|
|
static nsDNSService* GetSingleton();
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint16_t GetAFForLookup(const nsACString &host, uint32_t flags);
|
2004-03-09 23:31:54 +03:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsHostResolver> mResolver;
|
2003-09-12 00:32:33 +04:00
|
|
|
nsCOMPtr<nsIIDNService> mIDN;
|
2004-03-09 23:31:54 +03:00
|
|
|
|
|
|
|
// mLock protects access to mResolver and mIPv4OnlyDomains
|
Rollup of bug 645263 and bug 646259: Switch to mozilla:: sync primitives. r=cjones,dbaron,doublec,ehsan src=bsmedberg
Bug 645263, part 0: Count sync primitive ctor/dtors. r=dbaron
Bug 645263, part 1: Migrate content/media to mozilla:: sync primitives. r=doublec
Bug 645263, part 2: Migrate modules/plugin to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 3: Migrate nsComponentManagerImpl to mozilla:: sync primitives. sr=bsmedberg
Bug 645263, part 4: Migrate everything else to mozilla:: sync primitives. r=dbaron
Bug 645263, part 5: Remove nsAutoLock.*. sr=bsmedberg
Bug 645263, part 6: Make editor test be nicer to deadlock detector. r=ehsan
Bug 645263, part 7: Disable tracemalloc backtraces for xpcshell tests. r=dbaron
Bug 646259: Fix nsCacheService to use a CondVar for notifying. r=cjones
2011-04-01 08:29:02 +04:00
|
|
|
mozilla::Mutex mLock;
|
2003-09-12 00:32:33 +04:00
|
|
|
|
2004-03-09 23:31:54 +03:00
|
|
|
// mIPv4OnlyDomains is a comma-separated list of domains for which only
|
|
|
|
// IPv4 DNS lookups are performed. This allows the user to disable IPv6 on
|
|
|
|
// a per-domain basis and work around broken DNS servers. See bug 68796.
|
2014-04-16 00:13:00 +04:00
|
|
|
nsAdoptingCString mIPv4OnlyDomains;
|
|
|
|
bool mDisableIPv6;
|
|
|
|
bool mDisablePrefetch;
|
|
|
|
bool mFirstTime;
|
|
|
|
bool mOffline;
|
|
|
|
bool mNotifyResolution;
|
2015-02-25 22:02:38 +03:00
|
|
|
bool mOfflineLocalhost;
|
2014-04-16 00:13:00 +04:00
|
|
|
nsTHashtable<nsCStringHashKey> mLocalDomains;
|
2003-09-12 00:32:33 +04:00
|
|
|
};
|
2012-08-29 04:24:06 +04:00
|
|
|
|
|
|
|
#endif //nsDNSService2_h__
|