Bug 1323100 - Use NS_NewNamedThread to name the proxy resolution thread. r?froydnj
MozReview-Commit-ID: Fqxr4XmvS7I
--- a/netwerk/base/nsPACMan.cpp
+++ b/netwerk/base/nsPACMan.cpp
@@ -737,33 +737,21 @@ nsPACMan::AsyncOnChannelRedirect(nsIChan
// However do track the most recent URI in the redirect change
// as mPACURIRedirectSpec so that URI can be allowed to bypass
// the proxy and actually fetch the pac file.
callback->OnRedirectVerifyCallback(NS_OK);
return NS_OK;
}
-void
-nsPACMan::NamePACThread()
-{
- MOZ_ASSERT(!NS_IsMainThread(), "wrong thread");
- PR_SetCurrentThreadName("Proxy Resolution");
-}
-
nsresult
nsPACMan::Init(nsISystemProxySettings *systemProxySettings)
{
mSystemProxySettings = systemProxySettings;
- nsresult rv = NS_NewThread(getter_AddRefs(mPACThread), nullptr);
- if (NS_FAILED(rv))
- return rv;
+ nsresult rv =
+ NS_NewNamedThread("ProxyResolution", getter_AddRefs(mPACThread));
- // don't check return value as it is not a big deal for this to fail.
- mPACThread->Dispatch(NewRunnableMethod(this, &nsPACMan::NamePACThread),
- nsIEventTarget::DISPATCH_NORMAL);
-
- return NS_OK;
+ return rv;
}
} // namespace net
} // namespace mozilla
--- a/netwerk/base/nsPACMan.h
+++ b/netwerk/base/nsPACMan.h
@@ -209,17 +209,16 @@ private:
* execute the queue if it was otherwise empty
*/
nsresult PostQuery(PendingPACQuery *query);
// PAC thread operations only
void PostProcessPendingQ();
void PostCancelPendingQ(nsresult);
bool ProcessPending();
- void NamePACThread();
private:
ProxyAutoConfig mPAC;
nsCOMPtr<nsIThread> mPACThread;
nsCOMPtr<nsISystemProxySettings> mSystemProxySettings;
LinkedList<PendingPACQuery> mPendingQ; /* pac thread only */