VirtualBox

Changeset 35175 in vbox


Ignore:
Timestamp:
Dec 16, 2010 12:36:00 PM (14 years ago)
Author:
vboxsync
Message:

Main/Machine: rename mSnapshotData to mConsoleTaskData (together with the struct name), since in the future this will hold information for all long-term operations triggered via Console methods

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/MachineImpl.cpp

    r35124 r35175  
    1024210242    }
    1024310243
    10244     Assert(mSnapshotData.mStateFilePath.isEmpty() || !mSnapshotData.mSnapshot);
    10245     if (!mSnapshotData.mStateFilePath.isEmpty())
     10244    Assert(mConsoleTaskData.mStateFilePath.isEmpty() || !mConsoleTaskData.mSnapshot);
     10245    if (!mConsoleTaskData.mStateFilePath.isEmpty())
    1024610246    {
    1024710247        LogWarningThisFunc(("canceling failed save state request!\n"));
    1024810248        endSavingState(E_FAIL, tr("Machine terminated with pending save state!"));
    1024910249    }
    10250     else if (!mSnapshotData.mSnapshot.isNull())
     10250    else if (!mConsoleTaskData.mSnapshot.isNull())
    1025110251    {
    1025210252        LogWarningThisFunc(("canceling untaken snapshot!\n"));
     
    1025610256        rollbackMedia();
    1025710257        /* delete the saved state file (it might have been already created) */
    10258         if (mSnapshotData.mSnapshot->stateFilePath().length())
    10259             RTFileDelete(mSnapshotData.mSnapshot->stateFilePath().c_str());
    10260 
    10261         mSnapshotData.mSnapshot->uninit();
     10258        if (mConsoleTaskData.mSnapshot->stateFilePath().length())
     10259            RTFileDelete(mConsoleTaskData.mSnapshot->stateFilePath().c_str());
     10260
     10261        mConsoleTaskData.mSnapshot->uninit();
    1026210262    }
    1026310263
     
    1075210752
    1075310753    AssertReturn(    mData->mMachineState == MachineState_Paused
    10754                   && mSnapshotData.mLastState == MachineState_Null
    10755                   && mSnapshotData.mStateFilePath.isEmpty(),
     10754                  && mConsoleTaskData.mLastState == MachineState_Null
     10755                  && mConsoleTaskData.mStateFilePath.isEmpty(),
    1075610756                 E_FAIL);
    1075710757
     
    1077710777
    1077810778    /* fill in the snapshot data */
    10779     mSnapshotData.mLastState = mData->mMachineState;
    10780     mSnapshotData.mStateFilePath = stateFilePath;
    10781     mSnapshotData.mProgress = pProgress;
     10779    mConsoleTaskData.mLastState = mData->mMachineState;
     10780    mConsoleTaskData.mStateFilePath = stateFilePath;
     10781    mConsoleTaskData.mProgress = pProgress;
    1078210782
    1078310783    /* set the state to Saving (this is expected by Console::SaveState()) */
     
    1080510805    AssertReturn(    (   (SUCCEEDED(iResult) && mData->mMachineState == MachineState_Saved)
    1080610806                      || (FAILED(iResult) && mData->mMachineState == MachineState_Saving))
    10807                   && mSnapshotData.mLastState != MachineState_Null
    10808                   && !mSnapshotData.mStateFilePath.isEmpty(),
     10807                  && mConsoleTaskData.mLastState != MachineState_Null
     10808                  && !mConsoleTaskData.mStateFilePath.isEmpty(),
    1080910809                 E_FAIL);
    1081010810
     
    1081610816     */
    1081710817    if (FAILED(iResult))
    10818         setMachineState(mSnapshotData.mLastState);
     10818        setMachineState(mConsoleTaskData.mLastState);
    1081910819
    1082010820    return endSavingState(iResult, aErrMsg);
     
    1151711517    if (SUCCEEDED(aRc))
    1151811518    {
    11519         mSSData->mStateFilePath = mSnapshotData.mStateFilePath;
     11519        mSSData->mStateFilePath = mConsoleTaskData.mStateFilePath;
    1152011520
    1152111521        /* save all VM settings */
     
    1152711527    {
    1152811528        /* delete the saved state file (it might have been already created) */
    11529         RTFileDelete(mSnapshotData.mStateFilePath.c_str());
     11529        RTFileDelete(mConsoleTaskData.mStateFilePath.c_str());
    1153011530    }
    1153111531
    1153211532    /* notify the progress object about operation completion */
    11533     Assert(mSnapshotData.mProgress);
     11533    Assert(mConsoleTaskData.mProgress);
    1153411534    if (SUCCEEDED(aRc))
    11535         mSnapshotData.mProgress->notifyComplete(S_OK);
     11535        mConsoleTaskData.mProgress->notifyComplete(S_OK);
    1153611536    else
    1153711537    {
    1153811538        if (aErrMsg.length())
    11539             mSnapshotData.mProgress->notifyComplete(aRc,
     11539            mConsoleTaskData.mProgress->notifyComplete(aRc,
    1154011540                                                    COM_IIDOF(ISession),
    1154111541                                                    getComponentName(),
    1154211542                                                    aErrMsg.c_str());
    1154311543        else
    11544             mSnapshotData.mProgress->notifyComplete(aRc);
     11544            mConsoleTaskData.mProgress->notifyComplete(aRc);
    1154511545    }
    1154611546
    1154711547    /* clear out the temporary saved state data */
    11548     mSnapshotData.mLastState = MachineState_Null;
    11549     mSnapshotData.mStateFilePath.setNull();
    11550     mSnapshotData.mProgress.setNull();
     11548    mConsoleTaskData.mLastState = MachineState_Null;
     11549    mConsoleTaskData.mStateFilePath.setNull();
     11550    mConsoleTaskData.mProgress.setNull();
    1155111551
    1155211552    LogFlowThisFuncLeave();
     
    1173111731             /* ignore PoweredOff->Saving->PoweredOff transition when taking a
    1173211732              * snapshot */
    11733              && (   mSnapshotData.mSnapshot.isNull()
    11734                  || mSnapshotData.mLastState >= MachineState_Running /** @todo Live Migration: clean up (lazy bird) */
     11733             && (   mConsoleTaskData.mSnapshot.isNull()
     11734                 || mConsoleTaskData.mLastState >= MachineState_Running /** @todo Live Migration: clean up (lazy bird) */
    1173511735                )
    1173611736            )
  • trunk/src/VBox/Main/SnapshotImpl.cpp

    r35011 r35175  
    13671367                  || mData->mMachineState == MachineState_Running
    13681368                  || mData->mMachineState == MachineState_Paused, E_FAIL);
    1369     AssertReturn(mSnapshotData.mLastState == MachineState_Null, E_FAIL);
    1370     AssertReturn(mSnapshotData.mSnapshot.isNull(), E_FAIL);
     1369    AssertReturn(mConsoleTaskData.mLastState == MachineState_Null, E_FAIL);
     1370    AssertReturn(mConsoleTaskData.mSnapshot.isNull(), E_FAIL);
    13711371
    13721372    if (    !fTakingSnapshotOnline
     
    14221422
    14231423    /* fill in the snapshot data */
    1424     mSnapshotData.mLastState = mData->mMachineState;
    1425     mSnapshotData.mSnapshot = pSnapshot;
     1424    mConsoleTaskData.mLastState = mData->mMachineState;
     1425    mConsoleTaskData.mSnapshot = pSnapshot;
     1426    /// @todo in the long run the progress object should be moved to
     1427    // VBoxSVC to avoid trouble with monitoring the progress object state
     1428    // when the process where it lives is terminating shortly after the
     1429    // operation completed.
    14261430
    14271431    try
     
    14361440
    14371441        /* Console::fntTakeSnapshotWorker and friends expects this. */
    1438         if (mSnapshotData.mLastState == MachineState_Running)
     1442        if (mConsoleTaskData.mLastState == MachineState_Running)
    14391443            setMachineState(MachineState_LiveSnapshotting);
    14401444        else
     
    14491453            throw rc;
    14501454
    1451         if (mSnapshotData.mLastState == MachineState_Saved)
     1455        if (mConsoleTaskData.mLastState == MachineState_Saved)
    14521456        {
    14531457            Utf8Str stateFrom = mSSData->mStateFilePath;
    1454             Utf8Str stateTo = mSnapshotData.mSnapshot->stateFilePath();
     1458            Utf8Str stateTo = mConsoleTaskData.mSnapshot->stateFilePath();
    14551459
    14561460            LogFlowThisFunc(("Copying the execution state from '%s' to '%s'...\n",
     
    14841488    {
    14851489        LogThisFunc(("Caught %Rhrc [%s]\n", hrc, Global::stringifyMachineState(mData->mMachineState) ));
    1486         if (    mSnapshotData.mLastState != mData->mMachineState
    1487              && (   mSnapshotData.mLastState == MachineState_Running
     1490        if (    mConsoleTaskData.mLastState != mData->mMachineState
     1491             && (   mConsoleTaskData.mLastState == MachineState_Running
    14881492                  ? mData->mMachineState == MachineState_LiveSnapshotting
    14891493                  : mData->mMachineState == MachineState_Saving)
    14901494           )
    1491             setMachineState(mSnapshotData.mLastState);
     1495            setMachineState(mConsoleTaskData.mLastState);
    14921496
    14931497        pSnapshot->uninit();
    14941498        pSnapshot.setNull();
    1495         mSnapshotData.mLastState = MachineState_Null;
    1496         mSnapshotData.mSnapshot.setNull();
     1499        mConsoleTaskData.mLastState = MachineState_Null;
     1500        mConsoleTaskData.mSnapshot.setNull();
    14971501
    14981502        rc = hrc;
     
    15401544                 || (    (    mData->mMachineState == MachineState_Saving
    15411545                           || mData->mMachineState == MachineState_LiveSnapshotting)
    1542                       && mSnapshotData.mLastState != MachineState_Null
    1543                       && !mSnapshotData.mSnapshot.isNull()
     1546                      && mConsoleTaskData.mLastState != MachineState_Null
     1547                      && !mConsoleTaskData.mSnapshot.isNull()
    15441548                    )
    15451549                 , E_FAIL);
     
    15511555     * all to avoid races.
    15521556     */
    1553     if (    mData->mMachineState != mSnapshotData.mLastState
    1554          && mSnapshotData.mLastState != MachineState_Running
     1557    if (    mData->mMachineState != mConsoleTaskData.mLastState
     1558         && mConsoleTaskData.mLastState != MachineState_Running
    15551559       )
    1556         setMachineState(mSnapshotData.mLastState);
     1560        setMachineState(mConsoleTaskData.mLastState);
    15571561
    15581562    ComObjPtr<Snapshot> pOldFirstSnap = mData->mFirstSnapshot;
    15591563    ComObjPtr<Snapshot> pOldCurrentSnap = mData->mCurrentSnapshot;
    15601564
    1561     bool fOnline = Global::IsOnline(mSnapshotData.mLastState);
     1565    bool fOnline = Global::IsOnline(mConsoleTaskData.mLastState);
    15621566
    15631567    HRESULT rc = S_OK;
     
    15661570    {
    15671571        // new snapshot becomes the current one
    1568         mData->mCurrentSnapshot = mSnapshotData.mSnapshot;
     1572        mData->mCurrentSnapshot = mConsoleTaskData.mSnapshot;
    15691573
    15701574        /* memorize the first snapshot if necessary */
     
    15911595        /* inform callbacks */
    15921596        mParent->onSnapshotTaken(mData->mUuid,
    1593                                  mSnapshotData.mSnapshot->getId());
     1597                                 mConsoleTaskData.mSnapshot->getId());
    15941598    }
    15951599    else
     
    16031607
    16041608        /* delete the saved state file (it might have been already created) */
    1605         if (mSnapshotData.mSnapshot->stateFilePath().length())
    1606             RTFileDelete(mSnapshotData.mSnapshot->stateFilePath().c_str());
    1607 
    1608         mSnapshotData.mSnapshot->uninit();
     1609        if (mConsoleTaskData.mSnapshot->stateFilePath().length())
     1610            RTFileDelete(mConsoleTaskData.mSnapshot->stateFilePath().c_str());
     1611
     1612        mConsoleTaskData.mSnapshot->uninit();
    16091613    }
    16101614
    16111615    /* clear out the snapshot data */
    1612     mSnapshotData.mLastState = MachineState_Null;
    1613     mSnapshotData.mSnapshot.setNull();
     1616    mConsoleTaskData.mLastState = MachineState_Null;
     1617    mConsoleTaskData.mSnapshot.setNull();
    16141618
    16151619    // save VirtualBox.xml (media registry most probably changed with diff image);
  • trunk/src/VBox/Main/include/MachineImpl.h

    r34770 r35175  
    993993private:
    994994
    995     struct SnapshotData
    996     {
    997         SnapshotData() : mLastState(MachineState_Null) {}
     995    struct ConsoleTaskData
     996    {
     997        ConsoleTaskData() : mLastState(MachineState_Null) {}
    998998
    999999        MachineState_T mLastState;
     1000        ComObjPtr<Progress> mProgress;
    10001001
    10011002        // used when taking snapshot
    10021003        ComObjPtr<Snapshot> mSnapshot;
    10031004
    1004         // used when saving state
     1005        // used when saving state (either as part of a snapshot or separate)
    10051006        Utf8Str mStateFilePath;
    1006         ComObjPtr<Progress> mProgress;
    10071007    };
    10081008
     
    10631063    HRESULT mRemoveSavedState;
    10641064
    1065     SnapshotData mSnapshotData;
     1065    ConsoleTaskData mConsoleTaskData;
    10661066
    10671067    /** interprocess semaphore handle for this machine */
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