Bug 1595242 - Move the offthread negotiate auth to dispatch to the background thread pool r=mayhemer

Differential Revision: https://phabricator.services.mozilla.com/D52904

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Valentin Gosu 2019-11-15 19:45:17 +00:00
Родитель 014cc496af
Коммит eb1c1972b8
2 изменённых файлов: 4 добавлений и 12 удалений

Просмотреть файл

@ -326,7 +326,7 @@ NS_IMPL_ISUPPORTS(GetNextTokenCompleteEvent, nsIRunnable, nsICancelable)
// GetNextTokenRunnable
//
// This runnable is created by GenerateCredentialsAsync and it runs
// in nsHttpNegotiateAuth::mNegotiateThread and calling GenerateCredentials.
// on the background thread pool and calls GenerateCredentials.
//
class GetNextTokenRunnable final : public mozilla::Runnable {
~GetNextTokenRunnable() override = default;
@ -436,17 +436,12 @@ nsHttpNegotiateAuth::GenerateCredentialsAsync(
nsCOMPtr<nsIRunnable> getNextTokenRunnable = new GetNextTokenRunnable(
authChannel, challenge, isProxyAuth, domain, username, password,
sessionState, continuationState, cancelEvent);
cancelEvent.forget(aCancelable);
nsresult rv;
if (!mNegotiateThread) {
mNegotiateThread = new mozilla::LazyIdleThread(
DEFAULT_THREAD_TIMEOUT_MS, NS_LITERAL_CSTRING("NegotiateAuth"));
NS_ENSURE_TRUE(mNegotiateThread, NS_ERROR_OUT_OF_MEMORY);
}
rv = mNegotiateThread->Dispatch(getNextTokenRunnable, NS_DISPATCH_NORMAL);
nsresult rv = NS_DispatchBackgroundTask(
getNextTokenRunnable, nsIEventTarget::DISPATCH_EVENT_MAY_BLOCK);
NS_ENSURE_SUCCESS(rv, rv);
cancelEvent.forget(aCancelable);
return NS_OK;
}

Просмотреть файл

@ -31,9 +31,6 @@ class nsHttpNegotiateAuth final : public nsIHttpAuthenticator {
// tests if the host part of an uri is fully qualified
bool TestNonFqdn(nsIURI* uri);
// Thread for GenerateCredentialsAsync
RefPtr<mozilla::LazyIdleThread> mNegotiateThread;
// Singleton pointer
static mozilla::StaticRefPtr<nsHttpNegotiateAuth> gSingleton;
};