Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions
MyListener Class Reference
Inheritance diagram for MyListener:
Inheritance graph
[legend]
Collaboration diagram for MyListener:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER 
MyListener ()
virtual ~MyListener ()
NS_DECL_ISUPPORTS
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER 
MyListener ()
virtual ~MyListener ()
NS_DECL_ISUPPORTS
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER 
MyListener ()
virtual ~MyListener ()
NS_DECL_ISUPPORTS MyListener ()
virtual ~MyListener ()
NS_IMETHOD OnStartRequest (nsIRequest *req, nsISupports *ctx)
NS_IMETHOD OnDataAvailable (nsIRequest *req, nsISupports *ctx, nsIInputStream *stream, PRUint32 offset, PRUint32 count)
NS_IMETHOD OnStopRequest (nsIRequest *req, nsISupports *ctx, nsresult status)
NS_DECL_ISUPPORTS MyListener ()
virtual ~MyListener ()
NS_IMETHOD OnStartRequest (nsIRequest *req, nsISupports *ctx)
NS_IMETHOD OnDataAvailable (nsIRequest *req, nsISupports *ctx, nsIInputStream *stream, PRUint32 offset, PRUint32 count)
NS_IMETHOD OnStopRequest (nsIRequest *req, nsISupports *ctx, nsresult status)
void onDataAvailable (in nsIRequest aRequest, in nsISupports aContext, in nsIInputStream aInputStream, in unsigned long aOffset, in unsigned long aCount)
 Called when the next chunk of data (corresponding to the request) may be read without blocking the calling thread.
void onStartRequest (in nsIRequest aRequest, in nsISupports aContext)
 Called to signify the beginning of an asynchronous request.
void onStopRequest (in nsIRequest aRequest, in nsISupports aContext, in nsresult aStatusCode)
 Called to signify the end of an asynchronous request.

Detailed Description

Definition at line 25 of file TestHttp.cpp.


Constructor & Destructor Documentation

NS_DECL_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER MyListener::MyListener ( ) [inline]

Definition at line 32 of file TestHttp.cpp.

{ }
virtual MyListener::~MyListener ( ) [inline, virtual]

Definition at line 33 of file TestHttp.cpp.

{}
NS_DECL_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER MyListener::MyListener ( ) [inline]

Definition at line 169 of file TestPageLoad.cpp.

{ }
virtual MyListener::~MyListener ( ) [inline, virtual]

Definition at line 170 of file TestPageLoad.cpp.

{}
NS_DECL_ISUPPORTS NS_DECL_NSIREQUESTOBSERVER NS_DECL_NSISTREAMLISTENER MyListener::MyListener ( ) [inline]

Definition at line 66 of file TestPerf.cpp.

{ }
virtual MyListener::~MyListener ( ) [inline, virtual]

Definition at line 67 of file TestPerf.cpp.

{}

Definition at line 117 of file TestStreamChannel.cpp.

{}
virtual MyListener::~MyListener ( ) [inline, virtual]

Definition at line 118 of file TestStreamChannel.cpp.

{}

Definition at line 118 of file TestStreamPump.cpp.

{}
virtual MyListener::~MyListener ( ) [inline, virtual]

Definition at line 119 of file TestStreamPump.cpp.

{}

Member Function Documentation

void nsIStreamListener::onDataAvailable ( in nsIRequest  aRequest,
in nsISupports  aContext,
in nsIInputStream  aInputStream,
in unsigned long  aOffset,
in unsigned long  aCount 
) [inherited]

Called when the next chunk of data (corresponding to the request) may be read without blocking the calling thread.

The onDataAvailable impl must read exactly |aCount| bytes of data before returning.

Parameters:
aRequestrequest corresponding to the source of the data
aContextuser defined context
aInputStreaminput stream containing the data chunk
aOffsetNumber of bytes that were sent in previous onDataAvailable calls for this request. In other words, the sum of all previous count parameters. If that number is greater than or equal to 2^32, this parameter will be PR_UINT32_MAX (2^32 - 1).
aCountnumber of bytes available in the stream

