Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes
nsOnDataAvailableEvent Class Reference
Inheritance diagram for nsOnDataAvailableEvent:
Inheritance graph
[legend]
Collaboration diagram for nsOnDataAvailableEvent:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsOnDataAvailableEvent (nsAsyncStreamObserver *listener, nsIRequest *request, nsISupports *context)
virtual ~nsOnDataAvailableEvent ()
nsresult Init (nsIInputStream *aIStream, PRUint32 aSourceOffset, PRUint32 aLength)
NS_IMETHOD HandleEvent ()
 nsOnDataAvailableEvent (nsStreamListenerProxy *proxy, nsIRequest *request, nsISupports *context, nsIInputStream *source, PRUint32 offset)
 ~nsOnDataAvailableEvent ()
void HandleEvent ()
PLEventGetPLEvent ()
nsresult Fire (nsIEventQueue *aEventQ)

Static Public Member Functions

static nsARequestObserverEventFromPLEvent (PLEvent *p)

Static Protected Member Functions

static void PR_CALLBACK HandlePLEvent (PLEvent *)
static void PR_CALLBACK DestroyPLEvent (PLEvent *)
static void PR_CALLBACK HandlePLEvent (PLEvent *aEvent)
static void PR_CALLBACK DestroyPLEvent (PLEvent *aEvent)

Protected Attributes

nsIInputStreammIStream
PRUint32 mSourceOffset
PRUint32 mLength
nsStreamListenerProxymProxy
nsCOMPtr< nsIInputStreammSource
PRUint32 mOffset
PLEvent mEvent
nsCOMPtr< nsIRequestmRequest
nsCOMPtr< nsISupports > mContext
nsAsyncStreamObservermListener
nsIRequestmRequest
nsISupports * mContext
PLEvent mEvent

Detailed Description

Definition at line 365 of file nsAsyncStreamListener.cpp.


Constructor & Destructor Documentation

nsOnDataAvailableEvent::nsOnDataAvailableEvent ( nsAsyncStreamObserver listener,
nsIRequest request,
nsISupports *  context 
) [inline]

Definition at line 368 of file nsAsyncStreamListener.cpp.

        : nsStreamListenerEvent(listener, request, context),
          mIStream(nsnull), mLength(0) {}

Definition at line 384 of file nsAsyncStreamListener.cpp.

nsOnDataAvailableEvent::nsOnDataAvailableEvent ( nsStreamListenerProxy proxy,
nsIRequest request,
nsISupports *  context,
nsIInputStream source,
PRUint32  offset 
) [inline]

Definition at line 118 of file nsStreamListenerProxy.cpp.

Here is the call graph for this function:


Member Function Documentation

void PR_CALLBACK nsStreamListenerEvent::DestroyPLEvent ( PLEvent aEvent) [static, protected, inherited]

Definition at line 128 of file nsAsyncStreamListener.cpp.

{
    nsStreamListenerEvent* ev = GET_STREAM_LISTENER_EVENT(aEvent);
    NS_ASSERTION(nsnull != ev, "null event.");
    delete ev;
}

Here is the caller graph for this function:

void PR_CALLBACK nsARequestObserverEvent::DestroyPLEvent ( PLEvent plev) [static, protected, inherited]

Definition at line 119 of file nsRequestObserverProxy.cpp.

