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

@@ -157,14 +157,14 @@ public:
virtual ~PluginViewerImpl();
nsresult CreatePlugin(nsIPluginHost* aHost, const nsRect& aBounds,
nsresult CreatePlugin(nsIRequest* request, nsIPluginHost* aHost, const nsRect& aBounds,
nsIStreamListener*& aResult);
nsresult MakeWindow(nsNativeWidget aParent,
nsIDeviceContext* aDeviceContext,
const nsRect& aBounds);
nsresult StartLoad(nsIChannel* channel, nsIStreamListener*& aResult);
nsresult StartLoad(nsIRequest* request, nsIStreamListener*& aResult);
void ForceRefresh(void);
@@ -307,15 +307,18 @@ PluginViewerImpl::Init(nsIWidget* aParentWidget,
}
nsresult
PluginViewerImpl::StartLoad(nsIChannel* channel, nsIStreamListener*& aResult)
PluginViewerImpl::StartLoad(nsIRequest* request, nsIStreamListener*& aResult)
{
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
if (!channel) return NS_ERROR_FAILURE;
NS_IF_RELEASE(mChannel);
mChannel = channel;
NS_ADDREF(mChannel);
#ifdef DEBUG
char* contentType;
mChannel->GetContentType(&contentType);
channel->GetContentType(&contentType);
printf("PluginViewerImpl::StartLoad: content-type=%s\n", contentType);
nsCRT::free(contentType);
#endif
@@ -331,14 +334,14 @@ PluginViewerImpl::StartLoad(nsIChannel* channel, nsIStreamListener*& aResult)
{
nsRect r;
mWindow->GetClientBounds(r);
rv = CreatePlugin(host, nsRect(0, 0, r.width, r.height), aResult);
rv = CreatePlugin(request, host, nsRect(0, 0, r.width, r.height), aResult);
}
return rv;
}
nsresult
PluginViewerImpl::CreatePlugin(nsIPluginHost* aHost, const nsRect& aBounds,
PluginViewerImpl::CreatePlugin(nsIRequest* request, nsIPluginHost* aHost, const nsRect& aBounds,
nsIStreamListener*& aResult)
{
nsresult rv = NS_OK;
@@ -372,7 +375,9 @@ PluginViewerImpl::CreatePlugin(nsIPluginHost* aHost, const nsRect& aBounds,
nsCRT::free(spec);
char* ct;
rv = mChannel->GetContentType(&ct);
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
channel->GetContentType(&ct);
if (NS_FAILED(rv)) return rv;
rv = aHost->InstantiateFullPagePlugin(ct, str, aResult, mOwner);
delete[] ct;
@@ -692,43 +697,45 @@ PluginListener::~PluginListener()
NS_IMPL_ISUPPORTS(PluginListener, kIStreamListenerIID)
NS_IMETHODIMP
PluginListener::OnStartRequest(nsIChannel* channel, nsISupports *ctxt)
PluginListener::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
nsresult rv;
char* contentType = nsnull;
nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);
rv = channel->GetContentType(&contentType);
if (NS_FAILED(rv)) {
return rv;
}
rv = mViewer->StartLoad(channel, mNextStream);
rv = mViewer->StartLoad(request, mNextStream);
if (NS_FAILED(rv)) {
return rv;
}
if (nsnull == mNextStream)
return NS_ERROR_FAILURE;
return mNextStream->OnStartRequest(channel, ctxt);
return mNextStream->OnStartRequest(request, ctxt);
}
NS_IMETHODIMP
PluginListener::OnStopRequest(nsIChannel* channel, nsISupports *ctxt,
PluginListener::OnStopRequest(nsIRequest *request, nsISupports *ctxt,
nsresult status, const PRUnichar *errorMsg)
{
if (nsnull == mNextStream) {
return NS_ERROR_FAILURE;
}
return mNextStream->OnStopRequest(channel, ctxt, status, errorMsg);
return mNextStream->OnStopRequest(request, ctxt, status, errorMsg);
}
NS_IMETHODIMP
PluginListener::OnDataAvailable(nsIChannel* channel, nsISupports *ctxt,
PluginListener::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
{
if (nsnull == mNextStream) {
return NS_ERROR_FAILURE;
}
return mNextStream->OnDataAvailable(channel, ctxt, inStr, sourceOffset, count);
return mNextStream->OnDataAvailable(request, ctxt, inStr, sourceOffset, count);
}
//----------------------------------------------------------------------