NOTE: The aInputStream parameter must implement readSegments.

An exception thrown from onDataAvailable has the side-effect of causing the request to be canceled.

NS_IMETHODIMP MyListener::OnDataAvailable ( nsIRequest req,
nsISupports *  ctx,
nsIInputStream stream,
PRUint32  offset,
PRUint32  count 
) [inline]

Definition at line 126 of file TestStreamChannel.cpp.

    {
        LOG(("MyListener::OnDataAvailable [offset=%u count=%u]\n", offset, count));

        char buf[500];
        nsresult rv;

        while (count) {
            PRUint32 n, amt = PR_MIN(count, sizeof(buf));

            rv = stream->Read(buf, amt, &n);
            if (NS_FAILED(rv)) {
                LOG(("  read returned 0x%08x\n", rv));
                return rv;
            }

            LOG(("  read %u bytes\n", n));
            count -= n;
        }

        return NS_OK;
    }
NS_IMETHOD MyListener::OnDataAvailable ( nsIRequest req,
nsISupports *  ctx,
nsIInputStream stream,
PRUint32  offset,
PRUint32  count 
) [inline]

Definition at line 127 of file TestStreamPump.cpp.

    {
        LOG(("MyListener::OnDataAvailable [offset=%u count=%u]\n", offset, count));

        char buf[500];
        nsresult rv;

        while (count) {
            PRUint32 n, amt = PR_MIN(count, sizeof(buf));

            rv = stream->Read(buf, amt, &n);
            if (NS_FAILED(rv)) {
                LOG(("  read returned 0x%08x\n", rv));
                return rv;
            }

            fwrite(buf, n, 1, stdout);
            printf("\n");

            LOG(("  read %u bytes\n", n));
            count -= n;
        }

        return NS_OK;
    }

Here is the call graph for this function:

void nsIRequestObserver::onStartRequest ( in nsIRequest  aRequest,
in nsISupports  aContext 
) [inherited]

Called to signify the beginning of an asynchronous request.

Parameters:
aRequestrequest being observed
aContextuser defined context

An exception thrown from onStartRequest has the side-effect of causing the request to be canceled.

Here is the caller graph for this function:

NS_IMETHODIMP MyListener::OnStartRequest ( nsIRequest req,
nsISupports *  ctx 
) [inline]

Definition at line 120 of file TestStreamChannel.cpp.

    {
        LOG(("MyListener::OnStartRequest\n"));
        return NS_OK;
    }
NS_IMETHOD MyListener::OnStartRequest ( nsIRequest req,
nsISupports *  ctx 
) [inline]

Definition at line 121 of file TestStreamPump.cpp.

    {
        LOG(("MyListener::OnStartRequest\n"));
        return NS_OK;
    }
void nsIRequestObserver::onStopRequest ( in nsIRequest  aRequest,
in nsISupports  aContext,
in nsresult  aStatusCode 
) [inherited]

Called to signify the end of an asynchronous request.

This call is always preceded by a call to onStartRequest.

Parameters:
aRequestrequest being observed
aContextuser defined context
aStatusCodereason for stopping (NS_OK if completed successfully)

An exception thrown from onStopRequest is generally ignored.

Here is the caller graph for this function:

NS_IMETHODIMP MyListener::OnStopRequest ( nsIRequest req,
nsISupports *  ctx,
nsresult  status 
) [inline]

Definition at line 151 of file TestStreamChannel.cpp.

    {
        LOG(("MyListener::OnStopRequest [status=%x]\n", status));
        PostDoneEvent();
        return NS_OK;
    }

Here is the call graph for this function:

NS_IMETHOD MyListener::OnStopRequest ( nsIRequest req,
nsISupports *  ctx,
nsresult  status 
) [inline]

Definition at line 155 of file TestStreamPump.cpp.

    {
        LOG(("MyListener::OnStopRequest [status=%x]\n", status));
        PostDoneEvent();
        return NS_OK;
    }

Here is the call graph for this function:


The documentation for this class was generated from the following files: