Changeset 21686 in vbox for trunk/src/VBox/Main/HostImpl.cpp
- Timestamp:
- Jul 17, 2009 1:41:39 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/HostImpl.cpp
r21622 r21686 152 152 void Host::FinalRelease() 153 153 { 154 uninit(); 154 if (isReady()) 155 uninit(); 155 156 } 156 157 … … 163 164 * @param aParent VirtualBox parent object. 164 165 */ 165 HRESULT Host::init(VirtualBox *aParent) 166 { 167 LogFlowThisFunc (("aParent=%p\n", aParent)); 168 169 /* Enclose the state transition NotReady->InInit->Ready */ 170 AutoInitSpan autoInitSpan (this); 171 AssertReturn (autoInitSpan.isOk(), E_FAIL); 166 HRESULT Host::init (VirtualBox *aParent) 167 { 168 LogFlowThisFunc (("isReady=%d\n", isReady())); 169 170 ComAssertRet (aParent, E_INVALIDARG); 171 172 AutoWriteLock alock (this); 173 ComAssertRet (!isReady(), E_FAIL); 172 174 173 175 mParent = aParent; … … 258 260 #endif /* VBOX_WITH_CROGL */ 259 261 260 /* Confirm a successful initialization */ 261 autoInitSpan.setSucceeded(); 262 262 setReady(true); 263 263 return S_OK; 264 264 } … … 270 270 void Host::uninit() 271 271 { 272 LogFlowThisFunc (("\n")); 273 274 /* Enclose the state transition Ready->InUninit->NotReady */ 275 AutoUninitSpan autoUninitSpan (this); 276 if (autoUninitSpan.uninitDone()) 277 return; 272 LogFlowThisFunc (("isReady=%d\n", isReady())); 273 274 AssertReturn (isReady(), (void) 0); 278 275 279 276 #ifdef VBOX_WITH_RESOURCE_USAGE_API … … 298 295 mUSBDeviceFilters.clear(); 299 296 #endif 297 298 setReady (FALSE); 300 299 } 301 300 … … 312 311 { 313 312 CheckComArgOutSafeArrayPointerValid(aDrives); 314 315 AutoCaller autoCaller (this); 316 CheckComRCReturnRC (autoCaller.rc()); 317 318 AutoWriteLock alock (this); 319 320 std::list< ComObjPtr<HostDVDDrive> > list; 313 AutoWriteLock alock (this); 314 CHECK_READY(); 315 std::list <ComObjPtr <HostDVDDrive> > list; 321 316 HRESULT rc = S_OK; 322 317 try … … 444 439 { 445 440 CheckComArgOutPointerValid(aDrives); 446 447 AutoCaller autoCaller(this); 448 CheckComRCReturnRC(autoCaller.rc()); 449 450 AutoWriteLock alock(this); 451 452 std::list<ComObjPtr <HostFloppyDrive> > list; 441 AutoWriteLock alock (this); 442 CHECK_READY(); 443 444 std::list <ComObjPtr <HostFloppyDrive> > list; 453 445 HRESULT rc = S_OK; 454 446 … … 562 554 return E_POINTER; 563 555 564 AutoCaller autoCaller (this); 565 CheckComRCReturnRC (autoCaller.rc()); 566 567 AutoWriteLock alock (this); 556 AutoWriteLock alock (this); 557 CHECK_READY(); 568 558 569 559 std::list <ComObjPtr <HostNetworkInterface> > list; … … 843 833 CheckComArgOutSafeArrayPointerValid(aUSBDevices); 844 834 845 AutoCaller autoCaller (this); 846 CheckComRCReturnRC (autoCaller.rc()); 847 848 AutoWriteLock alock (this); 835 AutoWriteLock alock (this); 836 CHECK_READY(); 849 837 850 838 MultiResult rc = checkUSBProxyService(); … … 870 858 CheckComArgOutSafeArrayPointerValid(aUSBDeviceFilters); 871 859 872 AutoCaller autoCaller (this); 873 CheckComRCReturnRC (autoCaller.rc()); 874 875 AutoWriteLock alock (this); 860 AutoWriteLock alock (this); 861 CHECK_READY(); 876 862 877 863 MultiResult rc = checkUSBProxyService(); … … 903 889 { 904 890 CheckComArgOutPointerValid(aCount); 905 // AutoCaller autoCaller (this); 906 // CheckComRCReturnRC (autoCaller.rc()); 907 908 // AutoReadLock alock (this); 909 891 AutoWriteLock alock (this); 892 CHECK_READY(); 910 893 *aCount = RTMpGetPresentCount(); 911 894 return S_OK; … … 921 904 { 922 905 CheckComArgOutPointerValid(aCount); 923 // AutoCaller autoCaller (this); 924 // CheckComRCReturnRC (autoCaller.rc()); 925 926 // AutoReadLock alock (this); 927 906 AutoWriteLock alock (this); 907 CHECK_READY(); 928 908 *aCount = RTMpGetOnlineCount(); 929 909 return S_OK; … … 940 920 { 941 921 CheckComArgOutPointerValid(aSpeed); 942 // AutoCaller autoCaller (this); 943 // CheckComRCReturnRC (autoCaller.rc()); 944 945 // AutoReadLock alock (this); 946 922 AutoWriteLock alock (this); 923 CHECK_READY(); 947 924 *aSpeed = RTMpGetMaxFrequency(aCpuId); 948 925 return S_OK; … … 958 935 { 959 936 CheckComArgOutPointerValid(aDescription); 960 // AutoCaller autoCaller (this); 961 // CheckComRCReturnRC (autoCaller.rc()); 962 963 // AutoReadLock alock (this); 964 937 AutoWriteLock alock (this); 938 CHECK_READY(); 965 939 /** @todo */ 966 940 ReturnComNotImplemented(); … … 977 951 { 978 952 CheckComArgOutPointerValid(aSupported); 979 AutoCaller autoCaller (this); 980 CheckComRCReturnRC (autoCaller.rc()); 981 982 AutoReadLock alock (this); 953 AutoWriteLock alock (this); 954 CHECK_READY(); 983 955 984 956 switch (aFeature) … … 1011 983 { 1012 984 CheckComArgOutPointerValid(aSize); 1013 AutoCaller autoCaller (this); 1014 CheckComRCReturnRC (autoCaller.rc()); 1015 1016 AutoWriteLock alock (this); 1017 985 AutoWriteLock alock (this); 986 CHECK_READY(); 1018 987 /* @todo This is an ugly hack. There must be a function in IPRT for that. */ 1019 988 pm::CollectorHAL *hal = pm::createHAL(); … … 1036 1005 { 1037 1006 CheckComArgOutPointerValid(aAvailable); 1038 AutoCaller autoCaller (this); 1039 CheckComRCReturnRC (autoCaller.rc()); 1040 1041 AutoWriteLock alock (this); 1042 1007 AutoWriteLock alock (this); 1008 CHECK_READY(); 1043 1009 /* @todo This is an ugly hack. There must be a function in IPRT for that. */ 1044 1010 pm::CollectorHAL *hal = pm::createHAL(); … … 1061 1027 { 1062 1028 CheckComArgOutPointerValid(aOs); 1063 // AutoCaller autoCaller (this); 1064 // CheckComRCReturnRC (autoCaller.rc()); 1065 1066 // AutoReadLock alock (this); 1029 AutoWriteLock alock (this); 1030 CHECK_READY(); 1067 1031 1068 1032 char szOSName[80]; … … 1083 1047 { 1084 1048 CheckComArgOutPointerValid(aVersion); 1085 // AutoCaller autoCaller (this); 1086 // CheckComRCReturnRC (autoCaller.rc()); 1087 1088 // AutoReadLock alock (this); 1049 AutoWriteLock alock (this); 1050 CHECK_READY(); 1089 1051 1090 1052 /* Get the OS release. Reserve some buffer space for the service pack. */ … … 1122 1084 { 1123 1085 CheckComArgOutPointerValid(aUTCTime); 1124 // AutoCaller autoCaller (this); 1125 // CheckComRCReturnRC (autoCaller.rc()); 1126 1127 // AutoReadLock alock (this); 1128 1086 AutoWriteLock alock (this); 1087 CHECK_READY(); 1129 1088 RTTIMESPEC now; 1130 1089 *aUTCTime = RTTimeSpecGetMilli(RTTimeNow(&now)); 1131 1132 1090 return S_OK; 1133 1091 } … … 1136 1094 { 1137 1095 CheckComArgOutPointerValid(aSupported); 1138 AutoCaller autoCaller (this); 1139 CheckComRCReturnRC (autoCaller.rc()); 1140 1141 AutoReadLock alock (this); 1096 1097 AutoWriteLock alock(this); 1098 CHECK_READY(); 1142 1099 1143 1100 *aSupported = f3DAccelerationSupported; … … 1155 1112 CheckComArgOutPointerValid(aProgress); 1156 1113 1157 AutoCaller autoCaller (this); 1158 CheckComRCReturnRC (autoCaller.rc()); 1159 1160 AutoWriteLock alock (this); 1114 AutoWriteLock alock (this); 1115 CHECK_READY(); 1161 1116 1162 1117 int r = NetIfCreateHostOnlyNetworkInterface (mParent, aHostNetworkInterface, aProgress); … … 1177 1132 CheckComArgOutPointerValid(aProgress); 1178 1133 1179 AutoCaller autoCaller (this); 1180 CheckComRCReturnRC (autoCaller.rc()); 1181 1182 AutoWriteLock alock (this); 1134 AutoWriteLock alock (this); 1135 CHECK_READY(); 1183 1136 1184 1137 /* first check whether an interface with the given name already exists */ … … 1206 1159 CheckComArgOutPointerValid(aFilter); 1207 1160 1208 AutoCaller autoCaller (this); 1209 CheckComRCReturnRC (autoCaller.rc()); 1210 1211 AutoWriteLock alock (this); 1161 AutoWriteLock alock (this); 1162 CHECK_READY(); 1212 1163 1213 1164 ComObjPtr <HostUSBDeviceFilter> filter; … … 1234 1185 1235 1186 /* Note: HostUSBDeviceFilter and USBProxyService also uses this lock. */ 1236 AutoCaller autoCaller (this); 1237 CheckComRCReturnRC (autoCaller.rc()); 1238 1239 AutoWriteLock alock (this); 1187 AutoWriteLock alock (this); 1188 CHECK_READY(); 1240 1189 1241 1190 MultiResult rc = checkUSBProxyService(); … … 1285 1234 1286 1235 /* Note: HostUSBDeviceFilter and USBProxyService also uses this lock. */ 1287 AutoCaller autoCaller (this); 1288 CheckComRCReturnRC (autoCaller.rc()); 1289 1290 AutoWriteLock alock (this); 1236 AutoWriteLock alock (this); 1237 CHECK_READY(); 1291 1238 1292 1239 MultiResult rc = checkUSBProxyService(); … … 1344 1291 using namespace settings; 1345 1292 1346 AutoCaller autoCaller (this); 1347 CheckComRCReturnRC (autoCaller.rc()); 1348 1349 AutoWriteLock alock (this); 1293 AutoWriteLock alock (this); 1294 CHECK_READY(); 1350 1295 1351 1296 AssertReturn (!aGlobal.isNull(), E_FAIL); … … 1408 1353 using namespace settings; 1409 1354 1410 AutoCaller autoCaller (this); 1411 CheckComRCReturnRC (autoCaller.rc()); 1412 1413 AutoWriteLock alock (this); 1355 AutoWriteLock alock (this); 1356 CHECK_READY(); 1414 1357 1415 1358 ComAssertRet (!aGlobal.isNull(), E_FAIL); … … 1488 1431 BOOL aActiveChanged /* = FALSE */) 1489 1432 { 1490 AutoCaller autoCaller (this); 1491 CheckComRCReturnRC (autoCaller.rc()); 1492 1493 AutoWriteLock alock (this); 1433 AutoWriteLock alock (this); 1434 CHECK_READY(); 1494 1435 1495 1436 if (aFilter->mInList) … … 2068 2009 HRESULT Host::checkUSBProxyService() 2069 2010 { 2070 AutoCaller autoCaller (this); 2071 CheckComRCReturnRC (autoCaller.rc()); 2072 2073 AutoWriteLock alock (this); 2011 AutoWriteLock alock (this); 2012 CHECK_READY(); 2074 2013 2075 2014 AssertReturn (mUSBProxyService, E_FAIL);
Note:
See TracChangeset
for help on using the changeset viewer.