Skip to content

Commit

Permalink
Bug 1448034 - Part 1: Get rid of SysProxySetting threads. r=bagder
Browse files Browse the repository at this point in the history
  • Loading branch information
EricRahm committed Jul 11, 2018
1 parent f054527 commit 8d16acd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 5 additions & 6 deletions netwerk/base/nsProtocolProxyService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@ nsProtocolProxyService::~nsProtocolProxyService()
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 =
Expand Down Expand Up @@ -933,10 +933,10 @@ nsProtocolProxyService::AsyncConfigureFromPAC(bool aForceReload,
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
Expand Down Expand Up @@ -974,9 +974,8 @@ nsProtocolProxyService::Observe(nsISupports *aSubject,
mPACMan = nullptr;
}

if (mProxySettingThread) {
mProxySettingThread->Shutdown();
mProxySettingThread = nullptr;
if (mProxySettingTarget) {
mProxySettingTarget = nullptr;
}

nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
Expand Down
2 changes: 1 addition & 1 deletion netwerk/base/nsProtocolProxyService.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ class nsProtocolProxyService final : public nsIProtocolProxyService2
bool isSyncOK,
nsIEventTarget *mainThreadEventTarget);
bool mIsShutdown;
nsCOMPtr<nsIThread> mProxySettingThread;
nsCOMPtr<nsIEventTarget> mProxySettingTarget;
};

NS_DEFINE_STATIC_IID_ACCESSOR(nsProtocolProxyService, NS_PROTOCOL_PROXY_SERVICE_IMPL_CID)
Expand Down

0 comments on commit 8d16acd

Please sign in to comment.