Bug 435241 Remove NS_NewPipe usage from mailnews. p=prasad,r/sr=dmose

This commit is contained in:
bugzilla%standard8.plus.com 2008-05-24 08:18:52 +00:00
Родитель 11b71c0dda
Коммит 79c39402f5
7 изменённых файлов: 38 добавлений и 34 удалений

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

@ -351,11 +351,15 @@ NS_IMETHODIMP nsSmtpService::NewChannel(nsIURI *aURI, nsIChannel **_retval)
{
NS_ENSURE_ARG_POINTER(aURI);
// create an empty pipe for use with the input stream channel.
nsCOMPtr<nsIInputStream> pipeIn;
nsCOMPtr<nsIOutputStream> pipeOut;
nsresult rv = NS_NewPipe(getter_AddRefs(pipeIn),
getter_AddRefs(pipeOut));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIAsyncInputStream> pipeIn;
nsCOMPtr<nsIAsyncOutputStream> pipeOut;
nsCOMPtr<nsIPipe> pipe = do_CreateInstance("@mozilla.org/pipe;1");
nsresult rv = pipe->Init(PR_FALSE, PR_FALSE, 0, 0, nsnull);
if (NS_FAILED(rv))
return rv;
pipe->GetInputStream(getter_AddRefs(pipeIn));
pipe->GetOutputStream(getter_AddRefs(pipeOut));
pipeOut->Close();

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

@ -2690,8 +2690,12 @@ nsresult nsImapProtocol::BeginMessageDownLoad(
// is consuming the message display
// we create an "infinite" pipe in case we get extremely long lines from the imap server,
// and the consumer is waiting for a whole line
rv = NS_NewPipe(getter_AddRefs(m_channelInputStream), getter_AddRefs(m_channelOutputStream), 4096, PR_UINT32_MAX);
NS_ASSERTION(NS_SUCCEEDED(rv), "NS_NewPipe failed!");
nsCOMPtr<nsIPipe> pipe = do_CreateInstance("@mozilla.org/pipe;1");
rv = pipe->Init(PR_FALSE, PR_FALSE, 4096, PR_UINT32_MAX, nsnull);
NS_ASSERTION(NS_SUCCEEDED(rv), "nsIPipe->Init failed!");
pipe->GetInputStream(getter_AddRefs(m_channelInputStream));
pipe->GetOutputStream(getter_AddRefs(m_channelOutputStream));
}
// else, if we are saving the message to disk!
else if (m_imapMessageSink /* && m_imapAction == nsIImapUrl::nsImapSaveMessageToDisk */)

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

@ -45,9 +45,8 @@
#include "nsMsgProtocol.h"
#include "nsIEventTarget.h"
#include "nsIStreamListener.h"
#include "nsIOutputStream.h"
#include "nsIOutputStream.h"
#include "nsIInputStream.h"
#include "nsIAsyncOutputStream.h"
#include "nsIAsyncInputStream.h"
#include "nsImapCore.h"
#include "nsString.h"
#include "nsIProgressEventSink.h"
@ -348,8 +347,8 @@ private:
// Ouput stream for writing commands to the socket
nsCOMPtr<nsISocketTransport> m_transport;
nsCOMPtr<nsIInputStream> m_channelInputStream;
nsCOMPtr<nsIOutputStream> m_channelOutputStream;
nsCOMPtr<nsIAsyncInputStream> m_channelInputStream;
nsCOMPtr<nsIAsyncOutputStream> m_channelOutputStream;
nsCOMPtr<nsIImapMockChannel> m_mockChannel; // this is the channel we should forward to people
//nsCOMPtr<nsIRequest> mAsyncReadRequest; // we're going to cancel this when we're done with the conn.

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

@ -661,14 +661,15 @@ NS_IMETHODIMP nsStreamConverter::Init(nsIURI *aURI, nsIStreamListener * aOutList
}
// now we want to create a pipe which we'll use for converting the data...
rv = NS_NewPipe(getter_AddRefs(mInputStream), getter_AddRefs(mOutputStream),
NS_STREAM_CONVERTER_SEGMENT_SIZE,
/* PR_UINT32_MAX */ NS_STREAM_CONVERTER_BUFFER_SIZE,
PR_TRUE, PR_TRUE);
nsCOMPtr<nsIPipe> pipe = do_CreateInstance("@mozilla.org/pipe;1");
rv = pipe->Init(PR_TRUE, PR_TRUE, 4096, 8, nsnull);
// initialize our emitter
if (NS_SUCCEEDED(rv) && mEmitter)
{
pipe->GetInputStream(getter_AddRefs(mInputStream));
pipe->GetOutputStream(getter_AddRefs(mOutputStream));
mEmitter->Initialize(aURI, aChannel, newType);
mEmitter->SetPipe(mInputStream, mOutputStream);
mEmitter->SetOutputListener(aOutListener);

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

@ -40,18 +40,14 @@
#include "nsIStreamConverter.h"
#include "nsIMimeStreamConverter.h"
#include "nsIOutputStream.h"
#include "nsIMimeEmitter.h"
#include "nsIURI.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
#include "nsIAsyncInputStream.h"
#include "nsIAsyncOutputStream.h"
#include "nsIChannel.h"
#include "nsStringGlue.h"
#include "nsCOMPtr.h"
#define NS_STREAM_CONVERTER_SEGMENT_SIZE (4*1024)
#define NS_STREAM_CONVERTER_BUFFER_SIZE (32*1024)
class nsStreamConverter : public nsIStreamConverter, public nsIMimeStreamConverter {
public:
nsStreamConverter();
@ -82,8 +78,8 @@ private:
nsresult Close();
// the input and output streams form a pipe...they need to be passed around together..
nsCOMPtr<nsIOutputStream> mOutputStream; // output stream
nsCOMPtr<nsIInputStream> mInputStream;
nsCOMPtr<nsIAsyncOutputStream> mOutputStream; // output stream
nsCOMPtr<nsIAsyncInputStream> mInputStream;
nsCOMPtr<nsIStreamListener> mOutListener; // output stream listener
nsCOMPtr<nsIChannel> mOutgoingChannel;

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

@ -2434,11 +2434,13 @@ PRInt32 nsNNTPProtocol::BeginArticle()
//
if (m_channelListener) {
nsresult rv;
rv = NS_NewPipe(getter_AddRefs(mDisplayInputStream),
getter_AddRefs(mDisplayOutputStream),
4096, PRUint32(-1));
nsCOMPtr<nsIPipe> pipe = do_CreateInstance("@mozilla.org/pipe;1");
rv = pipe->Init(PR_FALSE, PR_FALSE, 4096, PR_UINT32_MAX, nsnull);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create pipe");
// TODO: return on failure?
pipe->GetInputStream(getter_AddRefs(mDisplayInputStream));
pipe->GetOutputStream(getter_AddRefs(mDisplayOutputStream));
}
m_nextState = NNTP_READ_ARTICLE;

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

@ -41,10 +41,8 @@
#include "nsMsgProtocol.h"
#include "nsCOMPtr.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
#include "nsIAsyncInputStream.h"
#include "nsIAsyncOutputStream.h"
#include "nsINntpUrl.h"
#include "nsINntpIncomingServer.h"
#include "nsINNTPProtocol.h"
@ -210,8 +208,8 @@ private:
nsCOMPtr <nsIMsgNewsFolder> m_newsFolder;
nsCOMPtr <nsIMsgWindow> m_msgWindow;
nsCOMPtr<nsIInputStream> mDisplayInputStream;
nsCOMPtr<nsIOutputStream> mDisplayOutputStream;
nsCOMPtr<nsIAsyncInputStream> mDisplayInputStream;
nsCOMPtr<nsIAsyncOutputStream> mDisplayOutputStream;
nsMsgLineStreamBuffer * m_lineStreamBuffer; // used to efficiently extract lines from the incoming data stream
// the nsINntpURL that is currently running
nsCOMPtr<nsINntpUrl> m_runningURL;