VirtualBox

Ignore:
Timestamp:
Oct 2, 2008 5:20:22 AM (16 years ago)
Author:
vboxsync
Message:

Main: IConsole::powerUpPaused for use with the debugger.

File:
1 edited

Legend:

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

    r12523 r12889  
    186186    VMPowerUpTask (Console *aConsole, Progress *aProgress)
    187187        : VMProgressTask (aConsole, aProgress, false /* aUsesVMPtr */)
    188         , mSetVMErrorCallback (NULL), mConfigConstructor (NULL) {}
     188        , mSetVMErrorCallback (NULL), mConfigConstructor (NULL), mStartPaused (false) {}
    189189
    190190    PFNVMATERROR mSetVMErrorCallback;
     
    192192    Utf8Str mSavedStateFile;
    193193    Console::SharedFolderDataMap mSharedFolders;
     194    bool mStartPaused;
    194195};
    195196
     
    621622    hrc = mVRDPServer->COMGETTER(AllowMultiConnection) (&allowMultiConnection);
    622623    AssertComRCReturn (hrc, VERR_ACCESS_DENIED);
    623    
     624
    624625    BOOL reuseSingleConnection = FALSE;
    625626    hrc = mVRDPServer->COMGETTER(ReuseSingleConnection) (&reuseSingleConnection);
     
    11911192
    11921193STDMETHODIMP Console::PowerUp (IProgress **aProgress)
     1194{
     1195    return powerUpCommon (aProgress, false /* aPaused */);
     1196}
     1197
     1198STDMETHODIMP Console::PowerUpPaused (IProgress **aProgress)
     1199{
     1200    return powerUpCommon (aProgress, true /* aPaused */);
     1201}
     1202
     1203/**
     1204 * Common worker for PowerUp and PowerUpPaused.
     1205 *
     1206 * @returns COM status code.
     1207 *
     1208 * @param   aProgress       Where to return the progress object.
     1209 * @param   aPaused         true if PowerUpPaused called.
     1210 *
     1211 * @todo move down to powerDown();
     1212 */
     1213HRESULT Console::powerUpCommon (IProgress **aProgress, bool aPaused)
    11931214{
    11941215    LogFlowThisFuncEnter();
     
    13971418    task->mConfigConstructor = configConstructor;
    13981419    task->mSharedFolders = sharedFolders;
     1420    task->mStartPaused = aPaused;
    13991421    if (mMachineState == MachineState_Saved)
    14001422        task->mSavedStateFile = savedStateFile;
     
    15441566    alock.leave();
    15451567
    1546     int vrc = VMR3Resume (mpVM);
     1568    int vrc;
     1569    if (VMR3GetState(mpVM) == VMSTATE_CREATED)
     1570        vrc = VMR3PowerOn (mpVM); /* (PowerUpPaused) */
     1571    else
     1572        vrc = VMR3Resume (mpVM);
    15471573
    15481574    HRESULT rc = VBOX_SUCCESS (vrc) ? S_OK :
     
    51615187                 *  to Running
    51625188                 */
    5163                 Assert ((that->mMachineState == MachineState_Starting &&
    5164                          aOldState == VMSTATE_CREATED) ||
    5165                         ((that->mMachineState == MachineState_Restoring ||
    5166                           that->mMachineState == MachineState_Paused) &&
    5167                          aOldState == VMSTATE_SUSPENDED));
     5189                Assert (   (   (   that->mMachineState == MachineState_Starting
     5190                                || that->mMachineState == MachineState_Paused)
     5191                            && aOldState == VMSTATE_CREATED)
     5192                        || (   (   that->mMachineState == MachineState_Restoring
     5193                                || that->mMachineState == MachineState_Paused)
     5194                            && aOldState == VMSTATE_SUSPENDED));
    51685195
    51695196                that->setMachineState (MachineState_Running);
     
    63736400                                    static_cast <VMProgressTask *> (task.get()));
    63746401
    6375                     /* Start/Resume the VM execution */
    63766402                    if (VBOX_SUCCESS (vrc))
    63776403                    {
    6378                         vrc = VMR3Resume (pVM);
    6379                         AssertRC (vrc);
     6404                        if (task->mStartPaused)
     6405                            /* done */
     6406                            console->setMachineState (MachineState_Paused);
     6407                        else
     6408                        {
     6409                            /* Start/Resume the VM execution */
     6410                            vrc = VMR3Resume (pVM);
     6411                            AssertRC (vrc);
     6412                        }
    63806413                    }
    63816414
     
    63876420                    }
    63886421                }
     6422                else if (task->mStartPaused)
     6423                    /* done */
     6424                    console->setMachineState (MachineState_Paused);
    63896425                else
    63906426                {
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