Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
nsHttpPipeline Class Reference

#include <nsHttpPipeline.h>

Inheritance diagram for nsHttpPipeline:
Inheritance graph
[legend]
Collaboration diagram for nsHttpPipeline:
Collaboration graph
[legend]

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSAHTTPCONNECTION
NS_DECL_NSAHTTPTRANSACTION
NS_DECL_NSAHTTPSEGMENTREADER 
nsHttpPipeline ()
virtual ~nsHttpPipeline ()
nsresult AddTransaction (nsAHttpTransaction *)
virtual nsresult OnHeadersAvailable (nsAHttpTransaction *, nsHttpRequestHead *, nsHttpResponseHead *, PRBool *reset)=0
virtual nsresult ResumeSend ()=0
virtual nsresult ResumeRecv ()=0
virtual void CloseTransaction (nsAHttpTransaction *transaction, nsresult reason)=0
virtual void GetConnectionInfo (nsHttpConnectionInfo **)=0
virtual void GetSecurityInfo (nsISupports **)=0
virtual PRBool IsPersistent ()=0
virtual PRBool IsReused ()=0
virtual nsresult PushBack (const char *data, PRUint32 length)=0
virtual void SetConnection (nsAHttpConnection *)=0
virtual void GetSecurityCallbacks (nsIInterfaceRequestor **)=0
virtual void OnTransportStatus (nsresult status, PRUint64 progress)=0
virtual PRBool IsDone ()=0
virtual nsresult Status ()=0
virtual PRUint32 Available ()=0
virtual nsresult ReadSegments (nsAHttpSegmentReader *reader, PRUint32 count, PRUint32 *countRead)=0
virtual nsresult WriteSegments (nsAHttpSegmentWriter *writer, PRUint32 count, PRUint32 *countWritten)=0
virtual void Close (nsresult reason)=0
virtual nsresult OnReadSegment (const char *segment, PRUint32 count, PRUint32 *countRead)=0

Private Member Functions

nsresult FillSendBuf ()
nsAHttpTransactionRequest (PRInt32 i)
nsAHttpTransactionResponse (PRInt32 i)

Static Private Member Functions

static NS_METHOD ReadFromPipe (nsIInputStream *, void *, const char *, PRUint32, PRUint32, PRUint32 *)

Private Attributes

nsAHttpConnectionmConnection
nsVoidArray mRequestQ
nsVoidArray mResponseQ
nsresult mStatus
PRPackedBool mRequestIsPartial
PRPackedBool mResponseIsPartial
PRPackedBool mClosed
nsAHttpSegmentReadermReader
nsAHttpSegmentWritermWriter
nsCOMPtr< nsIInputStreammSendBufIn
nsCOMPtr< nsIOutputStreammSendBufOut
char * mPushBackBuf
PRUint32 mPushBackLen
PRUint32 mPushBackMax

Detailed Description

Definition at line 50 of file nsHttpPipeline.h.


Constructor & Destructor Documentation

Definition at line 108 of file nsHttpPipeline.cpp.

