Changeset 31332 in vbox
- Timestamp:
- Aug 3, 2010 12:38:49 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 64370
- Location:
- trunk/src/VBox/Main
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r31270 r31332 269 269 kOnMediumChanged, 270 270 kOnCPUChanged, 271 kOnCPUPriorityChanged, 271 272 kOnVRDPServerChanged, 272 273 kOnRemoteDisplayInfoChanged, … … 3809 3810 if (SUCCEEDED(rc)) 3810 3811 CONSOLE_DO_CALLBACKS2(OnCPUChanged, aCPU, aRemove); 3812 3813 LogFlowThisFunc(("Leaving rc=%#x\n", rc)); 3814 return rc; 3815 } 3816 3817 /** 3818 * Called by IInternalSessionControl::OnCPUPriorityChange(). 3819 * 3820 * @note Locks this object for writing. 3821 */ 3822 HRESULT Console::onCPUPriorityChange(ULONG aCpuPriority) 3823 { 3824 LogFlowThisFunc(("\n")); 3825 3826 AutoCaller autoCaller(this); 3827 AssertComRCReturnRC(autoCaller.rc()); 3828 3829 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 3830 3831 HRESULT rc = S_OK; 3832 3833 /* don't trigger the CPU priority change if the VM isn't running */ 3834 if (mpVM) 3835 { 3836 /* protect mpVM */ 3837 AutoVMCaller autoVMCaller(this); 3838 if (FAILED(autoVMCaller.rc())) return autoVMCaller.rc(); 3839 3840 if ( mMachineState == MachineState_Running 3841 || mMachineState == MachineState_Teleporting 3842 || mMachineState == MachineState_LiveSnapshotting 3843 ) 3844 { 3845 /* No need to call in the EMT thread. */ 3846 rc = VMR3SetCpuPriority(mpVM, aCpuPriority); 3847 } 3848 else 3849 rc = setInvalidMachineStateError(); 3850 } 3851 3852 /* notify console callbacks on success */ 3853 if (SUCCEEDED(rc)) 3854 CONSOLE_DO_CALLBACKS1(OnCPUPriorityChanged, aCpuPriority); 3811 3855 3812 3856 LogFlowThisFunc(("Leaving rc=%#x\n", rc)); -
trunk/src/VBox/Main/MachineImpl.cpp
r31313 r31332 1299 1299 STDMETHODIMP Machine::COMSETTER(CPUPriority)(ULONG aPriority) 1300 1300 { 1301 HRESULT rc = S_OK; 1302 1301 1303 /* check priority limits */ 1302 1304 if ( aPriority < 1 … … 1312 1314 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1313 1315 1314 /* Todo: must always allow changes. */ 1315 HRESULT rc = checkStateDependency(MutableStateDep); 1316 alock.release(); 1317 rc = onCPUPriorityChange(aPriority); 1318 alock.acquire(); 1316 1319 if (FAILED(rc)) return rc; 1317 1320 … … 1319 1322 mHWData.backup(); 1320 1323 mHWData->mCpuPriority = aPriority; 1324 1325 /* Save settings if online - todo why is this required?? */ 1326 if (Global::IsOnline(mData->mMachineState)) 1327 saveSettings(NULL); 1321 1328 1322 1329 return S_OK; … … 10715 10722 } 10716 10723 10724 HRESULT SessionMachine::onCPUPriorityChange(ULONG aCpuPriority) 10725 { 10726 LogFlowThisFunc(("\n")); 10727 10728 AutoCaller autoCaller(this); 10729 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 10730 10731 ComPtr<IInternalSessionControl> directControl; 10732 { 10733 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 10734 directControl = mData->mSession.mDirectControl; 10735 } 10736 10737 /* ignore notifications sent after #OnSessionEnd() is called */ 10738 if (!directControl) 10739 return S_OK; 10740 10741 return directControl->OnCPUPriorityChange(aCpuPriority); 10742 } 10743 10717 10744 /** 10718 10745 * @note Locks this object for reading. -
trunk/src/VBox/Main/SessionImpl.cpp
r31244 r31332 594 594 595 595 return mConsole->onCPUChange(aCPU, aRemove); 596 } 597 598 STDMETHODIMP Session::OnCPUPriorityChange(ULONG aCpuPriority) 599 { 600 LogFlowThisFunc(("\n")); 601 602 AutoCaller autoCaller(this); 603 AssertComRCReturn(autoCaller.rc(), autoCaller.rc()); 604 605 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 606 AssertReturn(mState == SessionState_Locked, VBOX_E_INVALID_VM_STATE); 607 AssertReturn(mType == SessionType_WriteLock, VBOX_E_INVALID_OBJECT_STATE); 608 609 return mConsole->onCPUPriorityChange(aCpuPriority); 596 610 } 597 611 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r31287 r31332 12395 12395 <interface 12396 12396 name="IInternalSessionControl" extends="$unknown" 12397 uuid=" ab161f72-e4b3-44e6-a919-2256474bda66"12397 uuid="ef059f1d-2273-4f81-9342-c152a0d2cd40" 12398 12398 internal="yes" 12399 12399 wsmap="suppress" … … 12572 12572 <param name="add" type="boolean" dir="in"> 12573 12573 <desc>Flag whether the CPU was added or removed</desc> 12574 </param> 12575 </method> 12576 12577 <method name="onCPUPriorityChange"> 12578 <desc> 12579 Notification when the CPU priority changes. 12580 </desc> 12581 <param name="priority" type="unsigned long" dir="in"> 12582 <desc>The new CPU priority value. (1-100)</desc> 12574 12583 </param> 12575 12584 </method> … … 13776 13785 <enum 13777 13786 name="VBoxEventType" 13778 uuid=" 7d695029-32b8-4855-86d3-75de9082923b">13787 uuid="2c76667e-6981-4122-a71a-cdfd6a6eb575"> 13779 13788 13780 13789 <desc> … … 13980 13989 </desc> 13981 13990 </const> 13991 <const name="OnCPUPriorityChanged" value="63"> 13992 <desc> 13993 <see>ICPUPriorityChangedEvent</see> 13994 </desc> 13995 </const> 13982 13996 <!-- Last event marker --> 13983 <const name="Last" value="6 3">13997 <const name="Last" value="64"> 13984 13998 <desc> 13985 13999 Must be last event, used for iterations and structures relying on numerical event values. … … 14673 14687 14674 14688 <interface 14689 name="ICPUPriorityChangedEvent" extends="IEvent" 14690 uuid="657fe2fe-a75a-4cb6-8cf9-072aa41e7d75" 14691 wsmap="managed" autogen="VBoxEvent" id="OnCPUPriorityChanged" 14692 > 14693 <desc> 14694 Notification when the CPU priority changes. 14695 </desc> 14696 <attribute name="priority" type="unsigned long" readonly="yes"> 14697 <desc> 14698 The new CPU priority value. (1-100) 14699 </desc> 14700 </attribute> 14701 </interface> 14702 14703 <interface 14675 14704 name="IVRDPServerChangedEvent" extends="IEvent" 14676 14705 uuid="726038B6-6279-4A7A-8037-D041693D1915" -
trunk/src/VBox/Main/include/ConsoleImpl.h
r31220 r31332 182 182 HRESULT onMediumChange(IMediumAttachment *aMediumAttachment, BOOL aForce); 183 183 HRESULT onCPUChange(ULONG aCPU, BOOL aRemove); 184 HRESULT onCPUPriorityChange(ULONG aCpuPriority); 184 185 HRESULT onVRDPServerChange(BOOL aRestart); 185 186 HRESULT onUSBControllerChange(); -
trunk/src/VBox/Main/include/MachineImpl.h
r31308 r31332 616 616 virtual HRESULT onStorageControllerChange() { return S_OK; } 617 617 virtual HRESULT onCPUChange(ULONG /* aCPU */, BOOL /* aRemove */) { return S_OK; } 618 virtual HRESULT onCPUPriorityChange(ULONG /* aCpuPriority */) { return S_OK; } 618 619 virtual HRESULT onMediumChange(IMediumAttachment * /* mediumAttachment */, BOOL /* force */) { return S_OK; } 619 620 virtual HRESULT onSharedFolderChange() { return S_OK; } … … 944 945 HRESULT onParallelPortChange(IParallelPort *parallelPort); 945 946 HRESULT onCPUChange(ULONG aCPU, BOOL aRemove); 947 HRESULT onCPUPriorityChange(ULONG aCpuPriority); 946 948 HRESULT onVRDPServerChange(BOOL aRestart); 947 949 HRESULT onUSBControllerChange(); -
trunk/src/VBox/Main/include/SessionImpl.h
r31070 r31332 90 90 STDMETHOD(OnMediumChange)(IMediumAttachment *aMediumAttachment, BOOL aForce); 91 91 STDMETHOD(OnCPUChange)(ULONG aCPU, BOOL aRemove); 92 STDMETHOD(OnCPUPriorityChange)(ULONG aCpuPriority); 92 93 STDMETHOD(OnVRDPServerChange)(BOOL aRestart); 93 94 STDMETHOD(OnUSBControllerChange)();
Note:
See TracChangeset
for help on using the changeset viewer.