Bug 1448034 - Part 1: Get rid of SysProxySetting threads. r=bagder
authorEric Rahm <erahm@mozilla.com>
Tue, 10 Jul 2018 18:02:21 -0700
changeset 427023 bdba0cfc639e6bf4a2a8a7a9297d0cfa80fa04a6
parent 427022 06aa3087bced7348e14059dea0f676ec84faf8ca
child 427024 9893cdaed08b246de7c488ca3209b6b2a4b6661e
push id34291
push userebalazs@mozilla.com
push dateWed, 18 Jul 2018 09:33:54 +0000
treeherdermozilla-central@8dab948a10f0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbagder
bugs1448034
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1448034 - Part 1: Get rid of SysProxySetting threads. r=bagder
netwerk/base/nsProtocolProxyService.cpp
netwerk/base/nsProtocolProxyService.h
--- a/netwerk/base/nsProtocolProxyService.cpp
+++ b/netwerk/base/nsProtocolProxyService.cpp
@@ -834,17 +834,17 @@ nsProtocolProxyService::~nsProtocolProxy
     NS_ASSERTION(mHostFiltersArray.Length() == 0 && mFilters.Length() == 0 &&
                  mPACMan == nullptr, "what happened to xpcom-shutdown?");
 }
 
 // nsProtocolProxyService methods
 nsresult
 nsProtocolProxyService::Init()
 {
-    NS_NewNamedThread("SysProxySetting", getter_AddRefs(mProxySettingThread));
+    mProxySettingTarget = do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
 
     // failure to access prefs is non-fatal
     nsCOMPtr<nsIPrefBranch> prefBranch =
             do_GetService(NS_PREFSERVICE_CONTRACTID);
     if (prefBranch) {
         // monitor proxy prefs
         prefBranch->AddObserver(PROXY_PREF_BRANCH, this, false);
 
@@ -928,20 +928,20 @@ nsProtocolProxyService::AsyncConfigureFr
                                   mainThreadOnly,
                                   aForceReload,
                                   aResetPACThread);
 
     if (mainThreadOnly) {
         return req->Run();
     }
 
-    if (NS_WARN_IF(!mProxySettingThread)) {
+    if (NS_WARN_IF(!mProxySettingTarget)) {
         return NS_ERROR_NOT_INITIALIZED;
     }
-    return mProxySettingThread->Dispatch(req, nsIEventTarget::DISPATCH_NORMAL);
+    return mProxySettingTarget->Dispatch(req, nsIEventTarget::DISPATCH_NORMAL);
 }
 
 nsresult
 nsProtocolProxyService::OnAsyncGetPACURI(bool aForceReload,
                                          bool aResetPACThread,
                                          nsresult aResult,
                                          const nsACString& aUri)
 {
@@ -969,19 +969,18 @@ nsProtocolProxyService::Observe(nsISuppo
         mHostFiltersArray.Clear();
         mFilters.Clear();
 
         if (mPACMan) {
             mPACMan->Shutdown();
             mPACMan = nullptr;
         }
 
-        if (mProxySettingThread) {
-            mProxySettingThread->Shutdown();
-            mProxySettingThread = nullptr;
+        if (mProxySettingTarget) {
+            mProxySettingTarget = nullptr;
         }
 
         nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
         if (obs) {
             obs->RemoveObserver(this, NS_NETWORK_LINK_TOPIC);
             obs->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
         }
 
--- a/netwerk/base/nsProtocolProxyService.h
+++ b/netwerk/base/nsProtocolProxyService.h
@@ -411,17 +411,17 @@ protected:
 
 private:
     nsresult AsyncResolveInternal(nsIChannel *channel, uint32_t flags,
                                   nsIProtocolProxyCallback *callback,
                                   nsICancelable **result,
                                   bool isSyncOK,
                                   nsIEventTarget *mainThreadEventTarget);
     bool                          mIsShutdown;
-    nsCOMPtr<nsIThread>           mProxySettingThread;
+    nsCOMPtr<nsIEventTarget> mProxySettingTarget;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsProtocolProxyService, NS_PROTOCOL_PROXY_SERVICE_IMPL_CID)
 
 } // namespace net
 } // namespace mozilla
 
 #endif // !nsProtocolProxyService_h__
\ No newline at end of file