{
    nsARequestObserverEvent *ev = FromPLEvent(plev);
    NS_ASSERTION(ev, "null event");
    delete ev;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 136 of file nsAsyncStreamListener.cpp.

{
    NS_PRECONDITION(nsnull != aEventQueue, "nsIEventQueue for thread is null");

    PL_InitEvent(&mEvent,
                 nsnull,
                 (PLHandleEventProc)  nsStreamListenerEvent::HandlePLEvent,
                 (PLDestroyEventProc) nsStreamListenerEvent::DestroyPLEvent);

    return aEventQueue->PostEvent(&mEvent);
}

Here is the call graph for this function:

static nsARequestObserverEvent* nsARequestObserverEvent::FromPLEvent ( PLEvent p) [inline, static, inherited]

Definition at line 80 of file nsRequestObserverProxy.h.

        { return (nsARequestObserverEvent *)
            ( (char *) p - offsetof(nsARequestObserverEvent, mEvent) ); }

Here is the caller graph for this function:

PLEvent* nsARequestObserverEvent::GetPLEvent ( ) [inline, inherited]

Definition at line 83 of file nsRequestObserverProxy.h.

{ return &mEvent; }

Here is the caller graph for this function:

Implements nsStreamListenerEvent.

Implements nsStreamListenerEvent.

Definition at line 401 of file nsAsyncStreamListener.cpp.

{
#if defined(PR_LOGGING)
  if (!gStreamEventLog)
    gStreamEventLog = PR_NewLogModule("netlibStreamEvent");
  PR_LOG(gStreamEventLog, PR_LOG_DEBUG,
         ("netlibEvent: Handle Data [event=%x]", this));
#endif
  nsIStreamListener* receiver = (nsIStreamListener*)mListener->GetReceiver();
  if (receiver == nsnull) {
      // must have already called OnStopRequest (it clears the receiver)
      return NS_ERROR_FAILURE;
  }

  nsresult status;
  nsresult rv = mRequest->GetStatus(&status);
  NS_ASSERTION(NS_SUCCEEDED(rv), "GetStatus failed");

  //
  // Only send OnDataAvailable(... ) notifications if all previous calls
  // have succeeded...
  //
  if (NS_SUCCEEDED(rv) && NS_SUCCEEDED(status)) {
    rv = receiver->OnDataAvailable(mRequest, mContext,
                                   mIStream, mSourceOffset, mLength);
  }
  else {
    NS_WARNING("not calling OnDataAvailable");
  }
  return rv;
}

Here is the call graph for this function:

void PR_CALLBACK nsStreamListenerEvent::HandlePLEvent ( PLEvent aEvent) [static, protected, inherited]

Definition at line 108 of file nsAsyncStreamListener.cpp.

{
    nsStreamListenerEvent* ev = GET_STREAM_LISTENER_EVENT(aEvent);
    NS_ASSERTION(nsnull != ev,"null event.");

    nsresult rv = ev->HandleEvent();
    //
    // If the consumer fails, then cancel the transport.  This is necessary
    // in case where the socket transport is blocked waiting for room in the
    // pipe, but the consumer fails without consuming all the data.
    //
    // Unless the transport is cancelled, it will block forever, waiting for
    // the pipe to empty...
    //
    if (NS_FAILED(rv)) {
        nsresult cancelRv = ev->mRequest->Cancel(rv);
        NS_ASSERTION(NS_SUCCEEDED(cancelRv), "Cancel failed");
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void PR_CALLBACK nsARequestObserverEvent::HandlePLEvent ( PLEvent plev) [static, protected, inherited]

Definition at line 108 of file nsRequestObserverProxy.cpp.

{
    nsARequestObserverEvent *ev = FromPLEvent(plev);
    NS_ASSERTION(ev, "null event");

    // Pass control to the real event handler
    if (ev)
        ev->HandleEvent();
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsOnDataAvailableEvent::Init ( nsIInputStream aIStream,
PRUint32  aSourceOffset,
PRUint32  aLength 
)

Definition at line 390 of file nsAsyncStreamListener.cpp.

{
    mSourceOffset = aSourceOffset;
    mLength = aLength;
    mIStream = aIStream;
    NS_ADDREF(mIStream);
    return NS_OK;
}

Here is the call graph for this function:


Member Data Documentation

nsISupports* nsStreamListenerEvent::mContext [protected, inherited]

Definition at line 79 of file nsAsyncStreamListener.cpp.

nsCOMPtr<nsISupports> nsARequestObserverEvent::mContext [protected, inherited]

Definition at line 97 of file nsRequestObserverProxy.h.

PLEvent nsStreamListenerEvent::mEvent [protected, inherited]

Definition at line 80 of file nsAsyncStreamListener.cpp.

PLEvent nsARequestObserverEvent::mEvent [protected, inherited]

Definition at line 94 of file nsRequestObserverProxy.h.

Definition at line 379 of file nsAsyncStreamListener.cpp.

Definition at line 381 of file nsAsyncStreamListener.cpp.

Definition at line 77 of file nsAsyncStreamListener.cpp.

Definition at line 144 of file nsStreamListenerProxy.cpp.

Definition at line 142 of file nsStreamListenerProxy.cpp.

Definition at line 78 of file nsAsyncStreamListener.cpp.

Definition at line 96 of file nsRequestObserverProxy.h.

Definition at line 143 of file nsStreamListenerProxy.cpp.

Definition at line 380 of file nsAsyncStreamListener.cpp.


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