Back to index

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

List of all members.

Public Member Functions

 nsOnStopRequestEvent (nsAsyncStreamObserver *listener, nsISupports *context, nsIRequest *request)
virtual ~nsOnStopRequestEvent ()
nsresult Init (nsresult aStatus)
NS_IMETHOD HandleEvent ()
 nsOnStopRequestEvent (nsRequestObserverProxy *proxy, nsIRequest *request, nsISupports *context)
 ~nsOnStopRequestEvent ()
void HandleEvent ()
 nsOnStopRequestEvent (nsStreamProxyBase *aProxy, nsIRequest *aRequest, nsISupports *aContext, nsresult aStatus, const PRUnichar *aStatusText)
 ~nsOnStopRequestEvent ()
NS_IMETHOD HandleEvent ()
nsresult FireEvent (nsIEventQueue *)
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 *)
static void PR_CALLBACK DestroyPLEvent (PLEvent *)
static void PR_CALLBACK HandlePLEvent (PLEvent *aEvent)
static void PR_CALLBACK DestroyPLEvent (PLEvent *aEvent)

Protected Attributes

nsresult mStatus
nsString mStatusText
PLEvent mEvent
nsCOMPtr< nsIRequestmRequest
nsCOMPtr< nsISupports > mContext
PLEvent mEvent
nsCOMPtr< nsIRequestmRequest
nsCOMPtr< nsISupports > mContext
nsAsyncStreamObservermListener
nsIRequestmRequest
nsISupports * mContext
PLEvent mEvent

Private Attributes

nsRequestObserverProxymProxy

Detailed Description

Definition at line 265 of file nsAsyncStreamListener.cpp.


Constructor & Destructor Documentation

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

Definition at line 268 of file nsAsyncStreamListener.cpp.

        : nsStreamListenerEvent(listener, request, context),
          mStatus(NS_OK) {}

Definition at line 281 of file nsAsyncStreamListener.cpp.

{
}
nsOnStopRequestEvent::nsOnStopRequestEvent ( nsRequestObserverProxy proxy,
nsIRequest request,
nsISupports *  context 
) [inline]

Definition at line 178 of file nsRequestObserverProxy.cpp.

Here is the call graph for this function:

nsOnStopRequestEvent::nsOnStopRequestEvent ( nsStreamProxyBase aProxy,
nsIRequest aRequest,
nsISupports *  aContext,
nsresult  aStatus,
const PRUnichar aStatusText 
) [inline]

Definition at line 156 of file nsStreamObserverProxy.cpp.

        : nsStreamObserverEvent(aProxy, aRequest, aContext)
        , mStatus(aStatus)
        , mStatusText(aStatusText)
    {
        MOZ_COUNT_CTOR(nsOnStopRequestEvent);
    }

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:

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

Definition at line 97 of file nsStreamObserverProxy.cpp.

{
    nsStreamObserverEvent *ev = GET_STREAM_OBSERVER_EVENT(aEvent);
    NS_ASSERTION(ev, "null event");
    delete ev;
}

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:

Definition at line 73 of file nsStreamObserverProxy.cpp.

Here is the call graph for this function:

Here is the caller 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.

void nsOnStopRequestEvent::HandleEvent ( ) [inline, virtual]

Implements nsStreamListenerEvent.

Definition at line 194 of file nsRequestObserverProxy.cpp.

    {
        nsresult rv, status = NS_OK;

        LOG(("nsOnStopRequestEvent::HandleEvent [req=%x]\n", mRequest.get()));

        nsCOMPtr<nsIRequestObserver> observer = mProxy->mObserver;
        if (!observer) {
            NS_NOTREACHED("already handled onStopRequest event (observer is null)");
            return;
        }
        // Do not allow any more events to be handled after OnStopRequest
        mProxy->mObserver = 0;

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

        LOG(("handle stopevent=%8lX\n",(long)this));
        (void) observer->OnStopRequest(mRequest, mContext, status);
    }

Implements nsStreamListenerEvent.

Definition at line 293 of file nsAsyncStreamListener.cpp.

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

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

    //
    // If the consumer returned a failure code, then pass it out in the
    // OnStopRequest(...) notification...
    //
    if (NS_SUCCEEDED(rv) && NS_FAILED(status)) {
        mStatus = status;
    }
    rv = receiver->OnStopRequest(mRequest, mContext, mStatus);
    // Call clear on the listener to make sure it's cleanup is done on the correct thread
    mListener->Clear();
    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:

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

Definition at line 86 of file nsStreamObserverProxy.cpp.

{
    nsStreamObserverEvent *ev = GET_STREAM_OBSERVER_EVENT(aEvent);
    NS_ASSERTION(ev, "null event");

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

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 286 of file nsAsyncStreamListener.cpp.

{
    mStatus = aStatus;
    return NS_OK;
}

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.

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

Definition at line 103 of file nsStreamObserverProxy.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.

PLEvent nsStreamObserverEvent::mEvent [protected, inherited]

Definition at line 100 of file nsStreamObserverProxy.h.

Definition at line 77 of file nsAsyncStreamListener.cpp.

Reimplemented from nsStreamObserverEvent.

Definition at line 176 of file nsRequestObserverProxy.cpp.

Definition at line 78 of file nsAsyncStreamListener.cpp.

Definition at line 96 of file nsRequestObserverProxy.h.

Definition at line 102 of file nsStreamObserverProxy.h.

Definition at line 278 of file nsAsyncStreamListener.cpp.

Definition at line 175 of file nsStreamObserverProxy.cpp.


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