b=99165 Freeze nsIInputStream nsIOutputStream (not yet frozen... but close)

r=dougt sr=shaver a=asa
This commit is contained in:
darin%netscape.com 2002-03-12 00:59:06 +00:00
Родитель c6d040006e
Коммит cfe07b944b
44 изменённых файлов: 412 добавлений и 925 удалений

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

@ -500,16 +500,9 @@ public:
return rv;
}
NS_IMETHOD GetNonBlocking(PRBool *aNonBlocking) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD GetObserver(nsIInputStreamObserver * *aObserver) {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD SetObserver(nsIInputStreamObserver * aObserver) {
return NS_ERROR_NOT_IMPLEMENTED;
NS_IMETHOD IsNonBlocking(PRBool *aNonBlocking) {
*aNonBlocking = PR_TRUE;
return NS_OK;
}
// Implementation

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

@ -283,19 +283,9 @@ public:
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD GetNonBlocking(PRBool *aNonBlocking) {
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD GetObserver(nsIInputStreamObserver * *aObserver) {
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD SetObserver(nsIInputStreamObserver * aObserver) {
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
NS_IMETHOD IsNonBlocking(PRBool *aNonBlocking) {
*aNonBlocking = PR_TRUE;
return NS_OK;
}
// Implementation

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

@ -68,12 +68,9 @@ EmbedStream::Init(void)
if (NS_FAILED(rv)) return rv;
mInputStream = do_QueryInterface(bufInStream, &rv);
if (NS_FAILED(rv))
return rv;
mOutputStream = do_QueryInterface(bufOutStream, &rv);
return rv;
mInputStream = bufInStream;
mOutputStream = bufOutStream;
return NS_OK;
}
NS_METHOD
@ -271,6 +268,10 @@ EmbedStream::ReadSegments(nsWriteSegmentFun aWriter, void * aClosure,
if (NS_SUCCEEDED(rv)) {
PRUint32 writeCount = 0;
rv = aWriter(this, aClosure, readBuf, 0, nBytes, &writeCount);
// XXX writeCount may be less than nBytes!! This is the wrong
// way to synthesize ReadSegments.
NS_ASSERTION(writeCount == nBytes, "data loss");
}
nsMemory::Free(readBuf);
@ -279,22 +280,7 @@ EmbedStream::ReadSegments(nsWriteSegmentFun aWriter, void * aClosure,
}
NS_IMETHODIMP
EmbedStream::GetNonBlocking(PRBool *aNonBlocking)
EmbedStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
EmbedStream::GetObserver(nsIInputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
EmbedStream::SetObserver(nsIInputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
return mInputStream->IsNonBlocking(aNonBlocking);
}

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

@ -272,6 +272,10 @@ EmbedStream::ReadSegments(nsWriteSegmentFun aWriter, void * aClosure,
if (NS_SUCCEEDED(rv)) {
PRUint32 writeCount = 0;
rv = aWriter(this, aClosure, readBuf, 0, nBytes, &writeCount);
// XXX writeCount may be less than nBytes!! This is the wrong
// way to synthesize ReadSegments.
NS_ASSERTION(writeCount == nBytes, "data loss");
}
nsMemory::Free(readBuf);
@ -280,22 +284,7 @@ EmbedStream::ReadSegments(nsWriteSegmentFun aWriter, void * aClosure,
}
NS_IMETHODIMP
EmbedStream::GetNonBlocking(PRBool *aNonBlocking)
EmbedStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
EmbedStream::GetObserver(nsIInputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
EmbedStream::SetObserver(nsIInputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
return mInputStream->IsNonBlocking(aNonBlocking);
}

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

@ -41,9 +41,7 @@ public:
NS_IMETHOD Available(PRUint32 *_retval);
NS_IMETHOD Read(char * buf, PRUint32 count, PRUint32 *_retval);
NS_IMETHOD ReadSegments(nsWriteSegmentFun writer, void * closure, PRUint32 count, PRUint32 *_retval);
NS_IMETHOD GetNonBlocking(PRBool *aNonBlocking);
NS_IMETHOD GetObserver(nsIInputStreamObserver * *aObserver);
NS_IMETHOD SetObserver(nsIInputStreamObserver * aObserver);
NS_IMETHOD IsNonBlocking(PRBool *aNonBlocking);
};
@ -113,47 +111,18 @@ PyG_nsIInputStream::ReadSegments(nsWriteSegmentFun writer, void * closure, PRUin
}
NS_IMETHODIMP
PyG_nsIInputStream::GetNonBlocking(PRBool *aNonBlocking)
PyG_nsIInputStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_PRECONDITION(aNonBlocking, "null pointer");
CEnterLeavePython _celp;
PyObject *ret;
const char *propName = "nonBlocking";
nsresult nr = InvokeNativeGetViaPolicy(propName, &ret);
const char *methodName = "isNonBlocking";
nsresult nr = InvokeNativeViaPolicy(methodName, &ret);
if (NS_SUCCEEDED(nr)) {
*aNonBlocking = PyInt_AsLong(ret);
if (PyErr_Occurred())
nr = HandleNativeGatewayError(propName);
nr = HandleNativeGatewayError(methodName);
Py_XDECREF(ret);
}
return nr;
}
NS_IMETHODIMP
PyG_nsIInputStream::GetObserver(nsIInputStreamObserver * *aObserver)
{
NS_PRECONDITION(aObserver, "null pointer");
CEnterLeavePython _celp;
PyObject *ret;
const char *propName = "observer";
nsresult nr = InvokeNativeGetViaPolicy(propName, &ret);
if (NS_SUCCEEDED(nr)) {
Py_nsISupports::InterfaceFromPyObject(ret, NS_GET_IID(nsIInputStreamObserver), (nsISupports **)aObserver, PR_FALSE);
if (PyErr_Occurred())
nr = HandleNativeGatewayError(propName);
}
return nr;
}
NS_IMETHODIMP
PyG_nsIInputStream::SetObserver(nsIInputStreamObserver * aObserver)
{
CEnterLeavePython _celp;
const char *propName = "observer";
PyObject *obObserver = MakeInterfaceParam(aObserver, &NS_GET_IID(nsIInputStreamObserver));
if (obObserver==NULL)
return HandleNativeGatewayError(propName);
nsresult nr = InvokeNativeSetViaPolicy(propName, obObserver);
Py_DECREF(obObserver);
return nr;
}

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

@ -560,22 +560,8 @@ mozXMLTermStream::ReadSegments(nsWriteSegmentFun writer, void * closure, PRUint3
}
NS_IMETHODIMP
mozXMLTermStream::GetNonBlocking(PRBool *aNonBlocking)
mozXMLTermStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
mozXMLTermStream::GetObserver(nsIInputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
mozXMLTermStream::SetObserver(nsIInputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
*aNonBlocking = PR_TRUE;
return NS_OK;
}

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

@ -44,6 +44,8 @@
#include "nsIStreamListener.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
#include "nsIObservableInputStream.h"
#include "nsIObservableOutputStream.h"
#include "nsIURI.h"
#include "nsIPref.h"
#include "nsIChannel.h"

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

@ -70,6 +70,8 @@
#include "nsICategoryManager.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIObservableInputStream.h"
#include "nsIObservableOutputStream.h"
#define PREF_MAIL_DISPLAY_GLYPH "mail.display_glyph"
#define PREF_MAIL_DISPLAY_STRUCT "mail.display_struct"
@ -681,11 +683,17 @@ NS_IMETHODIMP nsStreamConverter::Init(nsIURI *aURI, nsIStreamListener * aOutList
if (NS_SUCCEEDED(rv))
{
nsCOMPtr<nsIInputStreamObserver> inObs = do_GetInterface(mEmitter, &rv);
if (NS_SUCCEEDED(rv))
mInputStream->SetObserver(inObs);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIObservableInputStream> observableIn(do_QueryInterface(mInputStream, &rv));
if (NS_SUCCEEDED(rv))
observableIn->SetObserver(inObs);
}
nsCOMPtr<nsIOutputStreamObserver> outObs = do_GetInterface(mEmitter, &rv);
if (NS_SUCCEEDED(rv))
mOutputStream->SetObserver(outObs);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIObservableOutputStream> observableOut(do_QueryInterface(mOutputStream, &rv));
if (NS_SUCCEEDED(rv))
observableOut->SetObserver(outObs);
}
}
// initialize our emitter

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

@ -71,7 +71,10 @@ nsJARInputStream::ReadSegments(nsWriteSegmentFun writer, void * closure, PRUint3
*_retval = 0;
if (NS_SUCCEEDED(rv)) {
rv = writer(this, closure, readBuf, 0, nBytes, _retval);
NS_ASSERTION(nBytes == *_retval, "Didn't write all Data.");
// XXX _retval may be less than nBytes!! This is the wrong
// way to synthesize ReadSegments.
NS_ASSERTION(*_retval == nBytes, "data loss");
}
nsMemory::Free(readBuf);
@ -79,24 +82,10 @@ nsJARInputStream::ReadSegments(nsWriteSegmentFun writer, void * closure, PRUint3
}
NS_IMETHODIMP
nsJARInputStream::GetNonBlocking(PRBool *aNonBlocking)
nsJARInputStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsJARInputStream::GetObserver(nsIInputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsJARInputStream::SetObserver(nsIInputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
*aNonBlocking = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP

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

@ -298,31 +298,10 @@ nsPluginStreamToFile::WriteSegments(nsReadSegmentFun reader, void * closure, PRU
}
NS_IMETHODIMP
nsPluginStreamToFile::GetNonBlocking(PRBool *aNonBlocking)
nsPluginStreamToFile::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsPluginStreamToFile::SetNonBlocking(PRBool aNonBlocking)
{
NS_NOTREACHED("SetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsPluginStreamToFile::GetObserver(nsIOutputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsPluginStreamToFile::SetObserver(nsIOutputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
*aNonBlocking = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP

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

@ -317,24 +317,11 @@ nsBufferedInputStream::ReadSegments(nsWriteSegmentFun writer, void * closure, PR
}
NS_IMETHODIMP
nsBufferedInputStream::GetNonBlocking(PRBool *aNonBlocking)
nsBufferedInputStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBufferedInputStream::GetObserver(nsIInputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBufferedInputStream::SetObserver(nsIInputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
if (mStream)
return Source()->IsNonBlocking(aNonBlocking);
return NS_ERROR_NOT_INITIALIZED;
}
NS_IMETHODIMP
@ -560,33 +547,11 @@ nsBufferedOutputStream::WriteSegments(nsReadSegmentFun reader, void * closure, P
}
NS_IMETHODIMP
nsBufferedOutputStream::GetNonBlocking(PRBool *aNonBlocking)
nsBufferedOutputStream::IsNonBlocking(PRBool *aNonBlocking)
{
if (mStream)
return Sink()->GetNonBlocking(aNonBlocking);
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBufferedOutputStream::SetNonBlocking(PRBool aNonBlocking)
{
if (mStream)
return Sink()->SetNonBlocking(aNonBlocking);
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBufferedOutputStream::GetObserver(nsIOutputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBufferedOutputStream::SetObserver(nsIOutputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
return Sink()->IsNonBlocking(aNonBlocking);
return NS_ERROR_NOT_INITIALIZED;
}
NS_IMETHODIMP_(char*)

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

@ -455,22 +455,8 @@ nsDirectoryIndexStream::ReadSegments(nsWriteSegmentFun writer, void * closure, P
}
NS_IMETHODIMP
nsDirectoryIndexStream::GetNonBlocking(PRBool *aNonBlocking)
nsDirectoryIndexStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDirectoryIndexStream::GetObserver(nsIInputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDirectoryIndexStream::SetObserver(nsIInputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
*aNonBlocking = PR_FALSE;
return NS_OK;
}

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

@ -594,24 +594,10 @@ nsFileInputStream::ReadSegments(nsWriteSegmentFun writer, void * closure, PRUint
}
NS_IMETHODIMP
nsFileInputStream::GetNonBlocking(PRBool *aNonBlocking)
nsFileInputStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsFileInputStream::GetObserver(nsIInputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsFileInputStream::SetObserver(nsIInputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
*aNonBlocking = PR_FALSE;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
@ -712,30 +698,10 @@ nsFileOutputStream::WriteSegments(nsReadSegmentFun reader, void * closure, PRUin
}
NS_IMETHODIMP
nsFileOutputStream::GetNonBlocking(PRBool *aNonBlocking)
nsFileOutputStream::IsNonBlocking(PRBool *aNonBlocking)
{
*aNonBlocking = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsFileOutputStream::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsFileOutputStream::GetObserver(nsIOutputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsFileOutputStream::SetObserver(nsIOutputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
////////////////////////////////////////////////////////////////////////////////

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

@ -101,14 +101,8 @@ public:
mLastError = rv;
return rv;
}
NS_IMETHOD GetNonBlocking(PRBool *aValue) {
return mSource->GetNonBlocking(aValue);
}
NS_IMETHOD GetObserver(nsIInputStreamObserver **aObserver) {
return mSource->GetObserver(aObserver);
}
NS_IMETHOD SetObserver(nsIInputStreamObserver *aObserver) {
return mSource->SetObserver(aObserver);
NS_IMETHOD IsNonBlocking(PRBool *aValue) {
return mSource->IsNonBlocking(aValue);
}
//
@ -182,17 +176,8 @@ public:
mLastError = rv;
return rv;
}
NS_IMETHOD GetNonBlocking(PRBool *aValue) {
return mSink->GetNonBlocking(aValue);
}
NS_IMETHOD SetNonBlocking(PRBool aValue) {
return mSink->SetNonBlocking(aValue);
}
NS_IMETHOD GetObserver(nsIOutputStreamObserver **aObserver) {
return mSink->GetObserver(aObserver);
}
NS_IMETHOD SetObserver(nsIOutputStreamObserver *aObserver) {
return mSink->SetObserver(aObserver);
NS_IMETHOD IsNonBlocking(PRBool *aValue) {
return mSink->IsNonBlocking(aValue);
}
//

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

@ -264,9 +264,7 @@ nsMIMEInputStream::ReadSegCb(nsIInputStream* aIn, void* aClosure,
NS_IMETHODIMP nsMIMEInputStream::Close(void) { INITSTREAMS; return mStream->Close(); }
NS_IMETHODIMP nsMIMEInputStream::Available(PRUint32 *_retval) { INITSTREAMS; return mStream->Available(_retval); }
NS_IMETHODIMP nsMIMEInputStream::Read(char * buf, PRUint32 count, PRUint32 *_retval) { INITSTREAMS; return mStream->Read(buf, count, _retval); }
NS_IMETHODIMP nsMIMEInputStream::GetNonBlocking(PRBool *aNonBlocking) { INITSTREAMS; return mStream->GetNonBlocking(aNonBlocking); }
NS_IMETHODIMP nsMIMEInputStream::GetObserver(nsIInputStreamObserver * *aObserver) { INITSTREAMS; return mStream->GetObserver(aObserver); }
NS_IMETHODIMP nsMIMEInputStream::SetObserver(nsIInputStreamObserver * aObserver) { INITSTREAMS; return mStream->SetObserver(aObserver); }
NS_IMETHODIMP nsMIMEInputStream::IsNonBlocking(PRBool *aNonBlocking) { INITSTREAMS; return mStream->IsNonBlocking(aNonBlocking); }
// nsISeekableStream
NS_IMETHODIMP nsMIMEInputStream::Tell(PRUint32 *_retval)

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

@ -2248,21 +2248,10 @@ nsSocketBIS::ReadSegments(nsWriteSegmentFun aWriter, void *aClosure,
}
NS_IMETHODIMP
nsSocketBIS::GetNonBlocking(PRBool *aValue)
nsSocketBIS::IsNonBlocking(PRBool *aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSocketBIS::GetObserver(nsIInputStreamObserver **aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSocketBIS::SetObserver(nsIInputStreamObserver *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
*aValue = PR_FALSE;
return NS_OK;
}
//
@ -2358,27 +2347,10 @@ nsSocketBOS::WriteSegments(nsReadSegmentFun aReader, void *aClosure,
}
NS_IMETHODIMP
nsSocketBOS::GetNonBlocking(PRBool *aValue)
nsSocketBOS::IsNonBlocking(PRBool *aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSocketBOS::SetNonBlocking(PRBool aValue)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSocketBOS::GetObserver(nsIOutputStreamObserver **aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSocketBOS::SetObserver(nsIOutputStreamObserver *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
*aValue = PR_FALSE;
return NS_OK;
}
//
@ -2456,27 +2428,13 @@ nsSocketIS::ReadSegments(nsWriteSegmentFun aWriter, void *aClosure,
}
NS_IMETHODIMP
nsSocketIS::GetNonBlocking(PRBool *aValue)
nsSocketIS::IsNonBlocking(PRBool *aValue)
{
NS_ENSURE_ARG_POINTER(aValue);
*aValue = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsSocketIS::GetObserver(nsIInputStreamObserver **aObserver)
{
NS_NOTREACHED("nsSocketIS::GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSocketIS::SetObserver(nsIInputStreamObserver *aObserver)
{
NS_NOTREACHED("nsSocketIS::SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSocketIS::Seek(PRInt32 whence, PRInt32 offset)
{
@ -2582,34 +2540,13 @@ nsSocketOS::WriteSegments(nsReadSegmentFun aReader, void *aClosure,
}
NS_IMETHODIMP
nsSocketOS::GetNonBlocking(PRBool *aValue)
nsSocketOS::IsNonBlocking(PRBool *aValue)
{
NS_ENSURE_ARG_POINTER(aValue);
*aValue = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsSocketOS::SetNonBlocking(PRBool aValue)
{
NS_NOTREACHED("nsSocketOS::SetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSocketOS::GetObserver(nsIOutputStreamObserver **aObserver)
{
NS_NOTREACHED("nsSocketOS::GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSocketOS::SetObserver(nsIOutputStreamObserver *aObserver)
{
NS_NOTREACHED("nsSocketOS::SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsSocketOS::Seek(PRInt32 whence, PRInt32 offset)
{

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

@ -711,27 +711,13 @@ nsStorageTransport::nsReadRequest::ReadSegments(nsWriteSegmentFun aWriter,
}
NS_IMETHODIMP
nsStorageTransport::nsReadRequest::GetNonBlocking(PRBool *aNonBlocking)
nsStorageTransport::nsReadRequest::IsNonBlocking(PRBool *aNonBlocking)
{
NS_ENSURE_ARG_POINTER(aNonBlocking);
*aNonBlocking = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsStorageTransport::nsReadRequest::GetObserver(nsIInputStreamObserver **aObserver)
{
NS_ENSURE_ARG_POINTER(aObserver);
*aObserver = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsStorageTransport::nsReadRequest::SetObserver(nsIInputStreamObserver *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//----------------------------------------------------------------------------
// nsStorageTransport::nsBlockingStream
//----------------------------------------------------------------------------
@ -791,27 +777,13 @@ nsStorageTransport::nsInputStream::ReadSegments(nsWriteSegmentFun aWriter,
}
NS_IMETHODIMP
nsStorageTransport::nsInputStream::GetNonBlocking(PRBool *aNonBlocking)
nsStorageTransport::nsInputStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_ENSURE_ARG_POINTER(aNonBlocking);
*aNonBlocking = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
nsStorageTransport::nsInputStream::GetObserver(nsIInputStreamObserver **aObserver)
{
NS_ENSURE_ARG_POINTER(aObserver);
*aObserver = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsStorageTransport::nsInputStream::SetObserver(nsIInputStreamObserver *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
//----------------------------------------------------------------------------
// nsStorageTransport::nsOutputStream
//----------------------------------------------------------------------------
@ -901,29 +873,9 @@ nsStorageTransport::nsOutputStream::WriteSegments(nsReadSegmentFun aReader,
}
NS_IMETHODIMP
nsStorageTransport::nsOutputStream::GetNonBlocking(PRBool *aNonBlocking)
nsStorageTransport::nsOutputStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_ENSURE_ARG_POINTER(aNonBlocking);
*aNonBlocking = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP
nsStorageTransport::nsOutputStream::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsStorageTransport::nsOutputStream::GetObserver(nsIOutputStreamObserver **aObserver)
{
NS_ENSURE_ARG_POINTER(aObserver);
*aObserver = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsStorageTransport::nsOutputStream::SetObserver(nsIOutputStreamObserver *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

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

@ -38,7 +38,6 @@
#include "nsStreamListenerProxy.h"
#include "nsIGenericFactory.h"
#include "nsIInputStream.h"
#include "nsIPipe.h"
#include "nsAutoLock.h"
#include "prlog.h"
@ -235,9 +234,13 @@ nsStreamListenerProxy::OnStartRequest(nsIRequest *request,
{
NS_ENSURE_TRUE(mObserverProxy, NS_ERROR_NOT_INITIALIZED);
nsresult rv;
nsCOMPtr<nsIObservableInputStream> obs(do_QueryInterface(mPipeIn, &rv));
if (NS_FAILED(rv)) return rv;
// This will create a cyclic reference between the pipe and |this|, which
// will be broken when onStopRequest is called.
nsresult rv = mPipeIn->SetObserver(this);
rv = obs->SetObserver(this);
if (NS_FAILED(rv)) return rv;
return mObserverProxy->OnStartRequest(request, context);

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

@ -43,6 +43,7 @@
#include "nsIStreamListener.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
#include "nsIObservableInputStream.h"
#include "nsIRequest.h"
#include "nsCOMPtr.h"

27
netwerk/cache/src/nsANSIFileStreams.cpp поставляемый
Просмотреть файл

@ -83,22 +83,12 @@ NS_IMETHODIMP nsANSIInputStream::ReadSegments(nsWriteSegmentFun writer, void * c
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsANSIInputStream::GetNonBlocking(PRBool *aNonBlocking)
NS_IMETHODIMP nsANSIInputStream::IsNonBlocking(PRBool *aNonBlocking)
{
*aNonBlocking = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP nsANSIInputStream::GetObserver(nsIInputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsANSIInputStream::SetObserver(nsIInputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsANSIInputStream::Seek(PRInt32 whence, PRInt32 offset)
{
if (mFile) {
@ -190,24 +180,11 @@ NS_IMETHODIMP nsANSIOutputStream::WriteSegments(nsReadSegmentFun reader, void *
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsANSIOutputStream::GetNonBlocking(PRBool *aNonBlocking)
NS_IMETHODIMP nsANSIOutputStream::IsNonBlocking(PRBool *aNonBlocking)
{
*aNonBlocking = PR_FALSE;
return NS_OK;
}
NS_IMETHODIMP nsANSIOutputStream::SetNonBlocking(PRBool aNonBlocking)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsANSIOutputStream::GetObserver(nsIOutputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsANSIOutputStream::SetObserver(nsIOutputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsANSIOutputStream::Seek(PRInt32 whence, PRInt32 offset)
{

13
netwerk/cache/src/nsCacheEntryDescriptor.h поставляемый
Просмотреть файл

@ -121,17 +121,8 @@ private:
PRUint32 count,
PRUint32 * result);
NS_IMETHOD GetNonBlocking(PRBool * nonBlocking)
{ return mOutput->GetNonBlocking(nonBlocking); }
NS_IMETHOD SetNonBlocking(PRBool nonBlocking)
{ return mOutput->SetNonBlocking(nonBlocking); }
NS_IMETHOD GetObserver(nsIOutputStreamObserver ** observer)
{ return mOutput->GetObserver(observer); }
NS_IMETHOD SetObserver(nsIOutputStreamObserver * observer)
{ return mOutput->SetObserver(observer); }
NS_IMETHOD IsNonBlocking(PRBool * nonBlocking)
{ return mOutput->IsNonBlocking(nonBlocking); }
nsOutputStreamWrapper(nsCacheEntryDescriptor * descriptor,
nsIOutputStream * output)

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

@ -890,18 +890,7 @@ nsHttpTransaction::ReadSegments(nsWriteSegmentFun writer, void *closure,
}
NS_IMETHODIMP
nsHttpTransaction::GetNonBlocking(PRBool *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHttpTransaction::GetObserver(nsIInputStreamObserver **obs)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsHttpTransaction::SetObserver(nsIInputStreamObserver *obs)
nsHttpTransaction::IsNonBlocking(PRBool *result)
{
return NS_ERROR_NOT_IMPLEMENTED;
}

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

@ -523,26 +523,8 @@ public:
}
NS_IMETHOD
GetNonBlocking(PRBool *aNonBlocking) {
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD
SetNonBlocking(PRBool aNonBlocking) {
NS_NOTREACHED("SetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD
GetObserver(nsIOutputStreamObserver * *aObserver) {
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD
SetObserver(nsIOutputStreamObserver * aObserver) {
NS_NOTREACHED("SetObserver");
IsNonBlocking(PRBool *aNonBlocking) {
NS_NOTREACHED("IsNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
@ -852,18 +834,8 @@ public:
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD GetNonBlocking(PRBool *aNonBlocking) {
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD GetObserver(nsIInputStreamObserver * *aObserver) {
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD SetObserver(nsIInputStreamObserver * aObserver) {
NS_NOTREACHED("SetObserver");
NS_IMETHOD IsNonBlocking(PRBool *aNonBlocking) {
NS_NOTREACHED("IsNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}

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

@ -190,19 +190,9 @@ public:
return rv;
}
NS_IMETHOD GetNonBlocking(PRBool *aNonBlocking) {
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD GetObserver(nsIInputStreamObserver * *aObserver) {
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD SetObserver(nsIInputStreamObserver * aObserver) {
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
NS_IMETHOD IsNonBlocking(PRBool *aNonBlocking) {
*aNonBlocking = PR_TRUE;
return NS_OK;
}
// Implementation

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

@ -126,26 +126,8 @@ public:
}
NS_IMETHOD
GetNonBlocking(PRBool *aNonBlocking) {
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD
SetNonBlocking(PRBool aNonBlocking) {
NS_NOTREACHED("SetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD
GetObserver(nsIOutputStreamObserver * *aObserver) {
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD
SetObserver(nsIOutputStreamObserver * aObserver) {
NS_NOTREACHED("SetObserver");
IsNonBlocking(PRBool *aNonBlocking) {
NS_NOTREACHED("IsNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}

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

@ -191,24 +191,9 @@ NS_IMETHODIMP nsDecodeAppleFile::WriteSegments(nsReadSegmentFun reader, void * c
return m_output->WriteSegments(reader, closure, count, _retval);
}
NS_IMETHODIMP nsDecodeAppleFile::GetNonBlocking(PRBool *aNonBlocking)
NS_IMETHODIMP nsDecodeAppleFile::IsNonBlocking(PRBool *aNonBlocking)
{
return m_output->GetNonBlocking(aNonBlocking);
}
NS_IMETHODIMP nsDecodeAppleFile::SetNonBlocking(PRBool aNonBlocking)
{
return m_output->SetNonBlocking(aNonBlocking);
}
NS_IMETHODIMP nsDecodeAppleFile::GetObserver(nsIOutputStreamObserver * *aObserver)
{
return m_output->GetObserver(aObserver);
}
NS_IMETHODIMP nsDecodeAppleFile::SetObserver(nsIOutputStreamObserver * aObserver)
{
return m_output->SetObserver(aObserver);
return m_output->IsNonBlocking(aNonBlocking);
}
NS_IMETHODIMP nsDecodeAppleFile::Write(const char *buffer, PRUint32 bufferSize, PRUint32* writeCount)

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

@ -13,6 +13,8 @@ nsILocalFile.idl
nsIMultiplexInputStream.idl
nsIObjectInputStream.idl
nsIObjectOutputStream.idl
nsIObservableInputStream.idl
nsIObservableOutputStream.idl
nsIOutputStream.idl
nsIPipe.idl
nsIScriptableInputStream.idl

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

@ -129,6 +129,8 @@ XPIDLSRCS = \
nsIStorageStream.idl \
nsIStreamBufferAccess.idl \
nsIStringStream.idl \
nsIObservableInputStream.idl \
nsIObservableOutputStream.idl \
$(NULL)
SDK_XPIDLSRCS = \

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

@ -72,6 +72,8 @@ XPIDLSRCS = \
.\nsIStorageStream.idl \
.\nsIStreamBufferAccess.idl \
.\nsIStringStream.idl \
.\nsIObservableInputStream.idl \
.\nsIObservableOutputStream.idl \
$(NULL)
################################################################################

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

@ -76,31 +76,9 @@ nsBinaryOutputStream::WriteSegments(nsReadSegmentFun reader, void * closure, PRU
}
NS_IMETHODIMP
nsBinaryOutputStream::GetNonBlocking(PRBool *aNonBlocking)
nsBinaryOutputStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBinaryOutputStream::SetNonBlocking(PRBool aNonBlocking)
{
NS_NOTREACHED("SetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBinaryOutputStream::GetObserver(nsIOutputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBinaryOutputStream::SetObserver(nsIOutputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
return mOutputStream->IsNonBlocking(aNonBlocking);
}
nsresult
@ -321,24 +299,9 @@ nsBinaryInputStream::ReadSegments(nsWriteSegmentFun writer, void * closure, PRUi
}
NS_IMETHODIMP
nsBinaryInputStream::GetNonBlocking(PRBool *aNonBlocking)
nsBinaryInputStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBinaryInputStream::GetObserver(nsIInputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsBinaryInputStream::SetObserver(nsIInputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
return mInputStream->IsNonBlocking(aNonBlocking);
}
NS_IMETHODIMP

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

@ -109,24 +109,10 @@ nsByteArrayInputStream::ReadSegments(nsWriteSegmentFun writer, void * aClosure,
}
NS_IMETHODIMP
nsByteArrayInputStream::GetNonBlocking(PRBool *aNonBlocking)
nsByteArrayInputStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsByteArrayInputStream::GetObserver(nsIInputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsByteArrayInputStream::SetObserver(nsIInputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
*aNonBlocking = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP

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

@ -80,18 +80,13 @@ class FileImpl
NS_IMETHOD Available(PRUint32 *aLength);
NS_IMETHOD Read(char* aBuf, PRUint32 aCount, PRUint32 *aReadCount);
NS_IMETHOD ReadSegments(nsWriteSegmentFun writer, void * closure, PRUint32 count, PRUint32 *_retval);
NS_IMETHOD GetObserver(nsIInputStreamObserver * *aObserver);
NS_IMETHOD SetObserver(nsIInputStreamObserver * aObserver);
NS_IMETHOD IsNonBlocking(PRBool *aNonBlocking);
// nsIOutputStream interface
NS_IMETHOD Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount);
NS_IMETHOD Flush();
NS_IMETHOD WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval);
NS_IMETHOD WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval);
NS_IMETHOD GetNonBlocking(PRBool *aNonBlocking);
NS_IMETHOD SetNonBlocking(PRBool aNonBlocking);
NS_IMETHOD GetObserver(nsIOutputStreamObserver * *aObserver);
NS_IMETHOD SetObserver(nsIOutputStreamObserver * aObserver);
// nsIRandomAccessStore interface
NS_DECL_NSISEEKABLESTREAM
@ -396,20 +391,6 @@ FileImpl::ReadSegments(nsWriteSegmentFun writer, void * closure, PRUint32 count,
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
FileImpl::GetObserver(nsIInputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
FileImpl::SetObserver(nsIInputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
//----------------------------------------------------------------------------------------
NS_IMETHODIMP FileImpl::Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount)
//----------------------------------------------------------------------------------------
@ -504,31 +485,10 @@ FileImpl::WriteSegments(nsReadSegmentFun reader, void * closure,
}
NS_IMETHODIMP
FileImpl::GetNonBlocking(PRBool *aNonBlocking)
FileImpl::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
FileImpl::SetNonBlocking(PRBool aNonBlocking)
{
NS_NOTREACHED("SetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
FileImpl::GetObserver(nsIOutputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
FileImpl::SetObserver(nsIOutputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
*aNonBlocking = PR_FALSE;
return NS_OK;
}
//----------------------------------------------------------------------------------------

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

@ -19,7 +19,8 @@
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Contributor(s): Warren Harris <warren@netscape.com>
* Darin Fisher <darin@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -36,88 +37,101 @@
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIInputStream;
interface nsIInputStreamObserver;
%{C++
/**
* The signature of the writer function passed to ReadSegments. This
* specifies where the data should go that gets read from the buffer.
* is the "consumer" of data that gets read from the stream's buffer.
*
* @param aInStream stream being read
* @param aClosure opaque parameter passed to ReadSegments
* @param aFromSegment pointer to memory owned by the input stream
* @param aToOffset amount already read (since ReadSegments was called)
* @param aCount length of fromSegment
* @param aWriteCount number of bytes read
*
* Implementers should return the following:
* @return NS_OK and writeCount - if successfully wrote something
* @return NS_BASE_STREAM_CLOSED - if no more can be written
* @return NS_BASE_STREAM_WOULD_BLOCK - if there is currently space to write (in
* a non-blocking mode)
* @return <other-error> - on failure
*
* @return NS_OK and (*aWriteCount > 0) if consumed some data
* @return NS_BASE_STREAM_WOULD_BLOCK if not interested in consuming any data
* @return <other-error> on failure
*
* Errors are passed to the caller of ReadSegments, unless aToOffset is
* greater than zero.
*
* NOTE: returning NS_OK and (*aWriteCount = 0) has undefined behavior.
*
* @status UNDER_REVIEW
*/
typedef NS_CALLBACK(nsWriteSegmentFun)(nsIInputStream* in,
void* closure,
const char* fromRawSegment,
PRUint32 toOffset,
PRUint32 count,
PRUint32 *writeCount);
typedef NS_CALLBACK(nsWriteSegmentFun)(nsIInputStream *aInStream,
void *aClosure,
const char *aFromSegment,
PRUint32 aToOffset,
PRUint32 aCount,
PRUint32 *aWriteCount);
%}
native nsWriteSegmentFun(nsWriteSegmentFun);
/**
* nsIInputStream
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(fa9c7f6c-61b3-11d4-9877-00c04fa0cf4a)]
interface nsIInputStream : nsISupports
{
/**
* Closes the stream.
* Close the stream.
*/
void close();
/**
* Return the number of bytes currently available in the stream
* @param aLength out parameter to hold the number of bytes
* if an error occurs, the parameter will be undefined
* @return error status
* @return number of bytes currently available in the stream
*/
unsigned long available();
/**
* Read data from the stream.
*
* @param aBuf the buffer into which the data is read
* @param aCount the maximum number of bytes to read
* @return aReadCount out parameter to hold the number of
* bytes read, eof if 0. if an error occurs, the
* read count will be undefined
*
* @return count read
* @return 0 if reached end of file
*
* @throws NS_BASE_STREAM_WOULD_BLOCK if reading from the input stream would
* block the calling thread (non-blocking mode only)
* @throws <other-error> on failure
*/
[noscript] unsigned long read(in charPtr buf, in unsigned long count);
[noscript] unsigned long read(in charPtr aBuf, in unsigned long aCount);
/**
* Low-level read method that has access to the stream's underlying buffer. The
* writer function may be called multiple times for segmented buffers.
*
* @param aWriter the "consumer" of the data to read
* @param aClosure opaque parameter passed to writer
* @param aCount the maximum number of bytes to read
*
* @return count read
* @return 0 if reached end of file
*
* @throws NS_BASE_STREAM_WOULD_BLOCK if reading from the input stream would
* block the calling thread (non-blocking mode only)
* @throws <other-error> on failure
*
* NOTE: this function may be unimplemented if a stream has no underlying
* buffer (e.g., socket input stream).
*/
[noscript] unsigned long readSegments(in nsWriteSegmentFun writer,
in voidPtr closure,
in unsigned long count);
[noscript] unsigned long readSegments(in nsWriteSegmentFun aWriter,
in voidPtr aClosure,
in unsigned long aCount);
/**
* Check this attribute to see if the stream is in non-blocking mode.
* @return true if stream is non-blocking
*/
readonly attribute boolean nonBlocking;
/**
* Allows users to set an observer on an input stream to receive notifications
* about the consumer emptying the input stream's underlying buffer, or closing the
* stream. This is necessary for non-blocking streams so that the producer can suspend
* itself until more data can be written.
*/
attribute nsIInputStreamObserver observer;
};
[scriptable, uuid(019d67cc-61b4-11d4-9877-00c04fa0cf4a)]
interface nsIInputStreamObserver : nsISupports
{
/**
* Called when the input stream's consumer has read all the existing data from the stream.
*/
void onEmpty(in nsIInputStream inStr);
/**
* Called when the consumer closes its end of the stream.
*/
void onClose(in nsIInputStream inStr);
boolean isNonBlocking();
};

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

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

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

@ -19,7 +19,8 @@
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Contributor(s): Warren Harris <warren@netscape.com>
* Darin Fisher <darin@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -36,101 +37,126 @@
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
interface nsIOutputStream;
interface nsIOutputStreamObserver;
interface nsIInputStream;
%{C++
/**
* The signature for the reader function passed to WriteSegment. This
* specifies where the data should come from that gets written into the buffer.
* The signature for the reader function passed to WriteSegments. This
* is the "provider" of data that gets written into the stream's buffer.
*
* @param aOutStream stream being written to
* @param aClosure opaque parameter passed to WriteSegments
* @param aToSegment pointer to memory owned by the output stream
* @param aFromOffset amount already written (since WriteSegments was called)
* @param aCount length of toSegment
* @param aReadCount number of bytes written
*
* Implementers should return the following:
* @return NS_OK and readCount > 0 - if successfully read something
* @return NS_OK and readCount == 0 - if no more to read (EOF)
* @return NS_BASE_STREAM_WOULD_BLOCK - if there is currently no data (in
* a non-blocking mode)
* @return <other-error> - on failure
*
* @return NS_OK and (*aReadCount > 0) if successfully provided some data
* @return NS_OK and (*aReadCount = 0) or
* @return NS_BASE_STREAM_WOULD_BLOCK if not interested in providing any data
* @return <other-error> on failure
*
* Errors are passed to the caller of WriteSegments, unless aFromOffset is
* greater than zero.
*
* @status UNDER_REVIEW
*/
typedef NS_CALLBACK(nsReadSegmentFun)(nsIOutputStream* out,
void* closure,
char* toRawSegment,
PRUint32 fromOffset,
PRUint32 count,
PRUint32 *readCount);
typedef NS_CALLBACK(nsReadSegmentFun)(nsIOutputStream *aOutStream,
void *aClosure,
char *aToSegment,
PRUint32 aFromOffset,
PRUint32 aCount,
PRUint32 *aReadCount);
%}
native nsReadSegmentFun(nsReadSegmentFun);
/**
* nsIOutputStream
*
* @status UNDER_REVIEW
*/
[scriptable, uuid(0d0acd2a-61b4-11d4-9877-00c04fa0cf4a)]
interface nsIOutputStream : nsISupports
{
/**
* Closes the stream.
* Close the stream. Forces the output stream to flush any buffered data.
*
* @throws NS_BASE_STREAM_WOULD_BLOCK if unable to flush without blocking
* the calling thread (non-blocking mode only)
*/
void close();
/**
* Flushes the stream.
* Flush the stream.
*
* @throws NS_BASE_STREAM_WOULD_BLOCK if unable to flush without blocking
* the calling thread (non-blocking mode only)
*/
void flush();
/** Write data into the stream.
* @param aBuf the buffer from which the data is read
* @param aCount the maximum number of bytes to write
* @return aWriteCount out parameter to hold the number of
* bytes written. if an error occurs, the writecount
* is undefined
/**
* Write data into the stream.
*
* @param aBuf the buffer containing the data to be written
* @param aCount the maximum number of bytes to be written
*
* @return number of bytes written
*
* @throws NS_BASE_STREAM_WOULD_BLOCK if writing to the output stream would
* block the calling thread (non-blocking mode only)
* @throws <other-error> on failure
*/
unsigned long write(in string buf, in unsigned long count);
unsigned long write(in string aBuf, in unsigned long aCount);
/**
* Writes data into the stream from an input stream.
* Implementer's note: This method is defined by this interface in order
* to allow the output stream to efficiently copy the data from the input
* stream into its internal buffer (if any). If this method was provide
* as an external facility, a separate char* buffer would need to be used
* in order to call the output stream's other Write method.
* @param fromStream the stream from which the data is read
* @param count the maximun number of bytes to write
* @return aWriteCount out parameter to hold the number of
* bytes written. if an error occurs, the writecount
* is undefined
*
* @param aFromStream the stream containing the data to be written
* @param aCount the maximum number of bytes to be written
*
* @return number of bytes written
*
* @throws NS_BASE_STREAM_WOULD_BLOCK if writing to the output stream would
* block the calling thread (non-blocking mode only)
* @throws <other-error> on failure
*
* NOTE: This method is defined by this interface in order to allow the
* output stream to efficiently copy the data from the input stream into
* its internal buffer (if any). If this method was provided as an external
* facility, a separate char* buffer would need to be used in order to call
* the output stream's other Write method.
*/
unsigned long writeFrom(in nsIInputStream inStr,
in unsigned long count);
unsigned long writeFrom(in nsIInputStream aFromStream,
in unsigned long aCount);
/**
* Low-level write method that has access to the stream's underlying buffer. The
* reader function may be called multiple times for segmented buffers.
*
* @param aReader the "provider" of the data to be written
* @param aClosure opaque parameter passed to reader
* @param aCount the maximum number of bytes to be written
*
* @return number of bytes written
*
* @throws NS_BASE_STREAM_WOULD_BLOCK if writing to the output stream would
* block the calling thread (non-blocking mode only)
* @throws <other-error> on failure
*
* NOTE: this function may be unimplemented if a stream has no underlying
* buffer (e.g., socket output stream).
*/
[noscript] unsigned long writeSegments(in nsReadSegmentFun reader,
in voidPtr closure,
in unsigned long count);
/**
* Set this attribute to put the stream in non-blocking mode.
*/
attribute boolean nonBlocking;
[noscript] unsigned long writeSegments(in nsReadSegmentFun aReader,
in voidPtr aClosure,
in unsigned long aCount);
/**
* Allows users to set an observer on an output stream to receive notifications
* about the producer writing data into the output stream, or filling the buffer.
* This is necessary for non-blocking streams so that the consumer can suspend
* itself until more data is available.
* @return true if stream is non-blocking
*/
attribute nsIOutputStreamObserver observer;
};
[scriptable, uuid(12314194-61b4-11d4-9877-00c04fa0cf4a)]
interface nsIOutputStreamObserver : nsISupports
{
/**
* Called when the output stream's producer has written more data into the stream.
*/
void onWrite(in nsIOutputStream outStr,
in unsigned long amount);
/**
* Called when the stream's underlying buffer becomes full.
*/
void onFull(in nsIOutputStream outStr);
boolean isNonBlocking();
};

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

@ -43,18 +43,31 @@ interface nsIInputStream;
interface nsIOutputStream;
[scriptable, uuid(f4211abc-61b3-11d4-9877-00c04fa0cf4a)]
interface nsIPipe : nsISupports {
interface nsIPipe : nsISupports
{
/**
* initialize this pipe
*/
void initialize(in unsigned long segmentSize,
in unsigned long maxSize,
in boolean nonBlockingInput,
in boolean nonBlockingOutput,
in nsIMemory segmentAllocator);
/**
* supports nsIObservableInputStream and nsISearchableInputStream
*/
readonly attribute nsIInputStream inputStream;
/**
* supports nsIObservableOutputStream
*/
readonly attribute nsIOutputStream outputStream;
};
[scriptable, uuid(8C39EF62-F7C9-11d4-98F5-001083010E9B)]
interface nsISearchableInputStream : nsISupports {
interface nsISearchableInputStream : nsISupports
{
/**
* Searches for a string in the input stream. Since the stream has a notion
* of EOF, it is possible that the string may at some time be in the

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

@ -153,24 +153,10 @@ nsInputStreamTee::ReadSegments(nsWriteSegmentFun writer,
}
NS_IMETHODIMP
nsInputStreamTee::GetNonBlocking(PRBool *result)
nsInputStreamTee::IsNonBlocking(PRBool *result)
{
NS_ENSURE_TRUE(mSource, NS_ERROR_NOT_INITIALIZED);
return mSource->GetNonBlocking(result);
}
NS_IMETHODIMP
nsInputStreamTee::GetObserver(nsIInputStreamObserver **obs)
{
NS_ENSURE_TRUE(mSource, NS_ERROR_NOT_INITIALIZED);
return mSource->GetObserver(obs);
}
NS_IMETHODIMP
nsInputStreamTee::SetObserver(nsIInputStreamObserver *obs)
{
NS_ENSURE_TRUE(mSource, NS_ERROR_NOT_INITIALIZED);
return mSource->SetObserver(obs);
return mSource->IsNonBlocking(result);
}
nsresult
@ -180,7 +166,7 @@ nsInputStreamTee::Init(nsIInputStream *source, nsIOutputStream *sink)
NS_ENSURE_TRUE(sink, NS_ERROR_NOT_INITIALIZED);
PRBool nonBlocking = PR_FALSE;
nsresult rv = sink->GetNonBlocking(&nonBlocking);
nsresult rv = sink->IsNonBlocking(&nonBlocking);
if (NS_FAILED(rv))
return rv;
if (nonBlocking) {

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

@ -287,7 +287,7 @@ nsMultiplexInputStream::ReadSegCb(nsIInputStream* aIn, void* aClosure,
/* readonly attribute boolean nonBlocking; */
NS_IMETHODIMP
nsMultiplexInputStream::GetNonBlocking(PRBool *aNonBlocking)
nsMultiplexInputStream::IsNonBlocking(PRBool *aNonBlocking)
{
nsresult rv;
PRUint32 i, len;
@ -295,7 +295,7 @@ nsMultiplexInputStream::GetNonBlocking(PRBool *aNonBlocking)
mStreams.Count(&len);
for (i = 0; i < len; ++i) {
nsCOMPtr<nsIInputStream> stream(do_QueryElementAt(&mStreams, i));
rv = stream->GetNonBlocking(aNonBlocking);
rv = stream->IsNonBlocking(aNonBlocking);
NS_ENSURE_SUCCESS(rv, rv);
// If one is non-blocking the entire stream becomes non-blocking
if (*aNonBlocking)
@ -304,18 +304,6 @@ nsMultiplexInputStream::GetNonBlocking(PRBool *aNonBlocking)
return NS_OK;
}
/* attribute nsIInputStreamObserver observer; */
NS_IMETHODIMP
nsMultiplexInputStream::GetObserver(nsIInputStreamObserver * *aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsMultiplexInputStream::SetObserver(nsIInputStreamObserver * aObserver)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void seek (in PRInt32 whence, in PRInt32 offset); */
NS_IMETHODIMP
nsMultiplexInputStream::Seek(PRInt32 aWhence, PRInt32 aOffset)

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

@ -39,6 +39,8 @@
#include "nsIPipe.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
#include "nsIObservableInputStream.h"
#include "nsIObservableOutputStream.h"
#include "nsSegmentedBuffer.h"
#include "nsAutoLock.h"
#include "nsIServiceManager.h"
@ -70,29 +72,20 @@ public:
// implementations to avoid the extra object allocation, and speed up method
// invocation between them and the nsPipe's buffer manipulation methods.
class nsPipeInputStream : public nsIInputStream, public nsISearchableInputStream {
class nsPipeInputStream : public nsIInputStream
, public nsIObservableInputStream
, public nsISearchableInputStream {
public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
// nsIBaseStream methods:
NS_IMETHOD Close(void);
// nsIInputStream methods:
NS_IMETHOD Available(PRUint32 *result);
NS_IMETHOD Read(char* toBuf, PRUint32 bufLen, PRUint32 *readCount);
// nsIInputStream methods:
NS_IMETHOD ReadSegments(nsWriteSegmentFun writer, void* closure, PRUint32 count,
PRUint32 *readCount);
NS_IMETHOD Search(const char *forString, PRBool ignoreCase, PRBool *found,
PRUint32 *offsetSearchedTo);
NS_IMETHOD GetNonBlocking(PRBool *aNonBlocking);
NS_IMETHOD SetNonBlocking(PRBool aNonBlocking);
NS_DECL_ISUPPORTS
NS_DECL_NSIINPUTSTREAM
NS_DECL_NSISEARCHABLEINPUTSTREAM
// nsIObservableInputStream methods:
NS_IMETHOD GetObserver(nsIInputStreamObserver* *result) {
*result = mObserver;
NS_IF_ADDREF(*result);
return NS_OK;
}
NS_IMETHOD SetObserver(nsIInputStreamObserver* obs) {
mObserver = obs;
return NS_OK;
@ -101,6 +94,7 @@ public:
nsPipeInputStream() : mReaderRefCnt(0), mBlocking(PR_TRUE) {}
virtual ~nsPipeInputStream() { }
nsresult Fill();
void SetNonBlocking(PRBool aNonBlocking) { mBlocking = !aNonBlocking; }
protected:
nsrefcnt mReaderRefCnt; // separate refcnt so that we know when to close the consumer
@ -108,21 +102,13 @@ public:
nsCOMPtr<nsIInputStreamObserver> mObserver;
};
class nsPipeOutputStream : public nsIOutputStream {
class nsPipeOutputStream : public nsIOutputStream
, public nsIObservableOutputStream {
public:
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
NS_IMETHOD_(nsrefcnt) AddRef(void);
NS_IMETHOD_(nsrefcnt) Release(void);
// nsIBaseStream methods:
NS_IMETHOD Close(void);
NS_IMETHOD Write(const char* fromBuf, PRUint32 bufLen, PRUint32 *writeCount);
NS_IMETHOD Flush(void);
// nsIOutputStream methods:
NS_IMETHOD WriteSegments(nsReadSegmentFun reader, void* closure, PRUint32 count,
PRUint32 *writeCount);
NS_IMETHOD WriteFrom(nsIInputStream* fromStream, PRUint32 count, PRUint32 *writeCount);
NS_IMETHOD GetNonBlocking(PRBool *aNonBlocking);
NS_IMETHOD SetNonBlocking(PRBool aNonBlocking);
NS_DECL_ISUPPORTS
NS_DECL_NSIOUTPUTSTREAM
// nsIObservableOutputStream methods:
NS_IMETHOD GetObserver(nsIOutputStreamObserver* *result) {
*result = mObserver;
NS_IF_ADDREF(*result);
@ -136,6 +122,7 @@ public:
nsPipeOutputStream() : mWriterRefCnt(0), mBlocking(PR_TRUE) {}
virtual ~nsPipeOutputStream() { }
void SetNonBlocking(PRBool aNonBlocking) { mBlocking = !aNonBlocking; }
protected:
nsrefcnt mWriterRefCnt; // separate refcnt so that we know when to close the producer
@ -321,14 +308,18 @@ nsPipe::GetWriteSegment(char* *resultSegment,
NS_IMETHODIMP
nsPipe::nsPipeInputStream::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (aIID.Equals(NS_GET_IID(nsISearchableInputStream)))
{
nsISearchableInputStream* in = NS_STATIC_CAST(nsISearchableInputStream *, this);
NS_ADDREF(in);
*aInstancePtr = in;
return NS_OK;
}
else
if (aIID.Equals(NS_GET_IID(nsISearchableInputStream))) {
nsISearchableInputStream* in = NS_STATIC_CAST(nsISearchableInputStream *, this);
NS_ADDREF(in);
*aInstancePtr = in;
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIObservableInputStream))) {
nsIObservableInputStream* in = NS_STATIC_CAST(nsIObservableInputStream *, this);
NS_ADDREF(in);
*aInstancePtr = in;
return NS_OK;
}
return GET_INPUTSTREAM_PIPE(this)->QueryInterface(aIID, aInstancePtr);
}
@ -620,25 +611,24 @@ nsPipe::nsPipeInputStream::Search(const char *forString,
}
NS_IMETHODIMP
nsPipe::nsPipeInputStream::GetNonBlocking(PRBool *aNonBlocking)
nsPipe::nsPipeInputStream::IsNonBlocking(PRBool *aNonBlocking)
{
*aNonBlocking = !mBlocking;
return NS_OK;
}
NS_IMETHODIMP
nsPipe::nsPipeInputStream::SetNonBlocking(PRBool aNonBlocking)
{
mBlocking = !aNonBlocking;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsPipeOutputStream methods:
NS_IMETHODIMP
nsPipe::nsPipeOutputStream::QueryInterface(const nsIID& aIID, void** aInstancePtr)
{
if (aIID.Equals(NS_GET_IID(nsIObservableOutputStream))) {
nsIObservableOutputStream* out = NS_STATIC_CAST(nsIObservableOutputStream *, this);
NS_ADDREF(out);
*aInstancePtr = out;
return NS_OK;
}
return GET_OUTPUTSTREAM_PIPE(this)->QueryInterface(aIID, aInstancePtr);
}
@ -856,19 +846,12 @@ nsPipe::nsPipeOutputStream::WriteFrom(nsIInputStream* fromStream,
}
NS_IMETHODIMP
nsPipe::nsPipeOutputStream::GetNonBlocking(PRBool *aNonBlocking)
nsPipe::nsPipeOutputStream::IsNonBlocking(PRBool *aNonBlocking)
{
*aNonBlocking = !mBlocking;
return NS_OK;
}
NS_IMETHODIMP
nsPipe::nsPipeOutputStream::SetNonBlocking(PRBool aNonBlocking)
{
mBlocking = !aNonBlocking;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
#ifdef PAGE_MANAGER

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

@ -224,31 +224,10 @@ nsStorageStream::WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32
}
NS_IMETHODIMP
nsStorageStream::GetNonBlocking(PRBool *aNonBlocking)
nsStorageStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsStorageStream::SetNonBlocking(PRBool aNonBlocking)
{
NS_NOTREACHED("SetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsStorageStream::GetObserver(nsIOutputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsStorageStream::SetObserver(nsIOutputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
*aNonBlocking = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP
@ -489,24 +468,10 @@ nsStorageInputStream::ReadSegments(nsWriteSegmentFun writer, void * closure, PRU
}
NS_IMETHODIMP
nsStorageInputStream::GetNonBlocking(PRBool *aNonBlocking)
nsStorageInputStream::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsStorageInputStream::GetObserver(nsIInputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsStorageInputStream::SetObserver(nsIInputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
*aNonBlocking = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP

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

@ -77,8 +77,6 @@ class BasicStringImpl
PRUint32 aCount,
PRUint32 *aReadCount);
NS_IMETHOD ReadSegments(nsWriteSegmentFun writer, void * closure, PRUint32 count, PRUint32 *_retval) = 0;
NS_IMETHOD GetObserver(nsIInputStreamObserver * *aObserver);
NS_IMETHOD SetObserver(nsIInputStreamObserver * aObserver);
// nsIOutputStream interface
NS_IMETHOD Write(const char* aBuf,
@ -86,10 +84,7 @@ class BasicStringImpl
PRUint32 *aWriteCount);
NS_IMETHOD WriteFrom(nsIInputStream *inStr, PRUint32 count, PRUint32 *_retval);
NS_IMETHOD WriteSegments(nsReadSegmentFun reader, void * closure, PRUint32 count, PRUint32 *_retval);
NS_IMETHOD GetNonBlocking(PRBool *aNonBlocking);
NS_IMETHOD SetNonBlocking(PRBool aNonBlocking);
NS_IMETHOD GetObserver(nsIOutputStreamObserver * *aObserver);
NS_IMETHOD SetObserver(nsIOutputStreamObserver * aObserver);
NS_IMETHOD IsNonBlocking(PRBool *aNonBlocking);
public:
@ -231,20 +226,6 @@ NS_IMETHODIMP BasicStringImpl::Read(char* aBuf, PRUint32 aCount, PRUint32 *aRead
return NS_OK;
}
NS_IMETHODIMP
BasicStringImpl::GetObserver(nsIInputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
BasicStringImpl::SetObserver(nsIInputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
//----------------------------------------------------------------------------------------
NS_IMETHODIMP BasicStringImpl::Write(const char* aBuf, PRUint32 aCount, PRUint32 *aWriteCount)
//----------------------------------------------------------------------------------------
@ -280,31 +261,10 @@ BasicStringImpl::WriteSegments(nsReadSegmentFun reader, void * closure,
}
NS_IMETHODIMP
BasicStringImpl::GetNonBlocking(PRBool *aNonBlocking)
BasicStringImpl::IsNonBlocking(PRBool *aNonBlocking)
{
NS_NOTREACHED("GetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
BasicStringImpl::SetNonBlocking(PRBool aNonBlocking)
{
NS_NOTREACHED("SetNonBlocking");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
BasicStringImpl::GetObserver(nsIOutputStreamObserver * *aObserver)
{
NS_NOTREACHED("GetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
BasicStringImpl::SetObserver(nsIOutputStreamObserver * aObserver)
{
NS_NOTREACHED("SetObserver");
return NS_ERROR_NOT_IMPLEMENTED;
*aNonBlocking = PR_TRUE;
return NS_OK;
}
//----------------------------------------------------------------------------------------

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

@ -850,6 +850,20 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIObservableInputStream.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIObservableOutputStream.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsISupportsArray.idl</PATH>
@ -1343,6 +1357,16 @@
<PATH>nsIOutputStream.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIObservableInputStream.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIObservableOutputStream.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsISupportsArray.idl</PATH>
@ -2457,6 +2481,20 @@
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIObservableInputStream.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIObservableOutputStream.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsISupportsArray.idl</PATH>
@ -2950,6 +2988,16 @@
<PATH>nsIOutputStream.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIObservableInputStream.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIObservableOutputStream.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsISupportsArray.idl</PATH>
@ -3473,6 +3521,18 @@
<PATH>nsIObjectOutputStream.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIObservableInputStream.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>nsIObservableOutputStream.idl</PATH>
<PATHFORMAT>MacOS</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>headers</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>

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

@ -40,6 +40,8 @@
#include "nsIRunnable.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
#include "nsIObservableInputStream.h"
#include "nsIObservableOutputStream.h"
#include "nsIServiceManager.h"
#include "prprf.h"
#include "prinrval.h"
@ -314,9 +316,14 @@ TestPipeObserver()
rv = NS_NewPipe(&in, &out, 18, 36, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) return rv;
rv = in->SetObserver(obs);
nsCOMPtr<nsIObservableInputStream> observableIn(do_QueryInterface(in, &rv));
if (NS_FAILED(rv)) return rv;
rv = out->SetObserver(obs);
nsCOMPtr<nsIObservableInputStream> observableOut(do_QueryInterface(out, &rv));
if (NS_FAILED(rv)) return rv;
rv = observableIn->SetObserver(obs);
if (NS_FAILED(rv)) return rv;
rv = observableOut->SetObserver(obs);
if (NS_FAILED(rv)) return rv;
char buf[] = "puirt a beul: a style of Gaelic vocal music intended for dancing.";