diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /netwerk/dns/nsHostResolver.cpp | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | netwerk/dns/nsHostResolver.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/netwerk/dns/nsHostResolver.cpp b/netwerk/dns/nsHostResolver.cpp index ccd6dca57b..ad28cbb284 100644 --- a/netwerk/dns/nsHostResolver.cpp +++ b/netwerk/dns/nsHostResolver.cpp @@ -3,6 +3,7 @@ * 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/. */ +#include "nsIThreadPool.h" #if defined(HAVE_RES_NINIT) # include <sys/types.h> # include <netinet/in.h> @@ -137,6 +138,24 @@ class nsResState { #endif // RES_RETRY_ON_FAILURE +class DnsThreadListener final : public nsIThreadPoolListener { + NS_DECL_THREADSAFE_ISUPPORTS + NS_DECL_NSITHREADPOOLLISTENER + private: + virtual ~DnsThreadListener() = default; +}; + +NS_IMETHODIMP +DnsThreadListener::OnThreadCreated() { return NS_OK; } + +NS_IMETHODIMP +DnsThreadListener::OnThreadShuttingDown() { + DNSThreadShutdown(); + return NS_OK; +} + +NS_IMPL_ISUPPORTS(DnsThreadListener, nsIThreadPoolListener) + //---------------------------------------------------------------------------- static const char kPrefGetTtl[] = "network.dns.get-ttl"; @@ -252,6 +271,8 @@ nsresult nsHostResolver::Init() MOZ_NO_THREAD_SAFETY_ANALYSIS { MOZ_ALWAYS_SUCCEEDS( threadPool->SetThreadStackSize(nsIThreadManager::kThreadPoolStackSize)); MOZ_ALWAYS_SUCCEEDS(threadPool->SetName("DNS Resolver"_ns)); + nsCOMPtr<nsIThreadPoolListener> listener = new DnsThreadListener(); + threadPool->SetListener(listener); mResolverThreads = ToRefPtr(std::move(threadPool)); return NS_OK; |