{
    // make sure we aren't still holding onto any transactions!
    Close(NS_ERROR_ABORT);

    if (mPushBackBuf)
        free(mPushBackBuf);
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 118 of file nsHttpPipeline.cpp.

{
    LOG(("nsHttpPipeline::AddTransaction [this=%x trans=%x]\n", this, trans));

    NS_ADDREF(trans);
    mRequestQ.AppendElement(trans);

    if (mConnection) {
        trans->SetConnection(this);

        if (mRequestQ.Count() == 1)
            mConnection->ResumeSend();
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual PRUint32 nsAHttpTransaction::Available ( ) [pure virtual, inherited]

Here is the caller graph for this function:

virtual void nsAHttpTransaction::Close ( nsresult  reason) [pure virtual, inherited]

Here is the caller graph for this function:

virtual void nsAHttpConnection::CloseTransaction ( nsAHttpTransaction transaction,
nsresult  reason 
) [pure virtual, inherited]

Here is the caller graph for this function:

Definition at line 550 of file nsHttpPipeline.cpp.

{
    // reads from request queue, moving transactions to response queue
    // when they have been completely read.

    nsresult rv;
    
    if (!mSendBufIn) {
        // allocate a single-segment pipe
        rv = NS_NewPipe(getter_AddRefs(mSendBufIn),
                        getter_AddRefs(mSendBufOut),
                        NS_HTTP_SEGMENT_SIZE,
                        NS_HTTP_SEGMENT_SIZE,
                        PR_TRUE, PR_TRUE,
                        nsIOService::gBufferCache);
        if (NS_FAILED(rv)) return rv;
    }

    PRUint32 n, avail;
    nsAHttpTransaction *trans;
    while ((trans = Request(0)) != nsnull) {
        avail = trans->Available();
        if (avail) {
            rv = trans->ReadSegments(this, avail, &n);
            if (NS_FAILED(rv)) return rv;
            
            if (n == 0) {
                LOG(("send pipe is full"));
                break;
            }
        }
        avail = trans->Available();
        if (avail == 0) {
            // move transaction from request queue to response queue
            mRequestQ.RemoveElementAt(0);
            mResponseQ.AppendElement(trans);
            mRequestIsPartial = PR_FALSE;
        }
        else
            mRequestIsPartial = PR_TRUE;
    }
    return NS_OK;
}

Here is the call graph for this function:

virtual void nsAHttpConnection::GetConnectionInfo ( nsHttpConnectionInfo **  ) [pure virtual, inherited]

Here is the caller graph for this function:

virtual void nsAHttpTransaction::GetSecurityCallbacks ( nsIInterfaceRequestor **  ) [pure virtual, inherited]
virtual void nsAHttpConnection::GetSecurityInfo ( nsISupports **  ) [pure virtual, inherited]
virtual PRBool nsAHttpTransaction::IsDone ( ) [pure virtual, inherited]

Here is the caller graph for this function:

virtual PRBool nsAHttpConnection::IsPersistent ( ) [pure virtual, inherited]

Here is the caller graph for this function:

virtual PRBool nsAHttpConnection::IsReused ( ) [pure virtual, inherited]
virtual nsresult nsAHttpConnection::OnHeadersAvailable ( nsAHttpTransaction ,
nsHttpRequestHead ,
nsHttpResponseHead ,
PRBool reset 
) [pure virtual, inherited]

Here is the caller graph for this function:

virtual nsresult nsAHttpSegmentReader::OnReadSegment ( const char *  segment,
PRUint32  count,
PRUint32 countRead 
) [pure virtual, inherited]

Here is the caller graph for this function:

virtual void nsAHttpTransaction::OnTransportStatus ( nsresult  status,
PRUint64  progress 
) [pure virtual, inherited]

Here is the caller graph for this function:

virtual nsresult nsAHttpConnection::PushBack ( const char *  data,
PRUint32  length 
) [pure virtual, inherited]

Here is the caller graph for this function:

NS_METHOD nsHttpPipeline::ReadFromPipe ( nsIInputStream stream,
void closure,
const char *  buf,
PRUint32  offset,
PRUint32  count,
PRUint32 countRead 
) [static, private]

Definition at line 377 of file nsHttpPipeline.cpp.

{
    nsHttpPipeline *self = (nsHttpPipeline *) closure;
    return self->mReader->OnReadSegment(buf, count, countRead);
}

Here is the call graph for this function:

virtual nsresult nsAHttpTransaction::ReadSegments ( nsAHttpSegmentReader reader,
PRUint32  count,
PRUint32 countRead 
) [pure virtual, inherited]

Here is the caller graph for this function:

Definition at line 72 of file nsHttpPipeline.h.

    {
        if (mRequestQ.Count() == 0)
            return nsnull;

        return (nsAHttpTransaction *) mRequestQ[i];
    }

Here is the caller graph for this function:

Definition at line 79 of file nsHttpPipeline.h.

    {
        if (mResponseQ.Count() == 0)
            return nsnull;

        return (nsAHttpTransaction *) mResponseQ[i];
    }
virtual nsresult nsAHttpConnection::ResumeRecv ( ) [pure virtual, inherited]
virtual nsresult nsAHttpConnection::ResumeSend ( ) [pure virtual, inherited]

Here is the caller graph for this function:

virtual void nsAHttpTransaction::SetConnection ( nsAHttpConnection ) [pure virtual, inherited]

Here is the caller graph for this function:

virtual nsresult nsAHttpTransaction::Status ( ) [pure virtual, inherited]

Here is the caller graph for this function:

virtual nsresult nsAHttpTransaction::WriteSegments ( nsAHttpSegmentWriter writer,
PRUint32  count,
PRUint32 countWritten 
) [pure virtual, inherited]

Here is the caller graph for this function:


Member Data Documentation

Definition at line 100 of file nsHttpPipeline.h.

Definition at line 87 of file nsHttpPipeline.h.

Definition at line 111 of file nsHttpPipeline.h.

Definition at line 112 of file nsHttpPipeline.h.

Definition at line 113 of file nsHttpPipeline.h.

Definition at line 103 of file nsHttpPipeline.h.

Definition at line 96 of file nsHttpPipeline.h.

Definition at line 88 of file nsHttpPipeline.h.

Definition at line 97 of file nsHttpPipeline.h.

Definition at line 89 of file nsHttpPipeline.h.

Definition at line 107 of file nsHttpPipeline.h.

Definition at line 108 of file nsHttpPipeline.h.

Definition at line 90 of file nsHttpPipeline.h.

Definition at line 104 of file nsHttpPipeline.h.


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