VirtualBox

Changeset 74009 in vbox for trunk/src


Ignore:
Timestamp:
Aug 31, 2018 7:28:56 PM (6 years ago)
Author:
vboxsync
Message:

IPRT/rest: Pass the response object as a parmeter to the api emthods to make sure we avoid all unnecessary object copying. Added rest() method to the response objects so they can be reused. bugref:9167

Location:
trunk/src/VBox/Runtime/common/rest
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/rest/RTCRestClientApiBase.cpp

    r73978 r74009  
    6363
    6464
    65 void RTCRestClientApiBase::doCall(RTCRestClientRequestBase const &a_rRequest, RTHTTPMETHOD a_enmHttpMethod,
    66                                   RTCRestClientResponseBase *a_pResponse, const char *a_pszMethod)
     65int RTCRestClientApiBase::doCall(RTCRestClientRequestBase const &a_rRequest, RTHTTPMETHOD a_enmHttpMethod,
     66                                 RTCRestClientResponseBase *a_pResponse, const char *a_pszMethod)
    6767{
    6868    LogFlow(("doCall: %s %s\n", a_pszMethod, RTHttpMethodName(a_enmHttpMethod)));
     69
     70    /*
     71     * Reset the response object, allowing reuse of such.
     72     */
     73    a_pResponse->reset();
    6974
    7075    /*
     
    149154                        a_pResponse->receiveFinal();
    150155
    151                         return;
     156                        return a_pResponse->getStatus();
    152157                    }
    153158                }
     
    158163    a_pResponse->receiveComplete(rc, hHttp);
    159164    RT_NOREF_PV(a_pszMethod);
     165
     166    return a_pResponse->getStatus();
    160167}
    161168
  • trunk/src/VBox/Runtime/common/rest/RTCRestClientResponseBase.cpp

    r73995 r74009  
    8484
    8585    return *this;
     86}
     87
     88
     89void RTCRestClientResponseBase::reset()
     90{
     91    /* Return to default constructor state. */
     92    m_rcStatus = VERR_WRONG_ORDER;
     93    m_rcHttp   = VERR_NOT_AVAILABLE;
     94    if (m_pErrInfo)
     95        deleteErrInfo();
     96    m_strContentType.setNull();
    8697}
    8798
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette