VirtualBox

Changeset 67230 in vbox for trunk/src/VBox/Main/src-all


Ignore:
Timestamp:
Jun 2, 2017 11:19:20 AM (8 years ago)
Author:
vboxsync
Message:

Main/ProgressImpl: Added IPRT progress callback method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-all/ProgressImpl.cpp

    r65103 r67230  
    535535    m_pfnCancelCallback = pfnCallback;
    536536    return true;
     537}
     538
     539/**
     540 * @callback_method_impl{FNRTPROGRESS, }
     541 */
     542/*static*/ DECLCALLBACK(int) Progress::i_iprtProgressCallback(unsigned uPrecentage, void *pvUser)
     543{
     544    Progress *pThis = (Progress *)pvUser;
     545
     546    /*
     547     * Same as setCurrentOperationProgress, except we don't fail on mCompleted.
     548     */
     549    AutoWriteLock alock(pThis COMMA_LOCKVAL_SRC_POS);
     550    int vrc = VINF_SUCCESS;
     551    if (!pThis->mCompleted)
     552    {
     553        pThis->i_checkForAutomaticTimeout();
     554        if (!pThis->mCanceled)
     555            pThis->m_ulOperationPercent = RT_MIN(uPrecentage, 100);
     556        else
     557        {
     558            Assert(pThis->mCancelable);
     559            vrc = VERR_CANCELLED;
     560        }
     561    }
     562    /* else ignored */
     563    return vrc;
    537564}
    538565
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