VirtualBox

Changeset 12889 in vbox for trunk


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

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

Location:
trunk/src/VBox/Main
Files:
3 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                {
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r12668 r12889  
    42374237  <interface
    42384238     name="IConsole" extends="$unknown"
    4239      uuid="d5a1cbda-f5d7-4824-9afe-d640c94c7dcf"
     4239     uuid="3acbd337-925f-497d-a624-465c8a99ae5a"
    42404240     wsmap="managed"
    42414241     >
     
    43864386
    43874387        <see>#saveState</see>
     4388      </desc>
     4389      <param name="progress" type="IProgress" dir="return">
     4390        <desc>Progress object to track the operation completion.</desc>
     4391      </param>
     4392    </method>
     4393
     4394    <method name="powerUpPaused">
     4395      <desc>
     4396        Identical to powerUp save that the VM will enter the
     4397        <link to="MachineState::Paused"/> state, instead of
     4398        <link to="MachineState::Running"/>.
     4399
     4400        <see>#powerUp</see>
    43884401      </desc>
    43894402      <param name="progress" type="IProgress" dir="return">
  • trunk/src/VBox/Main/include/ConsoleImpl.h

    r12126 r12889  
    125125    // IConsole methods
    126126    STDMETHOD(PowerUp) (IProgress **aProgress);
     127    STDMETHOD(PowerUpPaused) (IProgress **aProgress);
    127128    STDMETHOD(PowerDown)();
    128129    STDMETHOD(Reset)();
     
    398399    HRESULT consoleInitReleaseLog (const ComPtr <IMachine> aMachine);
    399400
     401    HRESULT powerUpCommon (IProgress **aProgress, bool aPaused);
    400402    HRESULT powerDown();
    401403
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