Back to index

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

List of all members.

Public Member Functions

NS_DECL_ISUPPORTS nsAsyncResolveRequest (nsProtocolProxyService *pps, nsIURI *uri, nsIProtocolProxyCallback *callback)
void SetResult (nsresult status, nsIProxyInfo *pi)
NS_IMETHOD Cancel (nsresult reason)
nsresult DispatchCallback ()
void cancel (in nsresult aReason)
 Call this method to request that this object abort whatever operation it may be performing.

Public Attributes

PRCList link
PLHandleEventProc handler
PLDestroyEventProc destructor
voidowner
voidsynchronousResult
PRLocklock
PRCondVarcondVar
PRBool handled

Private Member Functions

void OnQueryComplete (nsresult status, const nsCString &pacString)
void DoCallback ()
 PR_STATIC_CALLBACK (void *) HandleEvent(PLEvent *ev)
 PR_STATIC_CALLBACK (void) CleanupEvent(PLEvent *ev)

Private Attributes

nsresult mStatus
nsCString mPACString
PRBool mDispatched
nsRefPtr< nsProtocolProxyServicemPPS
nsCOMPtr< nsIURImURI
nsCOMPtr
< nsIProtocolProxyCallback
mCallback
nsCOMPtr< nsIProxyInfomProxyInfo

Detailed Description

Definition at line 82 of file nsProtocolProxyService.cpp.


Constructor & Destructor Documentation

Definition at line 89 of file nsProtocolProxyService.cpp.

        : mStatus(NS_OK)
        , mDispatched(PR_FALSE)
        , mPPS(pps)
        , mURI(uri)
        , mCallback(callback)
    {
        NS_ASSERTION(mCallback, "null callback");
        PL_InitEvent(this, nsnull, HandleEvent, CleanupEvent);
    }

Here is the call graph for this function:


Member Function Documentation

void nsICancelable::cancel ( in nsresult  aReason) [inherited]

Call this method to request that this object abort whatever operation it may be performing.

Parameters:
aReasonPass a failure code to indicate the reason why this operation is being canceled. It is an error to pass a success code.

Definition at line 107 of file nsProtocolProxyService.cpp.

    {
        NS_ENSURE_ARG(NS_FAILED(reason));

        // If we've already called DoCallback then, nothing more to do.
        if (!mCallback)
            return NS_OK;

        SetResult(reason, nsnull);
        return DispatchCallback();
    }

Here is the call graph for this function:

Definition at line 119 of file nsProtocolProxyService.cpp.

    {
        if (mDispatched)  // Only need to dispatch once
            return NS_OK;

        nsCOMPtr<nsIEventQueue> eventQ;
        nsresult rv = NS_GetCurrentEventQ(getter_AddRefs(eventQ));
        if (NS_FAILED(rv))
            NS_WARNING("could not get current event queue");
        else {
            NS_ADDREF_THIS();
            rv = eventQ->PostEvent(this);
            if (NS_FAILED(rv)) {
                NS_WARNING("unable to dispatch callback event");
                PL_DestroyEvent(this);
            }
            else {
                mDispatched = PR_TRUE;
                return NS_OK;
            }
        }

        mCallback = nsnull;  // break possible reference cycle
        return rv;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsAsyncResolveRequest::DoCallback ( ) [inline, private]

Definition at line 167 of file nsProtocolProxyService.cpp.

    {
        // Generate proxy info from the PAC string if appropriate
        if (NS_SUCCEEDED(mStatus) && !mProxyInfo && !mPACString.IsEmpty())
            mPPS->ProcessPACString(mPACString, getter_AddRefs(mProxyInfo));

        // Now apply proxy filters
        if (NS_SUCCEEDED(mStatus)) {
            nsProtocolInfo info;
            mStatus = mPPS->GetProtocolInfo(mURI, &info);
            if (NS_SUCCEEDED(mStatus))
                mPPS->ApplyFilters(mURI, info, mProxyInfo);
            else
                mProxyInfo = nsnull;
        }

        mCallback->OnProxyAvailable(this, mURI, mProxyInfo, mStatus);
        mCallback = nsnull;  // in case the callback holds an owning ref to us
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsAsyncResolveRequest::OnQueryComplete ( nsresult  status,
const nsCString pacString 
) [inline, private]

Definition at line 149 of file nsProtocolProxyService.cpp.

    {
        // If we've already called DoCallback then, nothing more to do.
        if (!mCallback)
            return;

        // Provided we haven't been canceled...
        if (mStatus == NS_OK) {
            mStatus = status;
            mPACString = pacString;
        }

        // In the cancelation case, we may still have another PLEvent in
        // the queue that wants to call DoCallback.  No need to wait for
        // it, just run the callback now.
        DoCallback();
    }

Here is the call graph for this function:

Definition at line 187 of file nsProtocolProxyService.cpp.

    {
        nsAsyncResolveRequest *self =
                NS_STATIC_CAST(nsAsyncResolveRequest *, ev);
        if (self->mCallback)
            self->DoCallback();
        return nsnull;
    }

Definition at line 196 of file nsProtocolProxyService.cpp.

    {
        nsAsyncResolveRequest *self =
                NS_STATIC_CAST(nsAsyncResolveRequest *, ev);
        NS_RELEASE(self);  // balance AddRef in DispatchCallback
    }

Definition at line 101 of file nsProtocolProxyService.cpp.

Here is the caller graph for this function:


Member Data Documentation

PRCondVar * PLEvent::condVar [inherited]

Definition at line 514 of file nsIEventQueueService.idl.

Definition at line 510 of file nsIEventQueueService.idl.

PRBool PLEvent::handled [inherited]

Definition at line 515 of file nsIEventQueueService.idl.

Definition at line 509 of file nsIEventQueueService.idl.

PRCList PLEvent::link [inherited]

Definition at line 508 of file nsIEventQueueService.idl.

PRLock * PLEvent::lock [inherited]

Definition at line 513 of file nsIEventQueueService.idl.

Definition at line 211 of file nsProtocolProxyService.cpp.

Definition at line 207 of file nsProtocolProxyService.cpp.

Definition at line 206 of file nsProtocolProxyService.cpp.

Definition at line 209 of file nsProtocolProxyService.cpp.

Definition at line 212 of file nsProtocolProxyService.cpp.

Definition at line 205 of file nsProtocolProxyService.cpp.

Definition at line 210 of file nsProtocolProxyService.cpp.

void * PLEvent::owner [inherited]

Definition at line 511 of file nsIEventQueueService.idl.

Definition at line 512 of file nsIEventQueueService.idl.


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