From a028e2115d443d85a39f8de20196f2429d66df86 Mon Sep 17 00:00:00 2001 From: "ruslan%netscape.com" Date: Thu, 20 Jul 2000 21:25:19 +0000 Subject: [PATCH] FInally fix 42283; a=gagan,r=gordon --- .../protocol/http/public/nsIHTTPChannel.idl | 6 +++++ netwerk/protocol/http/src/nsHTTPChannel.cpp | 27 ++++++++++++++++++- netwerk/protocol/http/src/nsHTTPChannel.h | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/netwerk/protocol/http/public/nsIHTTPChannel.idl b/netwerk/protocol/http/public/nsIHTTPChannel.idl index 78894bf45f5..e71b916a3e3 100644 --- a/netwerk/protocol/http/public/nsIHTTPChannel.idl +++ b/netwerk/protocol/http/public/nsIHTTPChannel.idl @@ -112,6 +112,12 @@ interface nsIHTTPChannel : nsIChannel to allow other non-http specs to be used in proxy cases. */ attribute string proxyRequestURI; + + /** + * This is a kludge which tells the channel to create a separate thread with the + * even queue for OpenInputStream or not + */ + attribute boolean openInputStreamHasEventQueue; }; diff --git a/netwerk/protocol/http/src/nsHTTPChannel.cpp b/netwerk/protocol/http/src/nsHTTPChannel.cpp index 0eb9c16ab61..82cdc6da08f 100644 --- a/netwerk/protocol/http/src/nsHTTPChannel.cpp +++ b/netwerk/protocol/http/src/nsHTTPChannel.cpp @@ -102,7 +102,8 @@ nsHTTPChannel::nsHTTPChannel(nsIURI* i_URL, nsHTTPHandler* i_Handler): mPipeliningAllowed (PR_TRUE), mPipelinedRequest (nsnull), mApplyConversion(PR_TRUE), - mNotificationProxiesBuilt (PR_FALSE) + mNotificationProxiesBuilt (PR_FALSE), + mOpenInputStreamHasEventQueue (PR_TRUE) { NS_INIT_REFCNT(); NS_NewISupportsArray ( getter_AddRefs (mStreamAsFileObserverArray ) ); @@ -237,6 +238,24 @@ nsHTTPChannel::SetURI(nsIURI* o_URL) return NS_OK; } +NS_IMETHODIMP +nsHTTPChannel::GetOpenInputStreamHasEventQueue (PRBool * hasEventQueue) +{ + if (!hasEventQueue) + return NS_ERROR_NULL_POINTER; + + *hasEventQueue = mOpenInputStreamHasEventQueue; + return NS_OK; +} + +NS_IMETHODIMP +nsHTTPChannel::SetOpenInputStreamHasEventQueue (PRBool hasEventQueue) +{ + + mOpenInputStreamHasEventQueue = hasEventQueue; + return NS_OK; +} + NS_IMETHODIMP nsHTTPChannel::OpenInputStream(nsIInputStream **o_Stream) { @@ -252,6 +271,12 @@ nsHTTPChannel::OpenInputStream(nsIInputStream **o_Stream) if (NS_FAILED(rv)) return rv; + if (mOpenInputStreamHasEventQueue) + { + rv = AsyncRead (listener, nsnull); + return rv; + } + nsSyncHelper *helper = new nsSyncHelper (); if (!helper) return NS_ERROR_OUT_OF_MEMORY; diff --git a/netwerk/protocol/http/src/nsHTTPChannel.h b/netwerk/protocol/http/src/nsHTTPChannel.h index 5c688ea2ca3..11163c608ee 100644 --- a/netwerk/protocol/http/src/nsHTTPChannel.h +++ b/netwerk/protocol/http/src/nsHTTPChannel.h @@ -202,6 +202,7 @@ protected: nsCOMPtr mStreamAsFileObserverArray; PRBool mApplyConversion; PRBool mNotificationProxiesBuilt; + PRBool mOpenInputStreamHasEventQueue; }; #include "nsIRunnable.h"