VirtualBox

Changeset 29864 in vbox for trunk


Ignore:
Timestamp:
May 28, 2010 1:34:53 PM (15 years ago)
Author:
vboxsync
Message:

Main: Make it possible to cancel the starting of a teleporation target.

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

Legend:

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

    r29804 r29864  
    52335233                               progressDesc,
    52345234                               fTeleporterEnabled /* aCancelable */);
    5235     if (FAILED(rc)) return rc;
     5235    if (FAILED(rc))
     5236        return rc;
     5237
     5238    /* Tell VBoxSVC and Machine about the progress object so they can combine
     5239       proxy it to any openRemoteSession caller. */
     5240    rc = mControl->BeginPowerUp(powerupProgress);
     5241    if (FAILED(rc))
     5242    {
     5243        LogFlowThisFunc(("BeginPowerUp failed\n"));
     5244        return rc;
     5245    }
     5246
     5247    BOOL fCanceled;
     5248    rc = powerupProgress->COMGETTER(Canceled)(&fCanceled);
     5249    if (FAILED(rc))
     5250        return rc;
     5251    if (fCanceled)
     5252    {
     5253        LogFlowThisFunc(("Canceled in BeginPowerUp\n"));
     5254        return setError(E_FAIL, tr("Powerup was canceled"));
     5255    }
    52365256
    52375257    /* setup task object and thread to carry out the operation
     
    74897509        /* Notify the progress object of the success */
    74907510        task->mProgress->notifyComplete(S_OK);
    7491         console->mControl->SetPowerUpInfo(NULL);
    74927511    }
    74937512    else
     
    74957514        /* The progress object will fetch the current error info */
    74967515        task->mProgress->notifyComplete(rc);
    7497         ProgressErrorInfo info(task->mProgress);
    7498         ComObjPtr<VirtualBoxErrorInfo> errorInfo;
    7499         rc = errorInfo.createObject();
    7500         if (SUCCEEDED(rc))
    7501         {
    7502             errorInfo->init(info.getResultCode(),
    7503                             info.getInterfaceID(),
    7504                             info.getComponent(),
    7505                             info.getText());
    7506             console->mControl->SetPowerUpInfo(errorInfo);
    7507         }
    7508         else
    7509         {
    7510             /* If it's not possible to create an IVirtualBoxErrorInfo object
    7511              * signal success, as not signalling anything will cause a stuck
    7512              * progress object in VBoxSVC. */
    7513             console->mControl->SetPowerUpInfo(NULL);
    7514         }
    7515 
    75167516        LogRel(("Power up failed (vrc=%Rrc, rc=%Rhrc (%#08X))\n", vrc, rc, rc));
    75177517    }
     7518
     7519    /* Notify VBoxSVC and any waiting openRemoteSession progress object. */
     7520    console->mControl->EndPowerUp(rc);
    75187521
    75197522#if defined(RT_OS_WINDOWS)
  • trunk/src/VBox/Main/MachineImpl.cpp

    r29799 r29864  
    3636#include "MachineImpl.h"
    3737#include "ProgressImpl.h"
     38#include "ProgressProxyImpl.h"
    3839#include "MediumAttachmentImpl.h"
    3940#include "MediumImpl.h"
     
    51755176
    51765177    AutoCaller autoCaller(this);
    5177     if (FAILED(autoCaller.rc())) return autoCaller.rc();
     5178    if (FAILED(autoCaller.rc()))
     5179        return autoCaller.rc();
    51785180
    51795181    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    53275329    {
    53285330        /* Note that the progress object is finalized later */
     5331        /** @todo Consider checking mData->mSession.mProgress for cancellation
     5332         *        around here.  */
    53295333
    53305334        /* We don't reset mSession.mPid here because it is necessary for
     
    53785382        sessionMachine->uninit();
    53795383
    5380     LogFlowThisFunc(("rc=%08X\n", rc));
     5384    LogFlowThisFunc(("rc=%Rhrc\n", rc));
    53815385    LogFlowThisFuncLeave();
    53825386    return rc;
     
    53905394                                   IN_BSTR aType,
    53915395                                   IN_BSTR aEnvironment,
    5392                                    Progress *aProgress)
     5396                                   ProgressProxy *aProgress)
    53935397{
    53945398    LogFlowThisFuncEnter();
     
    56135617    return S_OK;
    56145618}
     5619
    56155620
    56165621/**
     
    98259830 *  @note Locks this object for writing.
    98269831 */
    9827 STDMETHODIMP SessionMachine::SetPowerUpInfo(IVirtualBoxErrorInfo *aError)
     9832STDMETHODIMP SessionMachine::BeginPowerUp(IProgress *aProgress)
    98289833{
    98299834    AutoCaller autoCaller(this);
     
    98329837    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    98339838
    9834     if (   mData->mSession.mState == SessionState_Open
    9835         && mData->mSession.mProgress)
    9836     {
    9837         /* Finalize the progress, since the remote session has completed
    9838          * power on (successful or not). */
    9839         if (aError)
    9840         {
    9841             /* Transfer error information immediately, as the
    9842              * IVirtualBoxErrorInfo object is most likely transient. */
    9843             HRESULT rc;
    9844             LONG rRc = S_OK;
    9845             rc = aError->COMGETTER(ResultCode)(&rRc);
    9846             AssertComRCReturnRC(rc);
    9847             Bstr rIID;
    9848             rc = aError->COMGETTER(InterfaceID)(rIID.asOutParam());
    9849             AssertComRCReturnRC(rc);
    9850             Bstr rComponent;
    9851             rc = aError->COMGETTER(Component)(rComponent.asOutParam());
    9852             AssertComRCReturnRC(rc);
    9853             Bstr rText;
    9854             rc = aError->COMGETTER(Text)(rText.asOutParam());
    9855             AssertComRCReturnRC(rc);
    9856             mData->mSession.mProgress->notifyComplete(rRc, Guid(rIID), rComponent, Utf8Str(rText).raw());
    9857         }
    9858         else
    9859             mData->mSession.mProgress->notifyComplete(S_OK);
     9839    if (mData->mSession.mState != SessionState_Open)
     9840        return VBOX_E_INVALID_OBJECT_STATE;
     9841
     9842    if (!mData->mSession.mProgress.isNull())
     9843        mData->mSession.mProgress->setOtherProgressObject(aProgress, 7);
     9844
     9845    return S_OK;
     9846}
     9847
     9848
     9849/**
     9850 *  @note Locks this object for writing.
     9851 */
     9852STDMETHODIMP SessionMachine::EndPowerUp(LONG iResult)
     9853{
     9854    AutoCaller autoCaller(this);
     9855    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
     9856
     9857    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     9858
     9859    if (mData->mSession.mState != SessionState_Open)
     9860        return VBOX_E_INVALID_OBJECT_STATE;
     9861
     9862    /* Finalize the openRemoteSession progress object. */
     9863    if (mData->mSession.mProgress)
     9864    {
     9865        mData->mSession.mProgress->clearOtherProgressObject(tr("Finalizing"), 1);
     9866        mData->mSession.mProgress->notifyComplete((HRESULT)iResult);
    98609867        mData->mSession.mProgress.setNull();
    9861 
    9862         return S_OK;
    9863     }
    9864     else
    9865         return VBOX_E_INVALID_OBJECT_STATE;
     9868    }
     9869    return S_OK;
    98669870}
    98679871
     
    1005710061        /*  Create the progress object the client will use to wait until
    1005810062         * #checkForDeath() is called to uninitialize this session object after
    10059          * it releases the IPC semaphore. */
     10063         * it releases the IPC semaphore.
     10064         * Note! Because we're "reusing" mProgress here, this must be a proxy
     10065         *       object just like for openRemoteSession. */
    1006010066        Assert(mData->mSession.mProgress.isNull());
    10061         ComObjPtr<Progress> progress;
     10067        ComObjPtr<ProgressProxy> progress;
    1006210068        progress.createObject();
    1006310069        ComPtr<IUnknown> pPeer(mPeer);
    1006410070        progress->init(mParent, pPeer,
    10065                        Bstr(tr("Closing session")), FALSE /* aCancelable */);
     10071                       Bstr(tr("Closing session")),
     10072                       FALSE /* aCancelable */);
    1006610073        progress.queryInterfaceTo(aProgress);
    1006710074        mData->mSession.mProgress = progress;
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r29849 r29864  
    5757#include "SharedFolderImpl.h"
    5858#include "ProgressImpl.h"
     59#include "ProgressProxyImpl.h"
    5960#include "HostImpl.h"
    6061#include "USBControllerImpl.h"
     
    19951996
    19961997    /* create a progress object */
    1997     ComObjPtr<Progress> progress;
     1998    ComObjPtr<ProgressProxy> progress;
    19981999    progress.createObject();
    1999     progress->init(this, static_cast <IMachine *>(machine),
    2000                    Bstr(tr("Spawning session")),
    2001                    FALSE /* aCancelable */);
    2002 
    2003     rc = machine->openRemoteSession(control, aType, aEnvironment, progress);
    2004 
     2000    rc = progress->init(this,
     2001                        static_cast <IMachine *>(machine),
     2002                        Bstr(tr("Spawning session")),
     2003                        TRUE /* aCancelable */,
     2004                        1 /* cOtherProgressObjects */,
     2005                        10 /* uTotalOperationsWeight */,
     2006                        Bstr(tr("Spawning session")),
     2007                        3 /* uFirstOperationWeight */,
     2008                        NULL /* pId */);
    20052009    if (SUCCEEDED(rc))
    20062010    {
    2007         progress.queryInterfaceTo(aProgress);
    2008 
    2009         /* signal the client watcher thread */
    2010         updateClientWatcher();
    2011 
    2012         /* fire an event */
    2013         onSessionStateChange(id, SessionState_Spawning);
     2011        rc = machine->openRemoteSession(control, aType, aEnvironment, progress);
     2012        if (SUCCEEDED(rc))
     2013        {
     2014            progress.queryInterfaceTo(aProgress);
     2015
     2016            /* signal the client watcher thread */
     2017            updateClientWatcher();
     2018
     2019            /* fire an event */
     2020            onSessionStateChange(id, SessionState_Spawning);
     2021        }
    20142022    }
    20152023
     
    44894497#ifdef RT_OS_WINDOWS
    44904498#if 0
    4491     // WIP 
     4499    // WIP
    44924500    int nConnections = mVirtualBox->m_vec.GetSize();
    44934501    for (int i=0; i<nConnections; i++)
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r29621 r29864  
    37503750  <interface
    37513751     name="IInternalMachineControl" extends="$unknown"
    3752      uuid="57e9a280-8d57-4331-aa31-f009f5194f52"
     3752     uuid="26604a54-8628-491b-a0ea-e1392a16d13b"
    37533753     internal="yes"
    37543754     wsmap="suppress"
     
    37783778    </method>
    37793779
    3780     <method name="setPowerUpInfo">
    3781       <desc>
    3782         Transfers success (@c null) or error information for this session.
    3783         This method updates the progress object to signal completion of the
    3784         <link to="IVirtualBox::openRemoteSession"/> method if appropriate,
    3785         which means that the progress object returned by
    3786         <link to="IConsole::powerUp"/>.
    3787       </desc>
    3788       <param name="error" type="IVirtualBoxErrorInfo" dir="in"/>
     3780    <method name="beginPowerUp">
     3781      <desc>
     3782        Tells VBoxSVC that <link to="IConsole::powerUp"/> is under ways and
     3783        gives it the progress object that should be part of any pending
     3784        <link to="IVirtualBox::openRemoteSession"/> operations.  The progress
     3785        object may be called back to reflect an early cancelation, so some care
     3786        have to be taken with respect to any cancelation callbacks. The console
     3787        object will call <link to="IInternalMachineControl::endPowerUp"/>
     3788        to signal the completion of the progress object.
     3789      </desc>
     3790      <param name="progress" type="IProgress" dir="in"/>
     3791    </method>
     3792
     3793    <method name="endPowerUp">
     3794      <desc>
     3795        Tells VBoxSVC that <link to="IConsole::powerUp"/> has completed.
     3796        This method may query status information from the progress object it
     3797        received in <link to="IInternalMachineControl::beginPowerUp"/> and copy
     3798        it over to any in progress <link to="IVirtualBox::openRemoteSession"/>
     3799        call in order to complete that progress object.
     3800      </desc>
     3801      <param name="result" type="long" dir="in"/>
    37893802    </method>
    37903803
  • trunk/src/VBox/Main/include/MachineImpl.h

    r29462 r29864  
    5454
    5555class Progress;
     56class ProgressProxy;
    5657class Keyboard;
    5758class Mouse;
     
    125126
    126127            /** openRemoteSession() and OnSessionEnd() progress indicator */
    127             ComObjPtr<Progress> mProgress;
     128            ComObjPtr<ProgressProxy> mProgress;
    128129
    129130            /**
     
    622623    HRESULT openRemoteSession(IInternalSessionControl *aControl,
    623624                              IN_BSTR aType, IN_BSTR aEnvironment,
    624                               Progress *aProgress);
     625                              ProgressProxy *aProgress);
    625626    HRESULT openExistingSession(IInternalSessionControl *aControl);
    626627
     
    887888    STDMETHOD(UpdateState)(MachineState_T machineState);
    888889    STDMETHOD(GetIPCId)(BSTR *id);
    889     STDMETHOD(SetPowerUpInfo)(IVirtualBoxErrorInfo *aError);
     890    STDMETHOD(BeginPowerUp)(IProgress *aProgress);
     891    STDMETHOD(EndPowerUp)(LONG iResult);
    890892    STDMETHOD(RunUSBDeviceFilters)(IUSBDevice *aUSBDevice, BOOL *aMatched, ULONG *aMaskedIfs);
    891893    STDMETHOD(CaptureUSBDevice)(IN_BSTR aId);
  • trunk/src/VBox/Main/xpcom/server.cpp

    r29385 r29864  
    6767#include <MediumFormatImpl.h>
    6868#include <ProgressCombinedImpl.h>
     69#include <ProgressProxyImpl.h>
    6970#include <VRDPServerImpl.h>
    7071#include <SharedFolderImpl.h>
     
    127128NS_DECL_CLASSINFO(CombinedProgress)
    128129NS_IMPL_THREADSAFE_ISUPPORTS1_CI(CombinedProgress, IProgress)
     130
     131NS_DECL_CLASSINFO(ProgressProxy)
     132NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ProgressProxy, IProgress)
    129133
    130134NS_DECL_CLASSINFO(SharedFolder)
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