Removed link dependency on netwerk.dll.

This commit is contained in:
warren%netscape.com 1999-06-12 08:07:05 +00:00
Родитель 1662f221c0
Коммит 6ea7c972dd
5 изменённых файлов: 63 добавлений и 3 удалений

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

@ -26,6 +26,10 @@ interface nsIProtocolHandler;
interface nsIURI;
interface nsIEventSinkGetter;
interface nsIChannel;
interface nsIStreamObserver;
interface nsIStreamListener;
interface nsIEventQueue;
interface nsIBufferInputStream;
[scriptable, uuid(01f0a170-1881-11d3-9337-00104ba0fd40)]
interface nsIIOService : nsISupports
@ -101,6 +105,27 @@ interface nsIIOService : nsISupports
*/
readonly attribute wstring UserAgent;
/**
* Returns a new stream observer that marshals data from another
* stream observer over to the thread specified by an event queue.
*/
nsIStreamObserver NewAsyncStreamObserver(in nsIStreamObserver receiver,
in nsIEventQueue eventQueue);
/**
* An asynchronous stream listener is used to ship data over to another thread specified
* by the thread's event queue. The receiver stream listener is then used to receive
* the data on the other thread.
*/
nsIStreamListener NewAsyncStreamListener(in nsIStreamListener receiver,
in nsIEventQueue eventQueue);
/**
* A synchronous stream listener pushes data through a pipe that ends up
* in an input stream to be read by another thread.
*/
nsIStreamListener NewSyncStreamListener(out nsIBufferInputStream inStream);
};
%{C++

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

@ -24,6 +24,7 @@
#include "nsIEventQueueService.h"
#include "nsIFileTransportService.h"
#include "nsIURI.h"
#include "nsIStreamListener.h"
#include "nsCOMPtr.h"
#include "prprf.h"
#include "prmem.h" // for PR_Malloc
@ -264,6 +265,32 @@ nsIOService::GetUserAgent(PRUnichar* *aUserAgent)
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
NS_IMETHODIMP
nsIOService::NewAsyncStreamObserver(nsIStreamObserver *receiver, nsIEventQueue *eventQueue,
nsIStreamObserver **result)
{
return NS_NewAsyncStreamObserver(result, eventQueue, receiver);
}
NS_IMETHODIMP
nsIOService::NewAsyncStreamListener(nsIStreamListener *receiver, nsIEventQueue *eventQueue,
nsIStreamListener **result)
{
return NS_NewAsyncStreamListener(result, eventQueue, receiver);
}
NS_IMETHODIMP
nsIOService:: NewSyncStreamListener(nsIBufferInputStream **inStream,
nsIStreamListener **listener)
{
return NS_NewSyncStreamListener(listener, inStream);
}
////////////////////////////////////////////////////////////////////////////////
// HELPER ROUTINES
////////////////////////////////////////////////////////////////////////////////

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

@ -48,6 +48,9 @@ public:
NS_IMETHOD GetLanguage(PRUnichar* *aLanguage);
NS_IMETHOD GetPlatform(PRUnichar* *aPlatform);
NS_IMETHOD GetUserAgent(PRUnichar* *aUserAgent);
NS_IMETHOD NewAsyncStreamObserver(nsIStreamObserver *receiver, nsIEventQueue *eventQueue, nsIStreamObserver **_retval);
NS_IMETHOD NewAsyncStreamListener(nsIStreamListener *receiver, nsIEventQueue *eventQueue, nsIStreamListener **_retval);
NS_IMETHOD NewSyncStreamListener(nsIBufferInputStream **inStream, nsIStreamListener **_retval);
// nsIOService methods:
nsIOService();

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

@ -33,7 +33,6 @@ LLIBS= $(LLIBS) \
$(LIBNSPR) \
$(DIST)\lib\plc3.lib \
$(DIST)\lib\xpcom.lib \
$(DIST)\lib\netwerk.lib \
$(NULL)
MISCDEP=$(LLIBS)

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

@ -195,9 +195,12 @@ nsFileChannel::OpenInputStream(PRUint32 startPosition, PRInt32 readCount,
if (mState != ENDED)
return NS_ERROR_IN_PROGRESS;
NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsIStreamListener* syncListener;
nsIBufferInputStream* inStr;
rv = NS_NewSyncStreamListener(&syncListener, &inStr);
rv = serv->NewSyncStreamListener(&inStr, &syncListener);
if (NS_FAILED(rv)) return rv;
mListener = syncListener;
@ -233,8 +236,11 @@ nsFileChannel::AsyncRead(PRUint32 startPosition, PRInt32 readCount,
nsresult rv;
NS_WITH_SERVICE(nsIIOService, serv, kIOServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsIStreamListener* asyncListener;
rv = NS_NewAsyncStreamListener(&asyncListener, eventQueue, listener);
rv = serv->NewAsyncStreamListener(listener, eventQueue, &asyncListener);
if (NS_FAILED(rv)) return rv;
mListener = asyncListener;