Relanding Necko Changes.

Revising nsIChannel to allow for overlapped i/o. This consists of three parts:

1. Factoring nsIChannel into a protocol specific part, the nsIChannel, and a socket specific, the nsITransport.
2. Derive the nsIChannel from a nsIRequest.
2. Changes the notification system from necko and the URILoader to pass the nsIRequest interface instead of nsIChannel interface.

This goal stems from wanting to be able to have active AsyncRead and AsyncWrite operations on nsSocketTransport.
This is desired because it would greatly simplify the task of maintaining persistent/reusable socket connections
for FTP, HTTP, and Imap (and potentially other protocols). The problem with the existing nsIChannel interface is
that it does not allow one to selectively suspend just one of the read or write operations while keeping the other active.

r=darin@netscape.com
sr=rpotts@netscape.com


git-svn-id: svn://10.0.0.236/trunk@87587 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dougt%netscape.com
2001-02-21 20:38:08 +00:00
parent ab692d2668
commit 175245e2de
267 changed files with 5408 additions and 7480 deletions

View File

@@ -2062,11 +2062,11 @@ nsITokenizer* nsParser::GetTokenizer(void) {
* @return error code -- 0 if ok, non-zero if error.
*/
nsresult
nsParser::OnProgress(nsIChannel* channel, nsISupports* aContext, PRUint32 aProgress, PRUint32 aProgressMax)
nsParser::OnProgress(nsIRequest *request, nsISupports* aContext, PRUint32 aProgress, PRUint32 aProgressMax)
{
nsresult result=0;
if (nsnull != mProgressEventSink) {
mProgressEventSink->OnProgress(channel, aContext, aProgress, aProgressMax);
mProgressEventSink->OnProgress(request, aContext, aProgress, aProgressMax);
}
return result;
}
@@ -2079,12 +2079,12 @@ nsParser::OnProgress(nsIChannel* channel, nsISupports* aContext, PRUint32 aProgr
* @return error code -- 0 if ok, non-zero if error.
*/
nsresult
nsParser::OnStatus(nsIChannel* channel, nsISupports* aContext,
nsParser::OnStatus(nsIRequest *request, nsISupports* aContext,
nsresult aStatus, const PRUnichar* aStatusArg)
{
nsresult rv;
if (nsnull != mProgressEventSink) {
rv = mProgressEventSink->OnStatus(channel, aContext, aStatus, aStatusArg);
rv = mProgressEventSink->OnStatus(request, aContext, aStatus, aStatusArg);
NS_ASSERTION(NS_SUCCEEDED(rv), "dropping error result");
}
return NS_OK;
@@ -2102,19 +2102,22 @@ nsParser::OnStatus(nsIChannel* channel, nsISupports* aContext,
* @param
* @return error code -- 0 if ok, non-zero if error.
*/
nsresult nsParser::OnStartRequest(nsIChannel* channel, nsISupports* aContext) {
nsresult nsParser::OnStartRequest(nsIRequest *request, nsISupports* aContext) {
NS_PRECONDITION((eNone==mParserContext->mStreamListenerState),kBadListenerInit);
if (nsnull != mObserver) {
mObserver->OnStartRequest(channel, aContext);
mObserver->OnStartRequest(request, aContext);
}
mParserContext->mStreamListenerState=eOnStart;
mParserContext->mAutoDetectStatus=eUnknownDetect;
mParserContext->mChannel=channel;
mParserContext->mRequest=request;
mParserContext->mDTD=0;
nsresult rv;
char* contentType = nsnull;
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
NS_ASSERTION(channel, "parser needs a channel to find a dtd");
rv = channel->GetContentType(&contentType);
if (NS_SUCCEEDED(rv))
{
@@ -2310,7 +2313,7 @@ ParserWriteFunc(nsIInputStream* in,
* @return error code (usually 0)
*/
nsresult nsParser::OnDataAvailable(nsIChannel* channel, nsISupports* aContext,
nsresult nsParser::OnDataAvailable(nsIRequest *request, nsISupports* aContext,
nsIInputStream *pIStream, PRUint32 sourceOffset, PRUint32 aLength)
{
@@ -2322,12 +2325,12 @@ NS_PRECONDITION(((eOnStart==mParserContext->mStreamListenerState)||(eOnDataAvail
CParserContext *theContext=mParserContext;
while(theContext) {
if(theContext->mChannel!=channel && theContext->mPrevContext)
if(theContext->mRequest!=request && theContext->mPrevContext)
theContext=theContext->mPrevContext;
else break;
}
if(theContext && theContext->mChannel==channel) {
if(theContext && theContext->mRequest==request) {
theContext->mStreamListenerState=eOnDataAvail;
@@ -2366,7 +2369,7 @@ NS_PRECONDITION(((eOnStart==mParserContext->mStreamListenerState)||(eOnDataAvail
* @param
* @return
*/
nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
nsresult nsParser::OnStopRequest(nsIRequest *request, nsISupports* aContext,
nsresult status, const PRUnichar* aMsg)
{
@@ -2398,7 +2401,7 @@ nsresult nsParser::OnStopRequest(nsIChannel* channel, nsISupports* aContext,
// XXX Should we wait to notify our observers as well if the
// parser isn't yet enabled?
if (nsnull != mObserver) {
mObserver->OnStopRequest(channel, aContext, status, aMsg);
mObserver->OnStopRequest(request, aContext, status, aMsg);
}
#ifdef rickgdebug