VirtualBox

Changeset 22624 in vbox


Ignore:
Timestamp:
Aug 31, 2009 5:32:17 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
51691
Message:

Main: cosmetics

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

Legend:

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

    r22562 r22624  
    18231823                    FALSE /* aCancelable */);
    18241824
    1825     bool beganSavingState = false;
    1826     bool taskCreationFailed = false;
     1825    bool fBeganSavingState = false;
     1826    bool fTaskCreationFailed = false;
    18271827
    18281828    do
     
    18391839        if (FAILED (rc))
    18401840        {
    1841             taskCreationFailed = true;
     1841            fTaskCreationFailed = true;
    18421842            break;
    18431843        }
     
    18531853        CheckComRCBreakRC (rc);
    18541854
    1855         beganSavingState = true;
     1855        fBeganSavingState = true;
    18561856
    18571857        /* sync the state with the server */
     
    18961896    while (0);
    18971897
    1898     if (FAILED (rc) && !taskCreationFailed)
     1898    if (FAILED (rc) && !fTaskCreationFailed)
    18991899    {
    19001900        /* preserve existing error info */
    19011901        ErrorInfoKeeper eik;
    19021902
    1903         if (beganSavingState)
     1903        if (fBeganSavingState)
    19041904        {
    19051905            /*
     
    23632363}
    23642364
    2365 STDMETHODIMP Console::TakeSnapshot (IN_BSTR aName, IN_BSTR aDescription,
    2366                                     IProgress **aProgress)
     2365STDMETHODIMP Console::TakeSnapshot(IN_BSTR aName,
     2366                                   IN_BSTR aDescription,
     2367                                   IProgress **aProgress)
    23672368{
    23682369    LogFlowThisFuncEnter();
     
    23772378    AutoWriteLock alock(this);
    23782379
    2379     if (Global::IsTransient (mMachineState))
    2380     {
    2381         return setError (VBOX_E_INVALID_VM_STATE,
    2382             tr ("Cannot take a snapshot of the machine "
    2383                 "while it is changing the state (machine state: %d)"),
    2384             mMachineState);
    2385     }
     2380    if (Global::IsTransient(mMachineState))
     2381        return setError(VBOX_E_INVALID_VM_STATE,
     2382                        tr("Cannot take a snapshot of the machine while it is changing the state (machine state: %d)"),
     2383                        mMachineState);
    23862384
    23872385    /* memorize the current machine state */
     
    23962394    HRESULT rc = S_OK;
    23972395
    2398     bool takingSnapshotOnline = mMachineState == MachineState_Paused;
     2396    bool fTakingSnapshotOnline = (mMachineState == MachineState_Paused);
    23992397
    24002398    /*
     
    24032401     */
    24042402    ComObjPtr<Progress> saveProgress;
    2405     if (takingSnapshotOnline)
     2403    if (fTakingSnapshotOnline)
    24062404    {
    24072405        saveProgress.createObject();
    2408         rc = saveProgress->init (FALSE, 1, Bstr (tr ("Saving the execution state")));
     2406        rc = saveProgress->init(FALSE, 1, Bstr(tr("Saving the execution state")));
    24092407        AssertComRCReturn (rc, rc);
    24102408    }
    24112409
    2412     bool beganTakingSnapshot = false;
    2413     bool taskCreationFailed = false;
     2410    bool fBeganTakingSnapshot = false;
     2411    bool fTaskCreationFailed = false;
    24142412
    24152413    do
    24162414    {
    24172415        /* create a task object early to ensure mpVM protection is successful */
    2418         std::auto_ptr <VMSaveTask> task;
    2419         if (takingSnapshotOnline)
    2420         {
    2421             task.reset (new VMSaveTask (this, saveProgress));
     2416        std::auto_ptr<VMSaveTask> task;
     2417        if (fTakingSnapshotOnline)
     2418        {
     2419            task.reset(new VMSaveTask(this, saveProgress));
    24222420            rc = task->rc();
    24232421            /*
     
    24292427            if (FAILED (rc))
    24302428            {
    2431                 taskCreationFailed = true;
     2429                fTaskCreationFailed = true;
    24322430                break;
    24332431            }
     
    24422440         *  others from accessing this machine)
    24432441         */
    2444         rc = mControl->BeginTakingSnapshot (this, aName, aDescription,
    2445                                             saveProgress, stateFilePath.asOutParam(),
    2446                                             serverProgress.asOutParam());
     2442        rc = mControl->BeginTakingSnapshot(this,
     2443                                           aName,
     2444                                           aDescription,
     2445                                           saveProgress,
     2446                                           stateFilePath.asOutParam(),
     2447                                           serverProgress.asOutParam());
    24472448        if (FAILED (rc))
    24482449            break;
     
    24522453         *  (i.e. creating a snapshot online)
    24532454         */
    2454         ComAssertBreak (
    2455             (!stateFilePath.isNull() && takingSnapshotOnline) ||
    2456             (stateFilePath.isNull() && !takingSnapshotOnline),
    2457             rc = E_FAIL);
    2458 
    2459         beganTakingSnapshot = true;
     2455        ComAssertBreak(    (!stateFilePath.isNull() && fTakingSnapshotOnline)
     2456                        || (stateFilePath.isNull() && !fTakingSnapshotOnline),
     2457                       rc = E_FAIL);
     2458
     2459        fBeganTakingSnapshot = true;
    24602460
    24612461        /* sync the state with the server */
    2462         setMachineStateLocally (MachineState_Saving);
     2462        setMachineStateLocally(MachineState_Saving);
    24632463
    24642464        /*
     
    24672467         */
    24682468        ComObjPtr<CombinedProgress> combinedProgress;
    2469         if (takingSnapshotOnline)
     2469        if (fTakingSnapshotOnline)
    24702470        {
    24712471            combinedProgress.createObject();
    2472             rc = combinedProgress->init (static_cast <IConsole *> (this),
    2473                                          Bstr (tr ("Taking snapshot of virtual machine")),
    2474                                          serverProgress, saveProgress);
     2472            rc = combinedProgress->init(static_cast<IConsole*>(this),
     2473                                        Bstr(tr("Taking snapshot of virtual machine")),
     2474                                        serverProgress,
     2475                                        saveProgress);
    24752476            AssertComRCBreakRC (rc);
    24762477
     
    24832484
    24842485            /* create a thread to wait until the VM state is saved */
    2485             int vrc = RTThreadCreate (NULL, Console::saveStateThread, (void *) task.get(),
    2486                                       0, RTTHREADTYPE_MAIN_WORKER, 0, "VMTakeSnap");
    2487 
    2488             ComAssertMsgRCBreak (vrc, ("Could not create VMTakeSnap thread (%Rrc)", vrc),
    2489                                  rc = E_FAIL);
     2486            int vrc = RTThreadCreate(NULL,
     2487                                     Console::saveStateThread,
     2488                                     (void*)task.get(),
     2489                                     0,
     2490                                     RTTHREADTYPE_MAIN_WORKER,
     2491                                     0,
     2492                                     "VMTakeSnap");
     2493
     2494            ComAssertMsgRCBreak(vrc,
     2495                                ("Could not create VMTakeSnap thread (%Rrc)", vrc),
     2496                                rc = E_FAIL);
    24902497
    24912498            /* task is now owned by saveStateThread(), so release it */
     
    25012508                serverProgress.queryInterfaceTo(aProgress);
    25022509        }
    2503     }
    2504     while (0);
    2505 
    2506     if (FAILED (rc) && !taskCreationFailed)
     2510    } while (0);
     2511
     2512    if (FAILED(rc) && !fTaskCreationFailed)
    25072513    {
    25082514        /* preserve existing error info */
    25092515        ErrorInfoKeeper eik;
    25102516
    2511         if (beganTakingSnapshot && takingSnapshotOnline)
     2517        if (fBeganTakingSnapshot && fTakingSnapshotOnline)
    25122518        {
    25132519            /*
     
    25172523             *  before calling mControl->BeginTakingSnapshot().
    25182524             */
    2519             mControl->EndTakingSnapshot (FALSE);
     2525            mControl->EndTakingSnapshot(FALSE);
    25202526        }
    25212527
     
    25232529        {
    25242530            /* restore the paused state if appropriate */
    2525             setMachineStateLocally (MachineState_Paused);
     2531            setMachineStateLocally(MachineState_Paused);
    25262532            /* restore the running state if appropriate */
    25272533            Resume();
    25282534        }
    25292535        else
    2530             setMachineStateLocally (lastMachineState);
     2536            setMachineStateLocally(lastMachineState);
    25312537    }
    25322538
     
    25362542}
    25372543
    2538 STDMETHODIMP Console::DiscardSnapshot (IN_BSTR aId, IProgress **aProgress)
     2544STDMETHODIMP Console::DiscardSnapshot(IN_BSTR aId, IProgress **aProgress)
    25392545{
    25402546    CheckComArgExpr(aId, Guid (aId).isEmpty() == false);
  • trunk/src/VBox/Main/HardDiskImpl.cpp

    r22195 r22624  
    25442544    AssertReturn(mm.type != HardDiskType_Writethrough, E_FAIL);
    25452545
     2546    LogFlowThisFunc(("Hard disk '%s' has media status %d\n", name().raw(), m.state));
     2547
    25462548    /* Note: MediaState_LockedWrite is ok when taking an online snapshot */
    25472549    AssertReturn(m.state == MediaState_LockedRead ||
     
    25552557    /* check that the hard disk is not attached to any VM in the current state*/
    25562558    for (BackRefList::const_iterator it = m.backRefs.begin();
    2557          it != m.backRefs.end(); ++ it)
     2559         it != m.backRefs.end();
     2560         ++it)
    25582561    {
    25592562        if (it->inCurState)
     
    25902593        {
    25912594            progress.createObject();
    2592             rc = progress->init (mVirtualBox, static_cast<IHardDisk*> (this),
    2593                 BstrFmt (tr ("Creating differencing hard disk storage unit '%ls'"),
    2594                          aTarget->m.locationFull.raw()),
    2595                 TRUE /* aCancelable */);
     2595            rc = progress->init(mVirtualBox,
     2596                                static_cast<IHardDisk*>(this),
     2597                                BstrFmt(tr("Creating differencing hard disk storage unit '%ls'"),
     2598                                           aTarget->m.locationFull.raw()),
     2599                                TRUE /* aCancelable */);
    25962600            CheckComRCReturnRC(rc);
    25972601        }
     
    26012605     * asynchronously */
    26022606
    2603     std::auto_ptr <Task> task (new Task (this, progress, Task::CreateDiff));
     2607    std::auto_ptr<Task> task(new Task(this, progress, Task::CreateDiff));
    26042608    AssertComRCReturnRC(task->autoCaller.rc());
    26052609
     
    26082612
    26092613    /* register a task (it will deregister itself when done) */
    2610     ++ mm.numCreateDiffTasks;
     2614    ++mm.numCreateDiffTasks;
    26112615    Assert (mm.numCreateDiffTasks != 0); /* overflow? */
    26122616
     
    39723976            /* deregister the task registered in createDiffStorage() */
    39733977            Assert (that->mm.numCreateDiffTasks != 0);
    3974             -- that->mm.numCreateDiffTasks;
     3978            --that->mm.numCreateDiffTasks;
    39753979
    39763980            /* Note that in sync mode, it's the caller's responsibility to
  • trunk/src/VBox/Main/MachineImpl.cpp

    r22560 r22624  
    58945894
    58955895        data.strNotificationPatterns = mHWData->mGuestPropertyNotificationPatterns;
     5896#endif /* VBOX_WITH_GUEST_PROPS defined */
    58965897    }
    58975898    catch(std::bad_alloc &)
     
    58995900        return E_OUTOFMEMORY;
    59005901    }
    5901 #endif /* VBOX_WITH_GUEST_PROPS defined */
    59025902
    59035903    AssertComRC(rc);
     
    61146114                ComObjPtr<HardDisk> hd = hda->hardDisk();
    61156115
    6116                 rc = hd->LockRead (NULL);
     6116                rc = hd->LockRead(NULL);
    61176117                CheckComRCThrowRC(rc);
    61186118
    6119                 lockedMedia.push_back (hd);
     6119                lockedMedia.push_back(hd);
    61206120            }
    61216121        }
     
    61316131         * disks and attach them */
    61326132
    6133         for (HDData::AttachmentList::const_iterator
    6134              it = atts.begin(); it != atts.end(); ++ it)
     6133        for (HDData::AttachmentList::const_iterator it = atts.begin();
     6134             it != atts.end();
     6135             ++it)
    61356136        {
    61366137            ComObjPtr<HardDiskAttachment> hda = *it;
     
    61416142            {
    61426143                /* copy the attachment as is */
    6143 
    6144                 Assert (hd->type() == HardDiskType_Writethrough);
     6144                Assert(hd->type() == HardDiskType_Writethrough);
    61456145
    61466146                rc = aProgress->setNextOperation(BstrFmt(tr("Skipping writethrough hard disk '%s'"),
     
    61496149                CheckComRCThrowRC(rc);
    61506150
    6151                 mHDData->mAttachments.push_back (hda);
     6151                mHDData->mAttachments.push_back(hda);
    61526152                continue;
    61536153            }
    61546154
    61556155            /* need a diff */
    6156 
    61576156            rc = aProgress->setNextOperation(BstrFmt(tr("Creating differencing hard disk for '%s'"),
    61586157                                                     hd->root()->name().raw()),
     
    61716170            alock.leave();
    61726171
    6173             rc = hd->createDiffStorageAndWait (diff, HardDiskVariant_Standard,
    6174                                                &aProgress);
     6172            LogFlowThisFunc(("Calling createDiffStorageAndWait() on hard disk '%s'\n", hd->root()->name().raw()));
     6173
     6174            rc = hd->createDiffStorageAndWait(diff,
     6175                                              HardDiskVariant_Standard,
     6176                                              &aProgress);
    61756177
    61766178            alock.enter();
     
    61786180            CheckComRCThrowRC(rc);
    61796181
    6180             rc = diff->attachTo (mData->mUuid);
    6181             AssertComRCThrowRC (rc);
     6182            rc = diff->attachTo(mData->mUuid);
     6183            AssertComRCThrowRC(rc);
    61826184
    61836185            /* add a new attachment */
    61846186            ComObjPtr<HardDiskAttachment> attachment;
    61856187            attachment.createObject();
    6186             rc = attachment->init (diff, hda->controller(), hda->port(),
    6187                                    hda->device(), true /* aImplicit */);
     6188            rc = attachment->init(diff,
     6189                                  hda->controller(),
     6190                                  hda->port(),
     6191                                  hda->device(),
     6192                                  true /* aImplicit */);
    61886193            CheckComRCThrowRC(rc);
    61896194
    6190             mHDData->mAttachments.push_back (attachment);
     6195            mHDData->mAttachments.push_back(attachment);
    61916196        }
    61926197    }
     
    61996204
    62006205        for (LockedMedia::const_iterator it = lockedMedia.begin();
    6201              it != lockedMedia.end(); ++ it)
    6202         {
    6203             HRESULT rc2 = (*it)->UnlockRead (NULL);
     6206             it != lockedMedia.end();
     6207             ++it)
     6208        {
     6209            HRESULT rc2 = (*it)->UnlockRead(NULL);
    62046210            AssertComRC(rc2);
    62056211        }
     
    70137019
    70147020/** Take snapshot task */
    7015 struct SessionMachine::TakeSnapshotTask : public SessionMachine::Task
    7016 {
    7017     TakeSnapshotTask (SessionMachine *m)
    7018         : Task (m, NULL) {}
    7019 
    7020     void handler() { machine->takeSnapshotHandler (*this); }
     7021struct SessionMachine::TakeSnapshotTask
     7022    : public SessionMachine::Task
     7023{
     7024    TakeSnapshotTask(SessionMachine *m)
     7025        : Task(m, NULL)
     7026    {}
     7027
     7028    void handler()
     7029    {
     7030        machine->takeSnapshotHandler(*this);
     7031    }
    70217032};
    70227033
    70237034/** Discard snapshot task */
    7024 struct SessionMachine::DiscardSnapshotTask : public SessionMachine::Task
    7025 {
    7026     DiscardSnapshotTask (SessionMachine *m, Progress *p, Snapshot *s)
    7027         : Task (m, p)
    7028         , snapshot (s) {}
     7035struct SessionMachine::DiscardSnapshotTask
     7036    : public SessionMachine::Task
     7037{
     7038    DiscardSnapshotTask(SessionMachine *m, Progress *p, Snapshot *s)
     7039        : Task (m, p),
     7040          snapshot (s)
     7041    {}
    70297042
    70307043    DiscardSnapshotTask (const Task &task, Snapshot *s)
    70317044        : Task (task)
    7032         , snapshot (s) {}
    7033 
    7034     void handler() { machine->discardSnapshotHandler (*this); }
     7045        , snapshot (s)
     7046    {}
     7047
     7048    void handler()
     7049    {
     7050        machine->discardSnapshotHandler(*this);
     7051    }
    70357052
    70367053    ComObjPtr<Snapshot> snapshot;
     
    70387055
    70397056/** Discard current state task */
    7040 struct SessionMachine::DiscardCurrentStateTask : public SessionMachine::Task
    7041 {
    7042     DiscardCurrentStateTask (SessionMachine *m, Progress *p,
    7043                              bool discardCurSnapshot)
    7044         : Task (m, p), discardCurrentSnapshot (discardCurSnapshot) {}
    7045 
    7046     void handler() { machine->discardCurrentStateHandler (*this); }
     7057struct SessionMachine::DiscardCurrentStateTask
     7058    : public SessionMachine::Task
     7059{
     7060    DiscardCurrentStateTask(SessionMachine *m, Progress *p, bool discardCurSnapshot)
     7061        : Task(m, p),
     7062          discardCurrentSnapshot(discardCurSnapshot)
     7063    {}
     7064
     7065    void handler()
     7066    {
     7067        machine->discardCurrentStateHandler(*this);
     7068    }
    70477069
    70487070    const bool discardCurrentSnapshot;
     
    70517073////////////////////////////////////////////////////////////////////////////////
    70527074
    7053 DEFINE_EMPTY_CTOR_DTOR (SessionMachine)
     7075DEFINE_EMPTY_CTOR_DTOR(SessionMachine)
    70547076
    70557077HRESULT SessionMachine::FinalConstruct()
     
    78747896 *  @note Locks mParent + this object for writing.
    78757897 */
    7876 STDMETHODIMP SessionMachine::BeginTakingSnapshot (
    7877     IConsole *aInitiator, IN_BSTR aName, IN_BSTR aDescription,
    7878     IProgress *aProgress, BSTR *aStateFilePath,
    7879     IProgress **aServerProgress)
     7898STDMETHODIMP SessionMachine::BeginTakingSnapshot(IConsole *aInitiator,
     7899                                                 IN_BSTR aName,
     7900                                                 IN_BSTR aDescription,
     7901                                                 IProgress *aProgress,
     7902                                                 BSTR *aStateFilePath,
     7903                                                 IProgress **aServerProgress)
    78807904{
    78817905    LogFlowThisFuncEnter();
     
    78927916    AutoMultiWriteLock2 alock (mParent, this);
    78937917
    7894     AssertReturn((!Global::IsOnlineOrTransient (mData->mMachineState) ||
    7895                    mData->mMachineState == MachineState_Paused) &&
    7896                   mSnapshotData.mLastState == MachineState_Null &&
    7897                   mSnapshotData.mSnapshot.isNull() &&
    7898                   mSnapshotData.mServerProgress.isNull() &&
    7899                   mSnapshotData.mCombinedProgress.isNull(),
    7900                   E_FAIL);
    7901 
    7902     bool takingSnapshotOnline = mData->mMachineState == MachineState_Paused;
    7903 
    7904     if (!takingSnapshotOnline && mData->mMachineState != MachineState_Saved)
     7918    AssertReturn(    (    !Global::IsOnlineOrTransient (mData->mMachineState)
     7919                       || mData->mMachineState == MachineState_Paused
     7920                     )
     7921                  && mSnapshotData.mLastState == MachineState_Null
     7922                  && mSnapshotData.mSnapshot.isNull()
     7923                  && mSnapshotData.mServerProgress.isNull()
     7924                  && mSnapshotData.mCombinedProgress.isNull(), E_FAIL);
     7925
     7926    bool fTakingSnapshotOnline = (mData->mMachineState == MachineState_Paused);
     7927
     7928    if (    !fTakingSnapshotOnline
     7929         && mData->mMachineState != MachineState_Saved)
    79057930    {
    79067931        /* save all current settings to ensure current changes are committed and
     
    79297954#endif
    79307955
    7931     AssertReturn(aProgress || !takingSnapshotOnline, E_FAIL);
     7956    AssertReturn(aProgress || !fTakingSnapshotOnline, E_FAIL);
    79327957
    79337958    /* create an ID for the snapshot */
     
    79377962    Bstr stateFilePath;
    79387963    /* stateFilePath is null when the machine is not online nor saved */
    7939     if (takingSnapshotOnline || mData->mMachineState == MachineState_Saved)
    7940         stateFilePath = Utf8StrFmt ("%ls%c{%RTuuid}.sav",
    7941                                     mUserData->mSnapshotFolderFull.raw(),
    7942                                     RTPATH_DELIMITER,
    7943                                     snapshotId.ptr());
     7964    if (    fTakingSnapshotOnline
     7965         || mData->mMachineState == MachineState_Saved)
     7966        stateFilePath = BstrFmt("%ls%c{%RTuuid}.sav",
     7967                                mUserData->mSnapshotFolderFull.raw(),
     7968                                RTPATH_DELIMITER,
     7969                                snapshotId.ptr());
    79447970
    79457971    /* ensure the directory for the saved state file exists */
     
    79537979    ComObjPtr<SnapshotMachine> snapshotMachine;
    79547980    snapshotMachine.createObject();
    7955     HRESULT rc = snapshotMachine->init (this, snapshotId, stateFilePath);
     7981    HRESULT rc = snapshotMachine->init(this, snapshotId, stateFilePath);
    79567982    AssertComRCReturn (rc, rc);
    79577983
    7958     Bstr progressDesc = BstrFmt (tr ("Taking snapshot of virtual machine '%ls'"),
    7959                                  mUserData->mName.raw());
    7960     Bstr firstOpDesc = Bstr (tr ("Preparing to take snapshot"));
     7984    Bstr progressDesc = BstrFmt(tr("Taking snapshot of virtual machine '%ls'"),
     7985                                mUserData->mName.raw());
     7986    Bstr firstOpDesc = Bstr(tr("Preparing to take snapshot"));
    79617987
    79627988    /* create a server-side progress object (it will be descriptionless when we
     
    79717997        if (mData->mMachineState == MachineState_Saved)
    79727998            opCount ++;
    7973         if (takingSnapshotOnline)
    7974             rc = serverProgress->init (FALSE, opCount, firstOpDesc);
     7999        if (fTakingSnapshotOnline)
     8000            rc = serverProgress->init(FALSE, opCount, firstOpDesc);
    79758001        else
    7976             rc = serverProgress->init (mParent, aInitiator, progressDesc, FALSE,
    7977                                        opCount, firstOpDesc);
     8002            rc = serverProgress->init(mParent, aInitiator, progressDesc, FALSE,
     8003                                      opCount, firstOpDesc);
    79788004        AssertComRCReturn (rc, rc);
    79798005    }
     
    79818007    /* create a combined server-side progress object when necessary */
    79828008    ComObjPtr<CombinedProgress> combinedProgress;
    7983     if (takingSnapshotOnline)
     8009    if (fTakingSnapshotOnline)
    79848010    {
    79858011        combinedProgress.createObject();
     
    80048030    /* create and start the task on a separate thread (note that it will not
    80058031     * start working until we release alock) */
    8006     TakeSnapshotTask *task = new TakeSnapshotTask (this);
    8007     int vrc = RTThreadCreate (NULL, taskHandler,
    8008                               (void *) task,
    8009                               0, RTTHREADTYPE_MAIN_WORKER, 0, "TakeSnapshot");
     8032    TakeSnapshotTask *task = new TakeSnapshotTask(this);
     8033    int vrc = RTThreadCreate(NULL,
     8034                             taskHandler,
     8035                             (void*)task,
     8036                             0,
     8037                             RTTHREADTYPE_MAIN_WORKER,
     8038                             0,
     8039                             "TakeSnapshot");
    80108040    if (RT_FAILURE(vrc))
    80118041    {
     
    80228052
    80238053    /* set the state to Saving (this is expected by Console::TakeSnapshot()) */
    8024     setMachineState (MachineState_Saving);
    8025 
    8026     if (takingSnapshotOnline)
     8054    setMachineState(MachineState_Saving);
     8055
     8056    if (fTakingSnapshotOnline)
    80278057        stateFilePath.cloneTo(aStateFilePath);
    80288058    else
     
    80388068 * @note Locks this object for writing.
    80398069 */
    8040 STDMETHODIMP SessionMachine::EndTakingSnapshot (BOOL aSuccess)
     8070STDMETHODIMP SessionMachine::EndTakingSnapshot(BOOL aSuccess)
    80418071{
    80428072    LogFlowThisFunc(("\n"));
     
    80588088     * (this is expected by Console::TakeSnapshot() and
    80598089     * Console::saveStateThread()) */
    8060     setMachineState (mSnapshotData.mLastState);
    8061 
    8062     return endTakingSnapshot (aSuccess);
     8090    setMachineState(mSnapshotData.mLastState);
     8091
     8092    return endTakingSnapshot(aSuccess);
    80638093}
    80648094
     
    89308960/**
    89318961 * Helper method to finalize taking a snapshot. Gets called to finalize the
    8932  * "take snapshot" procedure.
     8962 * "take snapshot" procedure, either from the public SessionMachine::EndTakingSnapshot()
     8963 * if taking the snapshot failed/was aborted or from the takeSnapshotHandler thread
     8964 * when taking the snapshot succeeded.
    89338965 *
    89348966 * Expected to be called after completing *all* the tasks related to taking the
     
    89398971 * @note Locks this objects for writing.
    89408972 */
    8941 HRESULT SessionMachine::endTakingSnapshot (BOOL aSuccess)
     8973HRESULT SessionMachine::endTakingSnapshot(BOOL aSuccess)
    89428974{
    89438975    LogFlowThisFuncEnter();
     
    89568988    {
    89578989        /* the server progress must be completed on success */
    8958         Assert (mSnapshotData.mServerProgress->completed());
     8990        Assert(mSnapshotData.mServerProgress->completed());
    89598991
    89608992        mData->mCurrentSnapshot = mSnapshotData.mSnapshot;
     
    89648996            mData->mFirstSnapshot = mData->mCurrentSnapshot;
    89658997
    8966         if (!Global::IsOnline (mSnapshotData.mLastState))
     8998        if (!Global::IsOnline(mSnapshotData.mLastState))
    89678999            /* the machine was powered off or saved when taking a snapshot, so
    89689000             * reset the mCurrentStateModified flag */
     
    90189050
    90199051/**
    9020  * Take snapshot task handler. Must be called only by
    9021  * TakeSnapshotTask::handler()!
     9052 * Take snapshot task handler.
     9053 * This gets called from TakeSnapshotTask::handler(), which got created by
     9054 * SnapshotMachine::BeginTakingSnapshot().
    90229055 *
    90239056 * The sole purpose of this task is to asynchronously create differencing VDIs
     
    90279060 * @note Locks this object for writing.
    90289061 */
    9029 void SessionMachine::takeSnapshotHandler (TakeSnapshotTask & /* aTask */)
     9062void SessionMachine::takeSnapshotHandler(TakeSnapshotTask & /* aTask */)
    90309063{
    90319064    LogFlowThisFuncEnter();
     
    90469079    HRESULT rc = S_OK;
    90479080
    9048     bool online = Global::IsOnline (mSnapshotData.mLastState);
     9081    bool online = Global::IsOnline(mSnapshotData.mLastState);
    90499082
    90509083    LogFlowThisFunc(("Creating differencing hard disks (online=%d)...\n",
    9051                       online));
     9084                     online));
    90529085
    90539086    mHDData.backup();
    90549087
    90559088    /* create new differencing hard disks and attach them to this machine */
    9056     rc = createImplicitDiffs (mUserData->mSnapshotFolderFull,
    9057                               mSnapshotData.mServerProgress,
    9058                               online);
    9059 
    9060     if (SUCCEEDED(rc) && mSnapshotData.mLastState == MachineState_Saved)
     9089    rc = createImplicitDiffs(mUserData->mSnapshotFolderFull,
     9090                             mSnapshotData.mServerProgress,
     9091                             online);
     9092
     9093    if (    SUCCEEDED(rc)
     9094         && mSnapshotData.mLastState == MachineState_Saved)
    90619095    {
    90629096        Utf8Str stateFrom = mSSData->mStateFilePath;
     
    90719105        /* Leave the lock before a lengthy operation (mMachineState is
    90729106         * MachineState_Saving here) */
    9073 
    90749107        alock.leave();
    90759108
     
    91019134            ErrorInfoKeeper eik;
    91029135
    9103             setMachineState (mSnapshotData.mLastState);
     9136            setMachineState(mSnapshotData.mLastState);
    91049137            updateMachineStateOnClient();
    91059138        }
    91069139
    91079140        /* finalize the progress after setting the state, for consistency */
    9108         mSnapshotData.mServerProgress->notifyComplete (rc);
    9109 
    9110         endTakingSnapshot (SUCCEEDED(rc));
     9141        mSnapshotData.mServerProgress->notifyComplete(rc);
     9142
     9143        endTakingSnapshot(SUCCEEDED(rc));
    91119144    }
    91129145    else
     
    93739406    catch (HRESULT aRC) { rc = aRC; }
    93749407
    9375     if FAILED(rc)
     9408    if (FAILED(rc))
    93769409    {
    93779410        HRESULT rc2 = S_OK;
  • trunk/src/VBox/Main/MediumImpl.cpp

    r22173 r22624  
    396396 *       in-process calls).
    397397 */
    398 STDMETHODIMP MediumBase::LockWrite (MediaState_T *aState)
     398STDMETHODIMP MediumBase::LockWrite(MediaState_T *aState)
    399399{
    400400    AutoCaller autoCaller(this);
  • trunk/src/VBox/Main/SnapshotImpl.cpp

    r22173 r22624  
    346346}
    347347
    348 STDMETHODIMP Snapshot::COMGETTER(Online) (BOOL *aOnline)
     348STDMETHODIMP Snapshot::COMGETTER(Online)(BOOL *aOnline)
    349349{
    350350    CheckComArgOutPointerValid(aOnline);
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r22562 r22624  
    42804280 */
    42814281HRESULT VirtualBox::unregisterDHCPServer(DHCPServer *aDHCPServer,
    4282                                        bool aSaveRegistry /*= true*/)
     4282                                         bool aSaveRegistry /*= true*/)
    42834283{
    42844284    AssertReturn(aDHCPServer != NULL, E_INVALIDARG);
  • trunk/src/VBox/Main/include/MachineImpl.h

    r22183 r22624  
    917917    NS_DECL_ISUPPORTS
    918918
    919     DECLARE_EMPTY_CTOR_DTOR (SessionMachine)
     919    DECLARE_EMPTY_CTOR_DTOR(SessionMachine)
    920920
    921921    HRESULT FinalConstruct();
  • trunk/src/VBox/Main/include/SnapshotImpl.h

    r22183 r22624  
    9191    // public methods only for internal purposes
    9292
    93     const Bstr &stateFilePath() const;
     93    const Bstr& stateFilePath() const;
    9494
    9595    ComObjPtr<Snapshot> parent() const
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r22305 r22624  
    7979public:
    8080
    81     typedef std::list <ComPtr<IVirtualBoxCallback> > CallbackList;
    82     typedef std::vector <ComPtr<IVirtualBoxCallback> > CallbackVector;
    83 
    84     typedef std::vector <ComObjPtr<SessionMachine> > SessionMachineVector;
    85     typedef std::vector <ComObjPtr<Machine> > MachineVector;
    86 
    87     typedef std::vector <ComPtr<IInternalSessionControl> > InternalControlVector;
     81    typedef std::list< ComPtr<IVirtualBoxCallback> > CallbackList;
     82    typedef std::vector< ComPtr<IVirtualBoxCallback> > CallbackVector;
     83
     84    typedef std::vector< ComObjPtr<SessionMachine> > SessionMachineVector;
     85    typedef std::vector< ComObjPtr<Machine> > MachineVector;
     86
     87    typedef std::vector< ComPtr<IInternalSessionControl> > InternalControlVector;
    8888
    8989    class CallbackEvent;
     
    107107    NS_DECL_ISUPPORTS
    108108
    109     /* to postpone generation of the default ctor/dtor */
     109    // to postpone generation of the default ctor/dtor
    110110    VirtualBox();
    111111    ~VirtualBox();
     
    389389    Data mData;
    390390
     391#if defined(RT_OS_WINDOWS)
     392    #define UPDATEREQARG NULL
     393    #define UPDATEREQTYPE HANDLE
     394#elif defined(RT_OS_OS2)
     395    #define UPDATEREQARG NIL_RTSEMEVENT
     396    #define UPDATEREQTYPE RTSEMEVENT
     397#elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
     398    #define UPDATEREQARG
     399    #define UPDATEREQTYPE RTSEMEVENT
     400#else
     401# error "Port me!"
     402#endif
     403
    391404    /** Client watcher thread data structure */
    392405    struct ClientWatcherData
    393406    {
    394407        ClientWatcherData()
    395 #if defined(RT_OS_WINDOWS)
    396             : mUpdateReq (NULL)
    397 #elif defined(RT_OS_OS2)
    398             : mUpdateReq (NIL_RTSEMEVENT)
    399 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    400             : mUpdateReq (NIL_RTSEMEVENT)
    401 #else
    402 # error "Port me!"
    403 #endif
    404             , mThread (NIL_RTTHREAD) {}
     408            : mUpdateReq(UPDATEREQARG),
     409              mThread(NIL_RTTHREAD)
     410        {}
    405411
    406412        // const objects not requiring locking
    407 #if defined(RT_OS_WINDOWS)
    408         const HANDLE mUpdateReq;
    409 #elif defined(RT_OS_OS2)
    410         const RTSEMEVENT mUpdateReq;
    411 #elif defined(VBOX_WITH_SYS_V_IPC_SESSION_WATCHER)
    412         const RTSEMEVENT mUpdateReq;
    413 #else
    414 # error "Port me!"
    415 #endif
     413        const UPDATEREQTYPE mUpdateReq;
    416414        const RTTHREAD mThread;
    417415
Note: See TracChangeset for help on using the changeset viewer.

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