- Timestamp:
- Oct 19, 2007 4:47:52 PM (17 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl.cpp
r5272 r5390 1784 1784 LogFlowThisFuncLeave(); 1785 1785 return rc; 1786 } 1787 1788 STDMETHODIMP Console::AdoptSavedState (INPTR BSTR aSavedStateFile) 1789 { 1790 if (!aSavedStateFile) 1791 return E_INVALIDARG; 1792 1793 AutoCaller autoCaller (this); 1794 CheckComRCReturnRC (autoCaller.rc()); 1795 1796 AutoLock alock (this); 1797 1798 if (mMachineState != MachineState_PoweredOff && 1799 mMachineState != MachineState_Aborted) 1800 return setError (E_FAIL, 1801 tr ("Cannot adopt the saved machine state as the machine is " 1802 "not in Powered Off or Aborted state (machine state: %d)"), 1803 mMachineState); 1804 1805 return mControl->AdoptSavedState (aSavedStateFile); 1786 1806 } 1787 1807 -
trunk/src/VBox/Main/MachineImpl.cpp
r5361 r5390 6874 6874 { 6875 6875 if (mSSData->mStateFilePath) 6876 CFGLDRSetBSTR (machineNode, "stateFile", mSSData->mStateFilePath); 6876 { 6877 /* try to make the file name relative to the settings file dir */ 6878 Utf8Str stateFilePath = mSSData->mStateFilePath; 6879 calculateRelativePath (stateFilePath, stateFilePath); 6880 CFGLDRSetString (machineNode, "stateFile", stateFilePath); 6881 } 6877 6882 else 6878 6883 CFGLDRDeleteAttribute (machineNode, "stateFile"); … … 8728 8733 8729 8734 /** 8735 * @note Locks this objects for writing. 8736 */ 8737 STDMETHODIMP SessionMachine::AdoptSavedState (INPTR BSTR aSavedStateFile) 8738 { 8739 LogFlowThisFunc (("\n")); 8740 8741 AssertReturn (aSavedStateFile, E_INVALIDARG); 8742 8743 AutoCaller autoCaller (this); 8744 AssertComRCReturn (autoCaller.rc(), autoCaller.rc()); 8745 8746 AutoLock alock (this); 8747 8748 AssertReturn (mData->mMachineState == MachineState_PoweredOff || 8749 mData->mMachineState == MachineState_Aborted, 8750 E_FAIL); 8751 8752 Utf8Str stateFilePathFull = aSavedStateFile; 8753 int vrc = calculateFullPath (stateFilePathFull, stateFilePathFull); 8754 if (VBOX_FAILURE (vrc)) 8755 return setError (E_FAIL, 8756 tr ("Invalid saved state file path: '%ls' (%Vrc)"), 8757 aSavedStateFile, vrc); 8758 8759 mSSData->mStateFilePath = stateFilePathFull; 8760 8761 /* The below setMachineState() will detect the state transition and will 8762 * update the settings file */ 8763 8764 return setMachineState (MachineState_Saved); 8765 } 8766 8767 /** 8730 8768 * @note Locks mParent + this objects for writing. 8731 8769 */ … … 10543 10581 aMachineState == MachineState_Saved) 10544 10582 { 10583 /* the machine has stopped execution 10584 * (or the saved state file was adopted) */ 10545 10585 stsFlags |= SaveSTS_StateTimeStamp; 10586 } 10587 10588 if ((oldMachineState == MachineState_PoweredOff || 10589 oldMachineState == MachineState_Aborted) && 10590 aMachineState == MachineState_Saved) 10591 { 10592 /* the saved state file was adopted */ 10593 Assert (!mSSData->mStateFilePath.isNull()); 10594 stsFlags |= SaveSTS_StateFilePath; 10546 10595 } 10547 10596 -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r5292 r5390 2020 2020 2021 2021 /** 2022 * Registers a new client callback on this instance. The methods of the2023 * callback interface will be called by this instance when the appropriate2024 * event occurs.2025 *2026 2022 * @note Locks this object for writing. 2027 2023 */ 2028 STDMETHODIMP VirtualBox::RegisterCallback (IVirtualBoxCallback * callback)2029 { 2030 LogFlow Member (("VirtualBox::RegisterCallback(): callback=%p\n", callback));2031 2032 if (! callback)2024 STDMETHODIMP VirtualBox::RegisterCallback (IVirtualBoxCallback *aCallback) 2025 { 2026 LogFlowThisFunc (("aCallback=%p\n", aCallback)); 2027 2028 if (!aCallback) 2033 2029 return E_INVALIDARG; 2034 2030 … … 2037 2033 2038 2034 AutoLock alock (this); 2039 mData.mCallbacks.push_back (CallbackList::value_type ( callback));2035 mData.mCallbacks.push_back (CallbackList::value_type (aCallback)); 2040 2036 2041 2037 return S_OK; … … 2043 2039 2044 2040 /** 2045 * Unregisters the previously registered client callback.2046 *2047 2041 * @note Locks this object for writing. 2048 2042 */ 2049 STDMETHODIMP VirtualBox::UnregisterCallback (IVirtualBoxCallback * callback)2050 { 2051 if (! callback)2043 STDMETHODIMP VirtualBox::UnregisterCallback (IVirtualBoxCallback *aCallback) 2044 { 2045 if (!aCallback) 2052 2046 return E_INVALIDARG; 2053 2047 … … 2062 2056 it = std::find (mData.mCallbacks.begin(), 2063 2057 mData.mCallbacks.end(), 2064 CallbackList::value_type ( callback));2058 CallbackList::value_type (aCallback)); 2065 2059 if (it == mData.mCallbacks.end()) 2066 2060 rc = E_INVALIDARG; … … 2068 2062 mData.mCallbacks.erase (it); 2069 2063 2070 LogFlowMember (("VirtualBox::UnregisterCallback(): callback=%p, rc=%08X\n", 2071 callback, rc)); 2072 return rc; 2064 LogFlowThisFunc (("aCallback=%p, rc=%08X\n", aCallback, rc)); 2065 return rc; 2066 } 2067 2068 STDMETHODIMP VirtualBox::WaitForPropertyChange (INPTR BSTR aWhat, ULONG aTimeout, 2069 BSTR *aChanged, BSTR *aValues) 2070 { 2071 return E_NOTIMPL; 2073 2072 } 2074 2073 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r5385 r5390 809 809 <interface 810 810 name="IVirtualBox" extends="$dispatched" 811 uuid=" e1606565-8954-4703-b22a-620941b85a1c"811 uuid="64f652cb-7fdf-482d-ae19-4dbb289a5ca0" 812 812 wsmap="managed" 813 813 > … … 1774 1774 1775 1775 <method name="registerCallback"> 1776 <param name="callback" type="IVirtualBoxCallback" dir="in"/> 1776 <desc> 1777 Registers a new global VirtualBox callback. The methods of the given 1778 callback object will be called by VirtualBox when an appropriate 1779 event occurs. 1780 </desc> 1781 <param name="callback" type="IVirtualBoxCallback" dir="in"> 1782 <desc>Callback object to register.</desc> 1783 </param> 1777 1784 </method> 1778 1785 1779 1786 <method name="unregisterCallback"> 1780 <param name="callback" type="IVirtualBoxCallback" dir="in"/> 1787 <desc> 1788 Unregisters the previously registered global VirtualBox callback. 1789 </desc> 1790 <param name="callback" type="IVirtualBoxCallback" dir="in"> 1791 <desc>Callback object to unregister.</desc> 1792 </param> 1793 </method> 1794 1795 <method name="waitForPropertyChange"> 1796 <desc> 1797 Blocks the caller until any of the properties represented by the @a 1798 what argument changes the value or until the given timeout interval 1799 expires. 1800 1801 The @a what argument is a comma separated list of propertiy masks that 1802 describe properties the caller is interested in. The property mask is 1803 a string in the following format: 1804 1805 @code 1806 [[group.]subgroup.]name 1807 @endcode 1808 1809 where @c name is the property name and @c group, @c subgroup are zero 1810 or or more property group specifiers. Each element (group or name) in 1811 the property mask may be either a latin string or an asterisk symbol 1812 (@c "*") which is used to match any string for the given element. A 1813 property mask that doesn't contain asterisk symbols represents a 1814 single fully qualified property name. 1815 1816 Groups in the fully qualified property name go from more generic (the 1817 left-most part) to more specific (the right-most part). The first 1818 element is usually a name of the object the property belongs to. The 1819 second element may be either a property name, or a child object name, 1820 or an index if the preceeding element names an object which is one of 1821 many objects of the same type. This way, property names form a 1822 hierarchy of properties. Here are some examples of property names: 1823 1824 <table> 1825 <tr> 1826 <td><tt>VirtualBox.version</tt></td> 1827 <td><link to="IVirtualBox::version"/> property</td> 1828 </tr> 1829 <tr> 1830 <td><tt>Machine.<UUID>.name</tt></td> 1831 <td><link to="IMachine::name"/> property of the machine with the 1832 given UUID</td> 1833 </tr> 1834 </table> 1835 1836 Most property names directly correspond to the properties of objects 1837 (components) provided by the VirtualBox library and may be used to 1838 track changes to these properties. However, there may be 1839 pseudo-property names that don't correspond to any existing object's 1840 property directly, as well as there may be object properties that 1841 don't have a corresponding property name that is understood by this 1842 method, and therefore changes to such properties cannot be 1843 tracked. See individual object's property descrcriptions to get a 1844 fully qualified property name that can be used with this method (if 1845 any). 1846 1847 There is a special property mask @c "*" (i.e. a string consisting of a 1848 single asterisk symbol) that can be used to match all properties. 1849 Below are more examples of property masks: 1850 1851 <table> 1852 <tr> 1853 <td><tt>VirtualBox.*</tt></td> 1854 <td>Track all properties of the VirtualBox object</td> 1855 </tr> 1856 <tr> 1857 <td><tt>Machine.*.name</tt></td> 1858 <td>Track changes to the <link to="IMachine::name"/> property of 1859 all registered virtual machines</td> 1860 </tr> 1861 </table> 1862 1863 </desc> 1864 <param name="what" type="wstring" dir="in"> 1865 <desc>Comma separated list of property masks.</desc> 1866 </param> 1867 <param name="timeout" type="unsigned long" dir="in"> 1868 <desc> 1869 Wait timeout in milliseconds. 1870 Specify -1 for an indefinite wait. 1871 </desc> 1872 </param> 1873 <param name="changed" type="wstring" dir="out"> 1874 <desc> 1875 Comma separated list of properties that have been changed and caused 1876 this method to return to the caller. 1877 </desc> 1878 </param> 1879 <param name="values" type="wstring" dir="out"> 1880 <desc>Reserved, not currently used.</desc> 1881 </param> 1781 1882 </method> 1782 1883 … … 1801 1902 <interface 1802 1903 name="IInternalMachineControl" extends="$unknown" 1803 uuid=" 83c4e00c-be0b-4c10-a48e-7bf832615f7b"1904 uuid="f33740bf-53b2-4519-b950-104260c6a189" 1804 1905 internal="yes" 1805 1906 wsmap="suppress" … … 1932 2033 <param name="success" type="boolean" dir="in"> 1933 2034 <desc><tt>true</tt> to indicate success and <tt>false</tt> otherwise</desc> 2035 </param> 2036 </method> 2037 2038 <method name="adoptSavedState"> 2039 <desc> 2040 Gets called by IConsole::adoptSavedState. 2041 </desc> 2042 <param name="savedStateFile" type="wstring" dir="in"> 2043 <desc>Path to the saved state file to adopt.</desc> 1934 2044 </param> 1935 2045 </method> … … 3380 3490 <interface 3381 3491 name="IConsole" extends="$unknown" 3382 uuid=" 1DEA5C4B-0753-4193-B909-22330F64EC45"3492 uuid="d5a1cbda-f5d7-4824-9afe-d640c94c7dcf" 3383 3493 wsmap="managed" 3384 3494 > … … 3564 3674 <param name="progress" type="IProgress" dir="return"> 3565 3675 <desc>Progress object to track the operation completion.</desc> 3676 </param> 3677 </method> 3678 3679 <method name="adoptSavedState"> 3680 <desc> 3681 Associates the given saved state file to the virtual machine. 3682 3683 On success, the machine will go to the Saved state. Next time it is 3684 powered up, it will be restored from the adopted saved state and 3685 continue execution from the place where the saved state file was 3686 created. 3687 3688 The specified saved state file path may be full or relative to the 3689 folder the VM normally saves the state to (usually, 3690 <link to="IMachine::snapshotFolder"/>). 3691 3692 <note> 3693 It's a caller's responsibility to make sure the given saved state 3694 file is compatible with the settings of this virtual machine that 3695 represent its virtual hardware (memory size, hard disk configuration 3696 etc.). If there is a mismatch, the behavior of the virtual machine 3697 is undefined. 3698 </note> 3699 </desc> 3700 <param name="savedStateFile" type="wstring" dir="in"> 3701 <desc>Path to the saved state file to adopt.</desc> 3566 3702 </param> 3567 3703 </method> … … 3785 3921 <desc> 3786 3922 This operation is similar to <link to="#discardSnapshot()"/> but 3787 affects the current machine state. This means that the state stored 3788 in the current snapshot will become a new current state, and 3789 all current settings of the machine and changes stored in 3790 differencing hard disks will be lost. 3791 3792 After this operation is successfully completed, new empty 3793 differencing hard disks are created for all normal hard disks 3794 of the machine. 3795 3796 If the current snapshot of the machine is an online snapshot, 3797 the machine will go to the <link to="MachineState::Saved"> 3798 saved state</link>, so that the next time it is powered on, 3799 the execution state will be restored from the current snapshot. 3800 3801 <note>The machine must not be running, otherwise the operation 3802 will fail.</note> 3803 3804 <note>If the machine state is <link 3805 to="MachineState::Saved">Saved</link> prior to this operation, 3806 the saved state file will be implicitly discarded (as if <link 3807 to="IConsole::discardSavedState()"/> were called).</note> 3923 affects the current machine state. This means that the state stored in 3924 the current snapshot will become a new current state, and all current 3925 settings of the machine and changes stored in differencing hard disks 3926 will be lost. 3927 3928 After this operation is successfully completed, new empty differencing 3929 hard disks are created for all normal hard disks of the machine. 3930 3931 If the current snapshot of the machine is an online snapshot, the 3932 machine will go to the <link to="MachineState::Saved"> saved 3933 state</link>, so that the next time it is powered on, the execution 3934 state will be restored from the current snapshot. 3935 3936 <note> 3937 The machine must not be running, otherwise the operation will fail. 3938 </note> 3939 3940 <note> 3941 If the machine state is <link to="MachineState::Saved">Saved</link> 3942 prior to this operation, the saved state file will be implicitly 3943 discarded (as if <link to="IConsole::discardSavedState()"/> were 3944 called). 3945 </note> 3808 3946 3809 3947 </desc> -
trunk/src/VBox/Main/include/ConsoleImpl.h
r4404 r5390 127 127 STDMETHOD(PowerButton)(); 128 128 STDMETHOD(SaveState) (IProgress **aProgress); 129 STDMETHOD(AdoptSavedState) (INPTR BSTR aSavedStateFile); 129 130 STDMETHOD(DiscardSavedState)(); 130 131 STDMETHOD(GetDeviceActivity) (DeviceType_T aDeviceType, -
trunk/src/VBox/Main/include/MachineImpl.h
r5218 r5390 758 758 STDMETHOD(BeginSavingState) (IProgress *aProgress, BSTR *aStateFilePath); 759 759 STDMETHOD(EndSavingState) (BOOL aSuccess); 760 STDMETHOD(AdoptSavedState) (INPTR BSTR aSavedStateFile); 760 761 STDMETHOD(BeginTakingSnapshot) (IConsole *aInitiator, 761 762 INPTR BSTR aName, INPTR BSTR aDescription, -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r5292 r5390 173 173 IProgress **aProgress); 174 174 STDMETHOD(OpenExistingSession) (ISession *aSession, INPTR GUIDPARAM aMachineId); 175 STDMETHOD(RegisterCallback) (IVirtualBoxCallback *callback); 176 STDMETHOD(UnregisterCallback) (IVirtualBoxCallback *callback); 175 176 STDMETHOD(RegisterCallback) (IVirtualBoxCallback *aCallback); 177 STDMETHOD(UnregisterCallback) (IVirtualBoxCallback *aCallback); 178 179 STDMETHOD(WaitForPropertyChange) (INPTR BSTR aWhat, ULONG aTimeout, 180 BSTR *aChanged, BSTR *aValues); 177 181 178 182 /* public methods only for internal purposes */
Note:
See TracChangeset
for help on using the changeset viewer.