Back out caa97320d506 (bug 658580) temporarily to get m-i in a known good state. a=backout

This commit is contained in:
Matt Brubeck 2011-06-15 09:40:29 -07:00
parent 7c14d57369
commit 3a92543b49

View File

@ -593,6 +593,19 @@ NS_IMETHODIMP
nsSocketTransportService::OnProcessNextEvent(nsIThreadInternal *thread,
PRBool mayWait, PRUint32 depth)
{
// DoPollIteration doesn't support being called recursively. This case
// should only happen when someone (e.g., PSM) is issuing a synchronous
// proxy call from this thread to the main thread.
if (depth > 1)
return NS_OK;
// Favor processing existing sockets before other events.
DoPollIteration(PR_FALSE);
PRBool val;
while (mayWait && NS_SUCCEEDED(thread->HasPendingEvents(&val)) && !val)
DoPollIteration(PR_TRUE);
return NS_OK;
}
@ -622,24 +635,8 @@ nsSocketTransportService::Run()
threadInt->SetObserver(this);
for (;;) {
PRBool pendingEvents = PR_FALSE;
thread->HasPendingEvents(&pendingEvents);
do {
// If there are pending events for this thread then
// DoPollIteration() should service the network without blocking.
DoPollIteration(!pendingEvents);
// If nothing was pending before the poll, it might be now
if (!pendingEvents)
thread->HasPendingEvents(&pendingEvents);
if (pendingEvents) {
NS_ProcessNextEvent(thread);
pendingEvents = PR_FALSE;
thread->HasPendingEvents(&pendingEvents);
}
} while (pendingEvents);
// process all pending events
NS_ProcessPendingEvents(thread);
// now that our event queue is empty, check to see if we should exit
{
@ -647,6 +644,9 @@ nsSocketTransportService::Run()
if (mShuttingDown)
break;
}
// wait for and process the next pending event
NS_ProcessNextEvent(thread);
}
SOCKET_LOG(("STS shutting down thread\n"));