remove the imap channel from the load group when finished running r=mscott

This commit is contained in:
bienvenu%netscape.com 1999-11-02 23:22:29 +00:00
Родитель 0634b6ed95
Коммит 10a209dd10
7 изменённых файлов: 52 добавлений и 13 удалений

Просмотреть файл

@ -55,4 +55,5 @@ interface nsIImapMockChannel : nsIChannel
void SetLoadGroup(in nsILoadGroup aLoadGroup);
void SetURI(in nsIURI aUrl);
void Close();
attribute boolean cancelled;
};

Просмотреть файл

@ -185,6 +185,7 @@ public:
NS_IMETHOD SetMockChannel(nsIImapMockChannel * aChannel) = 0;
NS_IMETHOD AddChannelToLoadGroup() = 0;
NS_IMETHOD RemoveChannel(nsresult status) = 0;
};
#endif /* nsIImapUrl_h___ */

Просмотреть файл

@ -458,7 +458,7 @@ nsImapMailFolder::UpdateFolder(nsIMsgWindow *msgWindow)
if (NS_SUCCEEDED(rv) && pEventQService)
pEventQService->GetThreadEventQueue(PR_GetCurrentThread(),
getter_AddRefs(eventQ));
rv = imapService->SelectFolder(eventQ, this, this, nsnull, nsnull);
rv = imapService->SelectFolder(eventQ, this, this, msgWindow, nsnull);
m_urlRunning = PR_TRUE;
}
return rv;

Просмотреть файл

@ -1060,6 +1060,11 @@ PRBool nsImapProtocol::ProcessCurrentURL()
WaitForFEEventCompletion();
}
// probably the wrong place to remove the channel - we need
// a place where we know we're finished with the url.
if (m_runningUrl)
m_runningUrl->RemoveChannel(NS_OK);
// release this by hand so that we can load the next queued url without thinking
// this connection is busy running a url.
m_runningUrl = null_nsCOMPtr();
@ -3341,11 +3346,16 @@ PRMonitor *nsImapProtocol::GetDataMemberMonitor()
// in 4.5 - we need to think about this some. Some of it may just go away in the new world order
PRBool nsImapProtocol::DeathSignalReceived()
{
PRBool returnValue;
PR_EnterMonitor(m_threadDeathMonitor);
returnValue = m_threadShouldDie;
PR_ExitMonitor(m_threadDeathMonitor);
PRBool returnValue = PR_FALSE;
if (m_mockChannel)
m_mockChannel->GetCancelled(&returnValue);
if (!returnValue) // check the other way of cancelling.
{
PR_EnterMonitor(m_threadDeathMonitor);
returnValue = m_threadShouldDie;
PR_ExitMonitor(m_threadDeathMonitor);
}
return returnValue;
}
@ -6149,6 +6159,7 @@ nsImapMockChannel::nsImapMockChannel()
{
NS_INIT_REFCNT();
m_channelContext = nsnull;
m_cancelled = PR_FALSE;
}
nsImapMockChannel::~nsImapMockChannel()
@ -6323,13 +6334,8 @@ NS_IMETHODIMP nsImapMockChannel::IsPending(PRBool *result)
NS_IMETHODIMP nsImapMockChannel::Cancel()
{
if (m_channelContext)
{
nsCOMPtr<nsIImapProtocol> protocol = do_QueryInterface(m_channelContext);
if (protocol)
protocol->TellThreadToDie(PR_TRUE);
}
return NS_ERROR_NOT_IMPLEMENTED;
m_cancelled = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP nsImapMockChannel::Suspend()
@ -6341,3 +6347,17 @@ NS_IMETHODIMP nsImapMockChannel::Resume()
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsImapMockChannel::GetCancelled(PRBool *aResult)
{
if (!aResult)
return NS_ERROR_NULL_POINTER;
*aResult = m_cancelled;
return NS_OK;
}
NS_IMETHODIMP nsImapMockChannel::SetCancelled(PRBool cancelled)
{
m_cancelled = cancelled;
return NS_OK;
}

Просмотреть файл

@ -559,6 +559,7 @@ protected:
// non owning ref of the context in order to fix a circular ref count
// because the context is already the uri...
nsISupports * m_channelContext;
PRBool m_cancelled;
};
#endif // nsImapProtocol_h___

Просмотреть файл

@ -81,6 +81,7 @@ nsImapUrl::~nsImapUrl()
PR_FREEIF(m_listOfMessageIds);
PR_FREEIF(m_destinationCanonicalFolderPathSubString);
PR_FREEIF(m_sourceCanonicalFolderPathSubString);
}
NS_IMPL_ADDREF_INHERITED(nsImapUrl, nsMsgMailNewsUrl)
@ -946,6 +947,20 @@ NS_IMETHODIMP nsImapUrl::AddChannelToLoadGroup()
return NS_OK;
}
NS_IMETHODIMP nsImapUrl::RemoveChannel(nsresult status)
{
nsCOMPtr <nsILoadGroup> aLoadGroup;
if (m_mockChannel)
{
GetLoadGroup(getter_AddRefs(aLoadGroup));
if (aLoadGroup)
{
aLoadGroup->RemoveChannel(m_mockChannel, nsnull, status, nsnull);
}
}
return NS_OK;
}
NS_IMETHODIMP nsImapUrl::GetAllowContentChange(PRBool *result)
{
if (!result)

Просмотреть файл

@ -95,6 +95,7 @@ public:
NS_IMETHOD SetMockChannel(nsIImapMockChannel * aChannel);
NS_IMETHOD AddChannelToLoadGroup();
NS_IMETHOD RemoveChannel(nsresult status);
// nsIMsgMessageUrl
NS_DECL_NSIMSGMESSAGEURL