Changeset 6935 in vbox for trunk/src/VBox
- Timestamp:
- Feb 13, 2008 4:43:19 PM (17 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ConsoleImpl2.cpp
r6616 r6935 70 70 bool afPciDeviceNo[15] = {false}; 71 71 72 #if defined(RT_OS_WINDOWS)72 #if !defined (VBOX_WITH_XPCOM) 73 73 { 74 74 /* initialize COM */ -
trunk/src/VBox/Main/ProgressImpl.cpp
r6375 r6935 770 770 771 771 #if !defined (VBOX_WITH_XPCOM) 772 #if defined (RT_OS_WINDOWS)773 772 774 773 ComPtr <IErrorInfo> err; … … 781 780 } 782 781 783 #endif // !defined (RT_OS_WINDOWS)784 782 #else // !defined (VBOX_WITH_XPCOM) 785 783 -
trunk/src/VBox/Main/VirtualBoxBase.cpp
r6851 r6935 19 19 20 20 #if !defined (VBOX_WITH_XPCOM) 21 #if defined (RT_OS_WINDOWS)22 21 #include <windows.h> 23 22 #include <dbghelp.h> 24 #endif25 23 #else // !defined (VBOX_WITH_XPCOM) 26 24 #include <nsIServiceManager.h> … … 672 670 673 671 #if !defined (VBOX_WITH_XPCOM) 674 #if defined (RT_OS_WINDOWS)675 672 676 673 ComPtr <IVirtualBoxErrorInfo> curInfo; … … 708 705 rc = ::SetErrorInfo (0, err); 709 706 710 #endif711 707 #else // !defined (VBOX_WITH_XPCOM) 712 708 … … 937 933 /** 938 934 * Uninitializes all dependent children registered with #addDependentChild(). 939 * 940 * Typically called from the uninit() method. Note that this method will call 941 * uninit() methods of child objects. If these methods need to call the parent 942 * object during initialization, uninitDependentChildren() must be called before 943 * the relevant part of the parent is uninitialized, usually at the begnning of 944 * the parent uninitialization sequence. 935 * 936 * Typically called from the uninit() method. Note that this method will call 937 * uninit() methods of child objects. If these methods need to call the parent 938 * object during initialization, uninitDependentChildren() must be called before 939 * the relevant part of the parent is uninitialized, usually at the begnning of 940 * the parent uninitialization sequence. 945 941 */ 946 942 void VirtualBoxBaseWithChildrenNEXT::uninitDependentChildren() … … 1003 999 * Returns a pointer to the dependent child corresponding to the given 1004 1000 * interface pointer (used as a key in the map of dependent children) or NULL 1005 * if the interface pointer doesn't correspond to any child registered using 1006 * #addDependentChild(). 1007 * 1008 * Note that ComPtr <IUnknown> is used as an argument instead of IUnknown * in 1009 * order to guarantee IUnknown identity and disambiguation by doing 1010 * QueryInterface (IUnknown) rather than a regular C cast. 1001 * if the interface pointer doesn't correspond to any child registered using 1002 * #addDependentChild(). 1003 * 1004 * Note that ComPtr <IUnknown> is used as an argument instead of IUnknown * in 1005 * order to guarantee IUnknown identity and disambiguation by doing 1006 * QueryInterface (IUnknown) rather than a regular C cast. 1011 1007 * 1012 1008 * @param aUnk Pointer to map to the dependent child object. … … 1081 1077 1082 1078 /** 1083 * Uninitializes all dependent children registered with 1084 * #addDependentChild(). 1085 * 1086 * @note This method will call uninit() methods of children. If these 1079 * Uninitializes all dependent children registered with 1080 * #addDependentChild(). 1081 * 1082 * @note This method will call uninit() methods of children. If these 1087 1083 * methods access the parent object, uninitDependentChildren() must be 1088 1084 * called either at the beginning of the parent uninitialization … … 1188 1184 if (RT_FAILURE (vrc)) 1189 1185 throw ENoConversion (FmtStr ("'%s' is not Guid (%Vrc)", aValue, vrc)); 1190 1186 1191 1187 return com::Guid (uuid); 1192 1188 } -
trunk/src/VBox/Main/VirtualBoxErrorInfoImpl.cpp
r5999 r6935 84 84 85 85 #if !defined (VBOX_WITH_XPCOM) 86 #if defined (RT_OS_WINDOWS)87 86 88 87 /** … … 139 138 } 140 139 141 #endif // defined (RT_OS_WINDOWS)142 140 #else // !defined (VBOX_WITH_XPCOM) 143 141 -
trunk/src/VBox/Main/VirtualBoxImpl.cpp
r6909 r6935 3354 3354 if (aHardDisk->storageType() == HardDiskStorageType_VirtualDiskImage) 3355 3355 #if !defined (VBOX_WITH_XPCOM) 3356 #if defined(RT_OS_WINDOWS)3357 3356 /// @todo (dmik) stupid BSTR declaration lacks the BCSTR counterpart 3358 3357 const_cast <BSTR> (aFilePathFull) = aHardDisk->asVDI()->filePathFull(); 3359 #endif3360 3358 #else 3361 3359 aFilePathFull = aHardDisk->asVDI()->filePathFull(); -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r6851 r6935 41 41 #include <map> 42 42 43 #if defined (RT_OS_WINDOWS)43 #if !defined (VBOX_WITH_XPCOM) 44 44 45 45 #include <atlcom.h> … … 117 117 }; 118 118 119 #endif // defined (RT_OS_WINDOWS)119 #endif // !defined (VBOX_WITH_XPCOM) 120 120 121 121 // macros … … 432 432 433 433 class ATL_NO_VTABLE VirtualBoxBaseNEXT_base 434 #if def RT_OS_WINDOWS434 #if !defined (VBOX_WITH_XPCOM) 435 435 : public CComObjectRootEx <CComMultiThreadModel> 436 436 #else … … 476 476 return addCaller (aState, true /* aLimited */); 477 477 } 478 478 479 479 /** 480 480 * Smart class that automatically increases the number of callers of the … … 497 497 * @note It is preferrable to use the AutoCaller and AutoLimitedCaller 498 498 * classes than specify the @a aLimited argument, for better 499 * self-descriptiveness. 499 * self-descriptiveness. 500 500 */ 501 501 template <bool aLimited> … … 613 613 */ 614 614 typedef AutoCallerBase <false> AutoCaller; 615 615 616 616 /** 617 617 * Smart class that automatically increases the number of limited callers … … 638 638 */ 639 639 typedef AutoCallerBase <true> AutoLimitedCaller; 640 640 641 641 protected: 642 642 … … 692 692 693 693 enum Status { Failed = 0x0, Succeeded = 0x1, Limited = 0x2 }; 694 694 695 695 AutoInitSpan (VirtualBoxBaseNEXT_base *aObj, Status aStatus = Failed); 696 696 ~AutoInitSpan(); … … 726 726 727 727 /** Returns the current initialization status. */ 728 Status status() { return mStatus; } 728 Status status() { return mStatus; } 729 729 730 730 private: … … 928 928 /// @todo (dmik) remove after we switch to VirtualBoxBaseNEXT completely 929 929 class ATL_NO_VTABLE VirtualBoxBase : public VirtualBoxBaseNEXT_base 930 //#if def RT_OS_WINDOWS930 //#if !defined (VBOX_WITH_XPCOM) 931 931 // : public CComObjectRootEx<CComMultiThreadModel> 932 932 //#else … … 1098 1098 protected: 1099 1099 1100 inlinestatic HRESULT setError (HRESULT aResultCode, const GUID &aIID,1100 static HRESULT setError (HRESULT aResultCode, const GUID &aIID, 1101 1101 const Bstr &aComponent, 1102 1102 const Bstr &aText) … … 1106 1106 } 1107 1107 1108 inlinestatic HRESULT addError (HRESULT aResultCode, const GUID &aIID,1108 static HRESULT addError (HRESULT aResultCode, const GUID &aIID, 1109 1109 const Bstr &aComponent, 1110 1110 const Bstr &aText) … … 1159 1159 class ATL_NO_VTABLE VirtualBoxSupportErrorInfoImpl 1160 1160 : protected VirtualBoxSupportErrorInfoImplBase 1161 #if defined (RT_OS_WINDOWS)1161 #if !defined (VBOX_WITH_XPCOM) 1162 1162 , public ISupportErrorInfo 1163 1163 #else … … 1166 1166 public: 1167 1167 1168 #if defined (RT_OS_WINDOWS)1168 #if !defined (VBOX_WITH_XPCOM) 1169 1169 STDMETHOD(InterfaceSupportsErrorInfo) (REFIID riid) 1170 1170 { … … 1197 1197 return bSupports ? S_OK : S_FALSE; 1198 1198 } 1199 #endif // defined (RT_OS_WINDOWS)1199 #endif // !defined (VBOX_WITH_XPCOM) 1200 1200 1201 1201 protected: … … 1241 1241 * error argument. 1242 1242 */ 1243 inlinestatic HRESULT setError (HRESULT aResultCode, const GUID &aIID,1244 1245 1243 static HRESULT setError (HRESULT aResultCode, const GUID &aIID, 1244 const wchar_t *aComponent, 1245 const char *aText, ...) 1246 1246 { 1247 1247 va_list args; … … 1259 1259 * attribute of the new error info object. 1260 1260 */ 1261 inlinestatic HRESULT addError (HRESULT aResultCode, const GUID &aIID,1262 1263 1261 static HRESULT addError (HRESULT aResultCode, const GUID &aIID, 1262 const wchar_t *aComponent, 1263 const char *aText, ...) 1264 1264 { 1265 1265 va_list args; … … 1294 1294 * </code> 1295 1295 */ 1296 inlinestatic HRESULT setError (HRESULT aResultCode, const char *aText, ...)1296 static HRESULT setError (HRESULT aResultCode, const char *aText, ...) 1297 1297 { 1298 1298 va_list args; … … 1310 1310 * attribute of the new error info object. 1311 1311 */ 1312 inlinestatic HRESULT addError (HRESULT aResultCode, const char *aText, ...)1312 static HRESULT addError (HRESULT aResultCode, const char *aText, ...) 1313 1313 { 1314 1314 va_list args; … … 1329 1329 * and #setError (HRESULT, const char *, ...) for details. 1330 1330 */ 1331 inlinestatic HRESULT setErrorV (HRESULT aResultCode, const char *aText,1332 1331 static HRESULT setErrorV (HRESULT aResultCode, const char *aText, 1332 va_list aArgs) 1333 1333 { 1334 1334 HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError … … 1343 1343 * attribute of the new error info object. 1344 1344 */ 1345 inlinestatic HRESULT addErrorV (HRESULT aResultCode, const char *aText,1346 1345 static HRESULT addErrorV (HRESULT aResultCode, const char *aText, 1346 va_list aArgs) 1347 1347 { 1348 1348 HRESULT rc = VirtualBoxSupportErrorInfoImplBase::addError … … 1358 1358 * 1359 1359 * This method is preferred iy you have a ready (translated and formatted) 1360 * Bstr string, because it omits an extra conversion Utf8Str -> Bstr. 1360 * Bstr string, because it omits an extra conversion Utf8Str -> Bstr. 1361 1361 * 1362 1362 * See #setError (HRESULT, const GUID &, const wchar_t *, const char *text, ...) 1363 1363 * and #setError (HRESULT, const char *, ...) for details. 1364 1364 */ 1365 inlinestatic HRESULT setErrorBstr (HRESULT aResultCode, const Bstr &aText)1365 static HRESULT setErrorBstr (HRESULT aResultCode, const Bstr &aText) 1366 1366 { 1367 1367 HRESULT rc = VirtualBoxSupportErrorInfoImplBase::setError … … 1376 1376 * attribute of the new error info object. 1377 1377 */ 1378 inlinestatic HRESULT addErrorBstr (HRESULT aResultCode, const Bstr &aText)1378 static HRESULT addErrorBstr (HRESULT aResultCode, const Bstr &aText) 1379 1379 { 1380 1380 HRESULT rc = VirtualBoxSupportErrorInfoImplBase::addError … … 1392 1392 * for details. 1393 1393 */ 1394 inlinestatic HRESULT setError (HRESULT aResultCode, const GUID &aIID,1395 1394 static HRESULT setError (HRESULT aResultCode, const GUID &aIID, 1395 const char *aText, ...) 1396 1396 { 1397 1397 va_list args; … … 1409 1409 * attribute of the new error info object. 1410 1410 */ 1411 inlinestatic HRESULT addError (HRESULT aResultCode, const GUID &aIID,1412 1411 static HRESULT addError (HRESULT aResultCode, const GUID &aIID, 1412 const char *aText, ...) 1413 1413 { 1414 1414 va_list args; … … 1471 1471 * if #addDependentChild() or #removeDependentChild() are used incorrectly 1472 1472 * (called at inappropriate times). Check the above rules once more. 1473 * 1473 * 1474 1474 * @deprecated Use VirtualBoxBaseWithChildrenNEXT for new classes. 1475 1475 */ … … 1549 1549 1550 1550 /** 1551 * 1551 * 1552 1552 * Base class to track VirtualBoxBaseNEXT chlidren of the component. 1553 * 1554 * This class is a preferrable VirtualBoxBase replacement for components that 1555 * operate with collections of child components. It gives two useful 1556 * possibilities: 1557 * 1558 * <ol><li> 1559 * Given an IUnknown instance, it's possible to quickly determine 1553 * 1554 * This class is a preferrable VirtualBoxBase replacement for components that 1555 * operate with collections of child components. It gives two useful 1556 * possibilities: 1557 * 1558 * <ol><li> 1559 * Given an IUnknown instance, it's possible to quickly determine 1560 1560 * whether this instance represents a child object created by the given 1561 1561 * component, and if so, get a valid VirtualBoxBase pointer to the child … … 1595 1595 * 1596 1596 * Note that children added by #addDependentChild() are <b>weakly</b> referenced 1597 * (i.e. AddRef() is not called), so when a child object is deleted externally 1598 * (because it's reference count goes to zero), it will automatically remove 1597 * (i.e. AddRef() is not called), so when a child object is deleted externally 1598 * (because it's reference count goes to zero), it will automatically remove 1599 1599 * itself from the map of dependent children provided that it follows the rules 1600 * described here. 1601 * 1602 * @note Once again: because of weak referencing, deadlocks and assertions are 1600 * described here. 1601 * 1602 * @note Once again: because of weak referencing, deadlocks and assertions are 1603 1603 * very likely if #addDependentChild() or #removeDependentChild() are used 1604 1604 * incorrectly (called at inappropriate times). Check the above rules once 1605 1605 * more. 1606 * 1607 * @todo This is a VirtualBoxBaseWithChildren equivalent that uses the 1606 * 1607 * @todo This is a VirtualBoxBaseWithChildren equivalent that uses the 1608 1608 * VirtualBoxBaseNEXT implementation. Will completely supercede 1609 1609 * VirtualBoxBaseWithChildren after the old VirtualBoxBase implementation … … 1622 1622 1623 1623 /** 1624 * Adds the given child to the map of dependent children. 1624 * Adds the given child to the map of dependent children. 1625 1625 * 1626 1626 * Typically called from the child's init() method, from within the 1627 1627 * AutoInitSpan scope. Otherwise, VirtualBoxBase::AutoCaller must be 1628 * used on @a aChild to make sure it is not uninitialized during this 1628 * used on @a aChild to make sure it is not uninitialized during this 1629 1629 * method's call. 1630 1630 * 1631 * @param aChild Child object to add (must inherit VirtualBoxBase AND 1631 * @param aChild Child object to add (must inherit VirtualBoxBase AND 1632 1632 * implement some interface). 1633 1633 */ … … 1640 1640 1641 1641 /** 1642 * Removes the given child from the map of dependent children. 1643 * 1644 * Make sure this method is called after the child has successfully entered 1645 * AutoUninitSpan and outside the child lock. 1646 * 1647 * If called not from within the AutoUninitSpan scope, 1648 * VirtualBoxBase::AutoCaller must be used on @a aChild to make sure it is 1649 * not uninitialized during this method's call. 1642 * Removes the given child from the map of dependent children. 1643 * 1644 * Make sure this method is called after the child has successfully entered 1645 * AutoUninitSpan and outside the child lock. 1646 * 1647 * If called not from within the AutoUninitSpan scope, 1648 * VirtualBoxBase::AutoCaller must be used on @a aChild to make sure it is 1649 * not uninitialized during this method's call. 1650 1650 * 1651 1651 * @param aChild Child object to remove (must inherit VirtualBoxBase AND … … 1707 1707 * @param C type of child objects (must inherit VirtualBoxBase AND 1708 1708 * implement some interface) 1709 * 1709 * 1710 1710 * @deprecated Use VirtualBoxBaseWithTypedChildrenNEXT for new classes. 1711 1711 */ … … 1844 1844 * Base class to track component's chlidren of the particular type. 1845 1845 * 1846 * This class is similar to VirtualBoxBaseWithChildren, with the exception that 1847 * all children must be of the same type. For this reason, it's not necessary to 1848 * use a map to store children, so a list is used instead. 1846 * This class is similar to VirtualBoxBaseWithChildren, with the exception that 1847 * all children must be of the same type. For this reason, it's not necessary to 1848 * use a map to store children, so a list is used instead. 1849 1849 * 1850 1850 * As opposed to VirtualBoxBaseWithChildren, children added by 1851 * #addDependentChild() are <b>strongly</b> referenced, so that they cannot be 1852 * externally deleted until #removeDependentChild() is called. For this 1853 * reason, strict rules of calling #removeDependentChild() don't apply to 1854 * instances of this class -- it can be called anywhere in the child's uninit() 1855 * implementation. 1856 * 1857 * @param C Type of child objects (must inherit VirtualBoxBase AND implementsome 1851 * #addDependentChild() are <b>strongly</b> referenced, so that they cannot be 1852 * externally deleted until #removeDependentChild() is called. For this 1853 * reason, strict rules of calling #removeDependentChild() don't apply to 1854 * instances of this class -- it can be called anywhere in the child's uninit() 1855 * implementation. 1856 * 1857 * @param C Type of child objects (must inherit VirtualBoxBase AND implementsome 1858 1858 * interface). 1859 * 1860 * @todo This is a VirtualBoxBaseWithChildren equivalent that uses the 1859 * 1860 * @todo This is a VirtualBoxBaseWithChildren equivalent that uses the 1861 1861 * VirtualBoxBaseNEXT implementation. Will completely supercede 1862 1862 * VirtualBoxBaseWithChildren after the old VirtualBoxBase implementation … … 1875 1875 1876 1876 /** 1877 * Adds the given child to the list of dependent children. 1878 * 1879 * VirtualBoxBase::AutoCaller must be used on @a aChild to make sure it is 1877 * Adds the given child to the list of dependent children. 1878 * 1879 * VirtualBoxBase::AutoCaller must be used on @a aChild to make sure it is 1880 1880 * not uninitialized during this method's call. 1881 1881 * … … 1895 1895 1896 1896 /** 1897 * Removes the given child from the list of dependent children. 1898 * 1899 * VirtualBoxBase::AutoCaller must be used on @a aChild to make sure it is 1900 * not uninitialized during this method's call. 1897 * Removes the given child from the list of dependent children. 1898 * 1899 * VirtualBoxBase::AutoCaller must be used on @a aChild to make sure it is 1900 * not uninitialized during this method's call. 1901 1901 * 1902 1902 * @param aChild the child object to remove (must inherit VirtualBoxBase … … 1917 1917 1918 1918 /** 1919 * Returns an internal lock handle used to lock the list of children 1920 * returned by #dependentChildren(). This lock is to be used by AutoLock as 1921 * follows: 1922 * <code> 1919 * Returns an internal lock handle used to lock the list of children 1920 * returned by #dependentChildren(). This lock is to be used by AutoLock as 1921 * follows: 1922 * <code> 1923 1923 * AutoLock alock (dependentChildrenLock()); 1924 1924 * </code> … … 1927 1927 1928 1928 /** 1929 * Returns the read-only list of all dependent children. 1930 * 1931 * @note Access the returned list (iterate, get size etc.) only after doing 1929 * Returns the read-only list of all dependent children. 1930 * 1931 * @note Access the returned list (iterate, get size etc.) only after doing 1932 1932 * AutoLock alock (dependentChildrenLock())! 1933 1933 */ … … 2210 2210 #if defined VBOX_MAIN_SETTINGS_ADDONS 2211 2211 2212 /** 2212 /** 2213 2213 * Settinsg API additions. 2214 2214 */
Note:
See TracChangeset
for help on using the changeset viewer.