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. The full details of the change on written up in the netlib newsgroup. r=darin@netscape.com sr=rpotts@netscape.com
This commit is contained in:
@@ -2751,7 +2751,7 @@ NS_IMETHODIMP nsDocShell::CreateAboutBlankContentViewer()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType,
|
||||
nsIChannel* aOpenedChannel, nsIStreamListener** aContentHandler)
|
||||
nsIRequest *request, nsIStreamListener** aContentHandler)
|
||||
{
|
||||
// Can we check the content type of the current content viewer
|
||||
// and reuse it without destroying it and re-creating it?
|
||||
@@ -2761,12 +2761,17 @@ NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType,
|
||||
|
||||
// Instantiate the content viewer object
|
||||
nsCOMPtr<nsIContentViewer> viewer;
|
||||
if(NS_FAILED(NewContentViewerObj(aContentType, aOpenedChannel, loadGroup,
|
||||
aContentHandler, getter_AddRefs(viewer))))
|
||||
nsresult rv = NewContentViewerObj(aContentType, request, loadGroup,
|
||||
aContentHandler, getter_AddRefs(viewer));
|
||||
|
||||
if(NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// we've created a new document so go ahead and call OnLoadingSite
|
||||
mURIResultedInDocument = PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsIChannel> aOpenedChannel = do_QueryInterface(request);
|
||||
|
||||
OnLoadingSite(aOpenedChannel);
|
||||
|
||||
// let's try resetting the load group if we need to...
|
||||
@@ -2797,9 +2802,9 @@ NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType,
|
||||
|
||||
aOpenedChannel->SetLoadAttributes(loadAttribs);
|
||||
|
||||
loadGroup->AddChannel(aOpenedChannel, nsnull);
|
||||
loadGroup->AddRequest(request, nsnull);
|
||||
if(currentLoadGroup)
|
||||
currentLoadGroup->RemoveChannel(aOpenedChannel, nsnull, nsnull, nsnull);
|
||||
currentLoadGroup->RemoveRequest(request, nsnull, nsnull, nsnull);
|
||||
|
||||
}
|
||||
#ifdef SH_IN_FRAMES
|
||||
@@ -2813,7 +2818,7 @@ NS_IMETHODIMP nsDocShell::CreateContentViewer(const char* aContentType,
|
||||
}
|
||||
|
||||
nsresult nsDocShell::NewContentViewerObj(const char* aContentType,
|
||||
nsIChannel* aOpenedChannel, nsILoadGroup* aLoadGroup,
|
||||
nsIRequest *request, nsILoadGroup* aLoadGroup,
|
||||
nsIStreamListener** aContentHandler, nsIContentViewer** aViewer)
|
||||
{
|
||||
//XXX This should probably be some category thing....
|
||||
@@ -2840,6 +2845,8 @@ nsresult nsDocShell::NewContentViewerObj(const char* aContentType,
|
||||
if(!docLoaderFactory)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> aOpenedChannel = do_QueryInterface(request);
|
||||
|
||||
// Now create an instance of the content viewer
|
||||
NS_ENSURE_SUCCESS(docLoaderFactory->CreateInstance(
|
||||
|
||||
Reference in New Issue
Block a user