- Timestamp:
- May 28, 2010 1:34:53 PM (15 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r29804 r29864 5233 5233 progressDesc, 5234 5234 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 } 5236 5256 5237 5257 /* setup task object and thread to carry out the operation … … 7489 7509 /* Notify the progress object of the success */ 7490 7510 task->mProgress->notifyComplete(S_OK); 7491 console->mControl->SetPowerUpInfo(NULL);7492 7511 } 7493 7512 else … … 7495 7514 /* The progress object will fetch the current error info */ 7496 7515 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 else7509 {7510 /* If it's not possible to create an IVirtualBoxErrorInfo object7511 * signal success, as not signalling anything will cause a stuck7512 * progress object in VBoxSVC. */7513 console->mControl->SetPowerUpInfo(NULL);7514 }7515 7516 7516 LogRel(("Power up failed (vrc=%Rrc, rc=%Rhrc (%#08X))\n", vrc, rc, rc)); 7517 7517 } 7518 7519 /* Notify VBoxSVC and any waiting openRemoteSession progress object. */ 7520 console->mControl->EndPowerUp(rc); 7518 7521 7519 7522 #if defined(RT_OS_WINDOWS) -
trunk/src/VBox/Main/MachineImpl.cpp
r29799 r29864 36 36 #include "MachineImpl.h" 37 37 #include "ProgressImpl.h" 38 #include "ProgressProxyImpl.h" 38 39 #include "MediumAttachmentImpl.h" 39 40 #include "MediumImpl.h" … … 5175 5176 5176 5177 AutoCaller autoCaller(this); 5177 if (FAILED(autoCaller.rc())) return autoCaller.rc(); 5178 if (FAILED(autoCaller.rc())) 5179 return autoCaller.rc(); 5178 5180 5179 5181 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); … … 5327 5329 { 5328 5330 /* Note that the progress object is finalized later */ 5331 /** @todo Consider checking mData->mSession.mProgress for cancellation 5332 * around here. */ 5329 5333 5330 5334 /* We don't reset mSession.mPid here because it is necessary for … … 5378 5382 sessionMachine->uninit(); 5379 5383 5380 LogFlowThisFunc(("rc=% 08X\n", rc));5384 LogFlowThisFunc(("rc=%Rhrc\n", rc)); 5381 5385 LogFlowThisFuncLeave(); 5382 5386 return rc; … … 5390 5394 IN_BSTR aType, 5391 5395 IN_BSTR aEnvironment, 5392 Progress *aProgress)5396 ProgressProxy *aProgress) 5393 5397 { 5394 5398 LogFlowThisFuncEnter(); … … 5613 5617 return S_OK; 5614 5618 } 5619 5615 5620 5616 5621 /** … … 9825 9830 * @note Locks this object for writing. 9826 9831 */ 9827 STDMETHODIMP SessionMachine:: SetPowerUpInfo(IVirtualBoxErrorInfo *aError)9832 STDMETHODIMP SessionMachine::BeginPowerUp(IProgress *aProgress) 9828 9833 { 9829 9834 AutoCaller autoCaller(this); … … 9832 9837 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 9833 9838 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 */ 9852 STDMETHODIMP 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); 9860 9867 mData->mSession.mProgress.setNull(); 9861 9862 return S_OK; 9863 } 9864 else 9865 return VBOX_E_INVALID_OBJECT_STATE; 9868 } 9869 return S_OK; 9866 9870 } 9867 9871 … … 10057 10061 /* Create the progress object the client will use to wait until 10058 10062 * #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. */ 10060 10066 Assert(mData->mSession.mProgress.isNull()); 10061 ComObjPtr<Progress > progress;10067 ComObjPtr<ProgressProxy> progress; 10062 10068 progress.createObject(); 10063 10069 ComPtr<IUnknown> pPeer(mPeer); 10064 10070 progress->init(mParent, pPeer, 10065 Bstr(tr("Closing session")), FALSE /* aCancelable */); 10071 Bstr(tr("Closing session")), 10072 FALSE /* aCancelable */); 10066 10073 progress.queryInterfaceTo(aProgress); 10067 10074 mData->mSession.mProgress = progress; -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r29849 r29864 57 57 #include "SharedFolderImpl.h" 58 58 #include "ProgressImpl.h" 59 #include "ProgressProxyImpl.h" 59 60 #include "HostImpl.h" 60 61 #include "USBControllerImpl.h" … … 1995 1996 1996 1997 /* create a progress object */ 1997 ComObjPtr<Progress > progress;1998 ComObjPtr<ProgressProxy> progress; 1998 1999 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 */); 2005 2009 if (SUCCEEDED(rc)) 2006 2010 { 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 } 2014 2022 } 2015 2023 … … 4489 4497 #ifdef RT_OS_WINDOWS 4490 4498 #if 0 4491 // WIP 4499 // WIP 4492 4500 int nConnections = mVirtualBox->m_vec.GetSize(); 4493 4501 for (int i=0; i<nConnections; i++) -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r29621 r29864 3750 3750 <interface 3751 3751 name="IInternalMachineControl" extends="$unknown" 3752 uuid=" 57e9a280-8d57-4331-aa31-f009f5194f52"3752 uuid="26604a54-8628-491b-a0ea-e1392a16d13b" 3753 3753 internal="yes" 3754 3754 wsmap="suppress" … … 3778 3778 </method> 3779 3779 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"/> 3789 3802 </method> 3790 3803 -
trunk/src/VBox/Main/include/MachineImpl.h
r29462 r29864 54 54 55 55 class Progress; 56 class ProgressProxy; 56 57 class Keyboard; 57 58 class Mouse; … … 125 126 126 127 /** openRemoteSession() and OnSessionEnd() progress indicator */ 127 ComObjPtr<Progress > mProgress;128 ComObjPtr<ProgressProxy> mProgress; 128 129 129 130 /** … … 622 623 HRESULT openRemoteSession(IInternalSessionControl *aControl, 623 624 IN_BSTR aType, IN_BSTR aEnvironment, 624 Progress *aProgress);625 ProgressProxy *aProgress); 625 626 HRESULT openExistingSession(IInternalSessionControl *aControl); 626 627 … … 887 888 STDMETHOD(UpdateState)(MachineState_T machineState); 888 889 STDMETHOD(GetIPCId)(BSTR *id); 889 STDMETHOD(SetPowerUpInfo)(IVirtualBoxErrorInfo *aError); 890 STDMETHOD(BeginPowerUp)(IProgress *aProgress); 891 STDMETHOD(EndPowerUp)(LONG iResult); 890 892 STDMETHOD(RunUSBDeviceFilters)(IUSBDevice *aUSBDevice, BOOL *aMatched, ULONG *aMaskedIfs); 891 893 STDMETHOD(CaptureUSBDevice)(IN_BSTR aId); -
trunk/src/VBox/Main/xpcom/server.cpp
r29385 r29864 67 67 #include <MediumFormatImpl.h> 68 68 #include <ProgressCombinedImpl.h> 69 #include <ProgressProxyImpl.h> 69 70 #include <VRDPServerImpl.h> 70 71 #include <SharedFolderImpl.h> … … 127 128 NS_DECL_CLASSINFO(CombinedProgress) 128 129 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(CombinedProgress, IProgress) 130 131 NS_DECL_CLASSINFO(ProgressProxy) 132 NS_IMPL_THREADSAFE_ISUPPORTS1_CI(ProgressProxy, IProgress) 129 133 130 134 NS_DECL_CLASSINFO(SharedFolder)
Note:
See TracChangeset
for help on using the changeset viewer.