bug 1215270 - remove some unused functions from nsNSSShutDown.h r=Cykesiopka

nsNSSShutDownList::isUIActive() and areSSLSocketsActive() should probably have
been removed as part of bug 807757.
This commit is contained in:
David Keeler 2015-10-15 13:22:13 -07:00
parent f7c6589364
commit 3c1a47a734
3 changed files with 10 additions and 73 deletions

View File

@ -930,8 +930,6 @@ PRStatus
nsNSSSocketInfo::CloseSocketAndDestroy(
const nsNSSShutDownPreventionLock& /*proofOfLock*/)
{
nsNSSShutDownList::trackSSLSocketClose();
PRFileDesc* popped = PR_PopIOLayer(mFd, PR_TOP_IO_LAYER);
NS_ASSERTION(popped &&
popped->identity == nsSSLIOLayerHelpers::nsSSLIOLayerIdentity,
@ -2714,8 +2712,6 @@ nsSSLIOLayerAddToSocket(int32_t family,
goto loser;
}
nsNSSShutDownList::trackSSLSocketCreate();
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] Socket set up\n", (void*) sslSock));
infoObject->QueryInterface(NS_GET_IID(nsISupports), (void**) (info));

View File

@ -40,7 +40,6 @@ nsNSSShutDownList *nsNSSShutDownList::singleton = nullptr;
nsNSSShutDownList::nsNSSShutDownList()
: mListLock("nsNSSShutDownList.mListLock")
, mActiveSSLSockets(0)
, mObjects(&gSetOps, sizeof(ObjectHashEntry))
, mPK11LogoutCancelObjects(&gSetOps, sizeof(ObjectHashEntry))
{
@ -92,38 +91,6 @@ void nsNSSShutDownList::forget(nsOnPK11LogoutCancelObject *o)
singleton->mPK11LogoutCancelObjects.Remove(o);
}
void nsNSSShutDownList::trackSSLSocketCreate()
{
if (!singleton)
return;
MutexAutoLock lock(singleton->mListLock);
++singleton->mActiveSSLSockets;
}
void nsNSSShutDownList::trackSSLSocketClose()
{
if (!singleton)
return;
MutexAutoLock lock(singleton->mListLock);
--singleton->mActiveSSLSockets;
}
bool nsNSSShutDownList::areSSLSocketsActive()
{
if (!singleton) {
// I'd rather prefer to be pessimistic and return true.
// However, maybe we will get called at a time when the singleton
// has already been freed, and returning true would bring up an
// unnecessary warning.
return false;
}
MutexAutoLock lock(singleton->mListLock);
return (singleton->mActiveSSLSockets > 0);
}
nsresult nsNSSShutDownList::doPK11Logout()
{
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("canceling all open SSL sockets to disallow future IO\n"));
@ -145,16 +112,9 @@ nsresult nsNSSShutDownList::doPK11Logout()
return NS_OK;
}
bool nsNSSShutDownList::isUIActive()
{
bool canDisallow = mActivityState.ifPossibleDisallowUI(nsNSSActivityState::test_only);
bool bIsUIActive = !canDisallow;
return bIsUIActive;
}
bool nsNSSShutDownList::ifPossibleDisallowUI()
{
bool isNowDisallowed = mActivityState.ifPossibleDisallowUI(nsNSSActivityState::do_it_for_real);
bool isNowDisallowed = mActivityState.ifPossibleDisallowUI();
return isNowDisallowed;
}
@ -265,7 +225,7 @@ bool nsNSSActivityState::isUIForbidden()
return mIsUIForbidden;
}
bool nsNSSActivityState::ifPossibleDisallowUI(RealOrTesting rot)
bool nsNSSActivityState::ifPossibleDisallowUI()
{
bool retval = false;
MutexAutoLock lock(mNSSActivityStateLock);
@ -275,16 +235,10 @@ bool nsNSSActivityState::ifPossibleDisallowUI(RealOrTesting rot)
if (!mBlockingUICounter) {
// No UI is currently shown, we are able to evaporate.
retval = true;
if (rot == do_it_for_real) {
// Remember to disallow UI.
mIsUIForbidden = true;
// to clear the "forbidden" state,
// one must either call
// restrictActivityToCurrentThread() + releaseCurrentThreadActivityRestriction()
// or cancel the operation by calling
// unprepareCurrentThreadRestriction()
}
// Remember to disallow UI.
// To clear the "forbidden" state, call restrictActivityToCurrentThread()
// and releaseCurrentThreadActivityRestriction().
mIsUIForbidden = true;
}
return retval;
}

View File

@ -37,12 +37,10 @@ public:
// Is it forbidden to bring up an UI while holding resources?
bool isUIForbidden();
// Check whether setting the current thread restriction is possible.
// If it is possible, and the "do_it_for_real" flag is used,
// the state tracking will have ensured that we will stay in this state.
// As of writing, this includes forbidding PSM UI.
enum RealOrTesting {test_only, do_it_for_real};
bool ifPossibleDisallowUI(RealOrTesting rot);
// Check whether setting the current thread restriction is possible. If it
// is possible, the state tracking will have ensured that we will stay in
// this state. As of writing, this includes forbidding PSM UI.
bool ifPossibleDisallowUI();
// Notify the state tracking that going to the restricted state is
// no longer planned.
@ -116,16 +114,6 @@ public:
static void remember(nsOnPK11LogoutCancelObject *o);
static void forget(nsOnPK11LogoutCancelObject *o);
// track the creation and destruction of SSL sockets
// performed by clients using PSM services
static void trackSSLSocketCreate();
static void trackSSLSocketClose();
static bool areSSLSocketsActive();
// Are we able to do the early cleanup?
// Returns failure if at the current time "early cleanup" is not possible.
bool isUIActive();
// If possible to do "early cleanup" at the current time, remember that we want to
// do it, and disallow actions that would change the possibility.
bool ifPossibleDisallowUI();
@ -151,7 +139,6 @@ private:
protected:
mozilla::Mutex mListLock;
static nsNSSShutDownList *singleton;
uint32_t mActiveSSLSockets;
PLDHashTable mObjects;
PLDHashTable mPK11LogoutCancelObjects;
nsNSSActivityState mActivityState;