Changeset 21622 in vbox
- Timestamp:
- Jul 15, 2009 7:04:07 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 50147
- Location:
- trunk/src/VBox/Main
- Files:
-
- 47 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/ApplianceImpl.cpp
r21612 r21622 345 345 void Appliance::uninit() 346 346 { 347 /* Enclose the state transition Ready->InUninit->NotReady */ 348 AutoUninitSpan autoUninitSpan (this); 349 if (autoUninitSpan.uninitDone()) 350 return; 351 347 352 delete m; 348 353 m = NULL; -
trunk/src/VBox/Main/HostImpl.cpp
r21492 r21622 152 152 void Host::FinalRelease() 153 153 { 154 if (isReady()) 155 uninit(); 154 uninit(); 156 155 } 157 156 … … 164 163 * @param aParent VirtualBox parent object. 165 164 */ 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); 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); 174 172 175 173 mParent = aParent; … … 260 258 #endif /* VBOX_WITH_CROGL */ 261 259 262 setReady(true); 260 /* Confirm a successful initialization */ 261 autoInitSpan.setSucceeded(); 262 263 263 return S_OK; 264 264 } … … 270 270 void Host::uninit() 271 271 { 272 LogFlowThisFunc (("isReady=%d\n", isReady())); 273 274 AssertReturn (isReady(), (void) 0); 272 LogFlowThisFunc (("\n")); 273 274 /* Enclose the state transition Ready->InUninit->NotReady */ 275 AutoUninitSpan autoUninitSpan (this); 276 if (autoUninitSpan.uninitDone()) 277 return; 275 278 276 279 #ifdef VBOX_WITH_RESOURCE_USAGE_API … … 295 298 mUSBDeviceFilters.clear(); 296 299 #endif 297 298 setReady (FALSE);299 300 } 300 301 … … 311 312 { 312 313 CheckComArgOutSafeArrayPointerValid(aDrives); 314 315 AutoCaller autoCaller (this); 316 CheckComRCReturnRC (autoCaller.rc()); 317 313 318 AutoWriteLock alock (this); 314 CHECK_READY(); 315 std::list <ComObjPtr<HostDVDDrive> > list;319 320 std::list< ComObjPtr<HostDVDDrive> > list; 316 321 HRESULT rc = S_OK; 317 322 try … … 439 444 { 440 445 CheckComArgOutPointerValid(aDrives); 441 AutoWriteLock alock (this); 442 CHECK_READY(); 443 444 std::list <ComObjPtr <HostFloppyDrive> > list; 446 447 AutoCaller autoCaller(this); 448 CheckComRCReturnRC(autoCaller.rc()); 449 450 AutoWriteLock alock(this); 451 452 std::list<ComObjPtr <HostFloppyDrive> > list; 445 453 HRESULT rc = S_OK; 446 454 … … 554 562 return E_POINTER; 555 563 564 AutoCaller autoCaller (this); 565 CheckComRCReturnRC (autoCaller.rc()); 566 556 567 AutoWriteLock alock (this); 557 CHECK_READY();558 568 559 569 std::list <ComObjPtr <HostNetworkInterface> > list; … … 833 843 CheckComArgOutSafeArrayPointerValid(aUSBDevices); 834 844 845 AutoCaller autoCaller (this); 846 CheckComRCReturnRC (autoCaller.rc()); 847 835 848 AutoWriteLock alock (this); 836 CHECK_READY();837 849 838 850 MultiResult rc = checkUSBProxyService(); … … 858 870 CheckComArgOutSafeArrayPointerValid(aUSBDeviceFilters); 859 871 872 AutoCaller autoCaller (this); 873 CheckComRCReturnRC (autoCaller.rc()); 874 860 875 AutoWriteLock alock (this); 861 CHECK_READY();862 876 863 877 MultiResult rc = checkUSBProxyService(); … … 889 903 { 890 904 CheckComArgOutPointerValid(aCount); 891 AutoWriteLock alock (this); 892 CHECK_READY(); 905 // AutoCaller autoCaller (this); 906 // CheckComRCReturnRC (autoCaller.rc()); 907 908 // AutoReadLock alock (this); 909 893 910 *aCount = RTMpGetPresentCount(); 894 911 return S_OK; … … 904 921 { 905 922 CheckComArgOutPointerValid(aCount); 906 AutoWriteLock alock (this); 907 CHECK_READY(); 923 // AutoCaller autoCaller (this); 924 // CheckComRCReturnRC (autoCaller.rc()); 925 926 // AutoReadLock alock (this); 927 908 928 *aCount = RTMpGetOnlineCount(); 909 929 return S_OK; … … 920 940 { 921 941 CheckComArgOutPointerValid(aSpeed); 922 AutoWriteLock alock (this); 923 CHECK_READY(); 942 // AutoCaller autoCaller (this); 943 // CheckComRCReturnRC (autoCaller.rc()); 944 945 // AutoReadLock alock (this); 946 924 947 *aSpeed = RTMpGetMaxFrequency(aCpuId); 925 948 return S_OK; … … 935 958 { 936 959 CheckComArgOutPointerValid(aDescription); 937 AutoWriteLock alock (this); 938 CHECK_READY(); 960 // AutoCaller autoCaller (this); 961 // CheckComRCReturnRC (autoCaller.rc()); 962 963 // AutoReadLock alock (this); 964 939 965 /** @todo */ 940 966 ReturnComNotImplemented(); … … 951 977 { 952 978 CheckComArgOutPointerValid(aSupported); 953 AutoWriteLock alock (this); 954 CHECK_READY(); 979 AutoCaller autoCaller (this); 980 CheckComRCReturnRC (autoCaller.rc()); 981 982 AutoReadLock alock (this); 955 983 956 984 switch (aFeature) … … 983 1011 { 984 1012 CheckComArgOutPointerValid(aSize); 1013 AutoCaller autoCaller (this); 1014 CheckComRCReturnRC (autoCaller.rc()); 1015 985 1016 AutoWriteLock alock (this); 986 CHECK_READY(); 1017 987 1018 /* @todo This is an ugly hack. There must be a function in IPRT for that. */ 988 1019 pm::CollectorHAL *hal = pm::createHAL(); … … 1005 1036 { 1006 1037 CheckComArgOutPointerValid(aAvailable); 1038 AutoCaller autoCaller (this); 1039 CheckComRCReturnRC (autoCaller.rc()); 1040 1007 1041 AutoWriteLock alock (this); 1008 CHECK_READY(); 1042 1009 1043 /* @todo This is an ugly hack. There must be a function in IPRT for that. */ 1010 1044 pm::CollectorHAL *hal = pm::createHAL(); … … 1027 1061 { 1028 1062 CheckComArgOutPointerValid(aOs); 1029 AutoWriteLock alock (this); 1030 CHECK_READY(); 1063 // AutoCaller autoCaller (this); 1064 // CheckComRCReturnRC (autoCaller.rc()); 1065 1066 // AutoReadLock alock (this); 1031 1067 1032 1068 char szOSName[80]; … … 1047 1083 { 1048 1084 CheckComArgOutPointerValid(aVersion); 1049 AutoWriteLock alock (this); 1050 CHECK_READY(); 1085 // AutoCaller autoCaller (this); 1086 // CheckComRCReturnRC (autoCaller.rc()); 1087 1088 // AutoReadLock alock (this); 1051 1089 1052 1090 /* Get the OS release. Reserve some buffer space for the service pack. */ … … 1084 1122 { 1085 1123 CheckComArgOutPointerValid(aUTCTime); 1086 AutoWriteLock alock (this); 1087 CHECK_READY(); 1124 // AutoCaller autoCaller (this); 1125 // CheckComRCReturnRC (autoCaller.rc()); 1126 1127 // AutoReadLock alock (this); 1128 1088 1129 RTTIMESPEC now; 1089 1130 *aUTCTime = RTTimeSpecGetMilli(RTTimeNow(&now)); 1131 1090 1132 return S_OK; 1091 1133 } … … 1094 1136 { 1095 1137 CheckComArgOutPointerValid(aSupported); 1096 1097 AutoWriteLock alock(this); 1098 CHECK_READY(); 1138 AutoCaller autoCaller (this); 1139 CheckComRCReturnRC (autoCaller.rc()); 1140 1141 AutoReadLock alock (this); 1099 1142 1100 1143 *aSupported = f3DAccelerationSupported; … … 1112 1155 CheckComArgOutPointerValid(aProgress); 1113 1156 1157 AutoCaller autoCaller (this); 1158 CheckComRCReturnRC (autoCaller.rc()); 1159 1114 1160 AutoWriteLock alock (this); 1115 CHECK_READY();1116 1161 1117 1162 int r = NetIfCreateHostOnlyNetworkInterface (mParent, aHostNetworkInterface, aProgress); … … 1132 1177 CheckComArgOutPointerValid(aProgress); 1133 1178 1179 AutoCaller autoCaller (this); 1180 CheckComRCReturnRC (autoCaller.rc()); 1181 1134 1182 AutoWriteLock alock (this); 1135 CHECK_READY();1136 1183 1137 1184 /* first check whether an interface with the given name already exists */ … … 1159 1206 CheckComArgOutPointerValid(aFilter); 1160 1207 1208 AutoCaller autoCaller (this); 1209 CheckComRCReturnRC (autoCaller.rc()); 1210 1161 1211 AutoWriteLock alock (this); 1162 CHECK_READY();1163 1212 1164 1213 ComObjPtr <HostUSBDeviceFilter> filter; … … 1185 1234 1186 1235 /* Note: HostUSBDeviceFilter and USBProxyService also uses this lock. */ 1236 AutoCaller autoCaller (this); 1237 CheckComRCReturnRC (autoCaller.rc()); 1238 1187 1239 AutoWriteLock alock (this); 1188 CHECK_READY();1189 1240 1190 1241 MultiResult rc = checkUSBProxyService(); … … 1234 1285 1235 1286 /* Note: HostUSBDeviceFilter and USBProxyService also uses this lock. */ 1287 AutoCaller autoCaller (this); 1288 CheckComRCReturnRC (autoCaller.rc()); 1289 1236 1290 AutoWriteLock alock (this); 1237 CHECK_READY();1238 1291 1239 1292 MultiResult rc = checkUSBProxyService(); … … 1291 1344 using namespace settings; 1292 1345 1346 AutoCaller autoCaller (this); 1347 CheckComRCReturnRC (autoCaller.rc()); 1348 1293 1349 AutoWriteLock alock (this); 1294 CHECK_READY();1295 1350 1296 1351 AssertReturn (!aGlobal.isNull(), E_FAIL); … … 1353 1408 using namespace settings; 1354 1409 1410 AutoCaller autoCaller (this); 1411 CheckComRCReturnRC (autoCaller.rc()); 1412 1355 1413 AutoWriteLock alock (this); 1356 CHECK_READY();1357 1414 1358 1415 ComAssertRet (!aGlobal.isNull(), E_FAIL); … … 1431 1488 BOOL aActiveChanged /* = FALSE */) 1432 1489 { 1490 AutoCaller autoCaller (this); 1491 CheckComRCReturnRC (autoCaller.rc()); 1492 1433 1493 AutoWriteLock alock (this); 1434 CHECK_READY();1435 1494 1436 1495 if (aFilter->mInList) … … 2009 2068 HRESULT Host::checkUSBProxyService() 2010 2069 { 2070 AutoCaller autoCaller (this); 2071 CheckComRCReturnRC (autoCaller.rc()); 2072 2011 2073 AutoWriteLock alock (this); 2012 CHECK_READY();2013 2074 2014 2075 AssertReturn (mUSBProxyService, E_FAIL); -
trunk/src/VBox/Main/MachineImpl.cpp
r21607 r21622 5125 5125 5126 5126 /* initialize the snapshot */ 5127 rc = snapshot->init (uuid, name, description, timeStamp, 5128 snapshotMachine, aParentSnapshot); 5129 CheckComRCReturnRC (rc); 5127 rc = snapshot->init(mParent, // VirtualBox object 5128 uuid, 5129 name, 5130 description, 5131 timeStamp, 5132 snapshotMachine, 5133 aParentSnapshot); 5134 CheckComRCReturnRC(rc); 5130 5135 } 5131 5136 … … 9199 9204 ComObjPtr <Snapshot> snapshot; 9200 9205 snapshot.createObject(); 9201 rc = snapshot->init (snapshotId, aName, aDescription, 9202 *RTTimeNow (&time), snapshotMachine, 9203 mData->mCurrentSnapshot); 9206 rc = snapshot->init(mParent, 9207 snapshotId, 9208 aName, 9209 aDescription, 9210 *RTTimeNow(&time), 9211 snapshotMachine, 9212 mData->mCurrentSnapshot); 9204 9213 AssertComRCReturnRC (rc); 9205 9214 -
trunk/src/VBox/Main/SnapshotImpl.cpp
r21404 r21622 65 65 * @param aParent parent snapshot (NULL if no parent) 66 66 */ 67 HRESULT Snapshot::init (const Guid &aId, IN_BSTR aName, IN_BSTR aDescription, 68 RTTIMESPEC aTimeStamp, SnapshotMachine *aMachine, 69 Snapshot *aParent) 67 HRESULT Snapshot::init(VirtualBox *aVirtualBox, 68 const Guid &aId, 69 IN_BSTR aName, 70 IN_BSTR aDescription, 71 RTTIMESPEC aTimeStamp, 72 SnapshotMachine *aMachine, 73 Snapshot *aParent) 70 74 { 71 75 LogFlowMember (("Snapshot::init(aParent=%p)\n", aParent)); … … 73 77 ComAssertRet (!aId.isEmpty() && aName && aMachine, E_INVALIDARG); 74 78 75 AutoWriteLock alock (this); 76 ComAssertRet (!isReady(), E_FAIL); 79 /* Enclose the state transition NotReady->InInit->Ready */ 80 AutoInitSpan autoInitSpan (this); 81 AssertReturn (autoInitSpan.isOk(), E_FAIL); 82 83 /* share parent weakly */ 84 unconst (mVirtualBox) = aVirtualBox; 77 85 78 86 mParent = aParent; … … 87 95 aParent->addDependentChild (this); 88 96 89 setReady (true); 97 /* Confirm a successful initialization when it's the case */ 98 autoInitSpan.setSucceeded(); 90 99 91 100 return S_OK; … … 101 110 LogFlowMember (("Snapshot::uninit()\n")); 102 111 103 AutoWriteLock alock (this); 104 105 LogFlowMember (("Snapshot::uninit(): isReady=%d\n", isReady())); 106 if (!isReady()) 107 return; 112 /* Enclose the state transition Ready->InUninit->NotReady */ 113 // AutoUninitSpan autoUninitSpan (this); @todo this creates a deadlock, investigate what this does actually 114 // if (autoUninitSpan.uninitDone()) 115 // return; 108 116 109 117 // uninit all children 110 118 uninitDependentChildren(); 111 119 112 setReady (false);113 114 120 if (mParent) 115 121 { 116 alock.leave();117 122 mParent->removeDependentChild (this); 118 alock.enter();119 123 mParent.setNull(); 120 124 } … … 134 138 void Snapshot::discard() 135 139 { 136 LogFlowMember (("Snapshot::discard()\n")); 140 AutoCaller autoCaller (this); 141 if (FAILED(autoCaller.rc())) 142 return; 137 143 138 144 AutoWriteLock alock (this); 139 AssertReturn (isReady(), (void) 0);140 145 141 146 { … … 169 174 CheckComArgOutPointerValid(aId); 170 175 171 AutoWriteLock alock (this); 172 CHECK_READY(); 176 AutoCaller autoCaller (this); 177 CheckComRCReturnRC (autoCaller.rc()); 178 179 AutoReadLock alock (this); 173 180 174 181 mData.mId.toUtf16().cloneTo (aId); … … 180 187 CheckComArgOutPointerValid(aName); 181 188 182 AutoWriteLock alock (this); 183 CHECK_READY(); 189 AutoCaller autoCaller (this); 190 CheckComRCReturnRC (autoCaller.rc()); 191 192 AutoReadLock alock (this); 184 193 185 194 mData.mName.cloneTo (aName); … … 195 204 CheckComArgNotNull(aName); 196 205 206 AutoCaller autoCaller (this); 207 CheckComRCReturnRC (autoCaller.rc()); 208 197 209 AutoWriteLock alock (this); 198 CHECK_READY();199 210 200 211 if (mData.mName != aName) … … 214 225 CheckComArgOutPointerValid(aDescription); 215 226 227 AutoCaller autoCaller (this); 228 CheckComRCReturnRC (autoCaller.rc()); 229 230 AutoReadLock alock (this); 231 232 mData.mDescription.cloneTo (aDescription); 233 return S_OK; 234 } 235 236 STDMETHODIMP Snapshot::COMSETTER(Description) (IN_BSTR aDescription) 237 { 238 CheckComArgNotNull(aDescription); 239 240 AutoCaller autoCaller (this); 241 CheckComRCReturnRC (autoCaller.rc()); 242 216 243 AutoWriteLock alock (this); 217 CHECK_READY();218 219 mData.mDescription.cloneTo (aDescription);220 return S_OK;221 }222 223 STDMETHODIMP Snapshot::COMSETTER(Description) (IN_BSTR aDescription)224 {225 CheckComArgNotNull(aDescription);226 227 AutoWriteLock alock (this);228 CHECK_READY();229 244 230 245 if (mData.mDescription != aDescription) … … 244 259 CheckComArgOutPointerValid(aTimeStamp); 245 260 246 AutoWriteLock alock (this); 247 CHECK_READY(); 261 AutoCaller autoCaller (this); 262 CheckComRCReturnRC (autoCaller.rc()); 263 264 AutoReadLock alock (this); 248 265 249 266 *aTimeStamp = RTTimeSpecGetMilli (&mData.mTimeStamp); … … 255 272 CheckComArgOutPointerValid(aOnline); 256 273 257 AutoWriteLock alock (this); 258 CHECK_READY(); 274 AutoCaller autoCaller (this); 275 CheckComRCReturnRC (autoCaller.rc()); 276 277 AutoReadLock alock (this); 259 278 260 279 *aOnline = !stateFilePath().isNull(); … … 266 285 CheckComArgOutPointerValid(aMachine); 267 286 268 AutoWriteLock alock (this); 269 CHECK_READY(); 287 AutoCaller autoCaller (this); 288 CheckComRCReturnRC (autoCaller.rc()); 289 290 AutoReadLock alock (this); 270 291 271 292 mData.mMachine.queryInterfaceTo (aMachine); … … 277 298 CheckComArgOutPointerValid(aParent); 278 299 279 AutoWriteLock alock (this); 280 CHECK_READY(); 300 AutoCaller autoCaller (this); 301 CheckComRCReturnRC (autoCaller.rc()); 302 303 AutoReadLock alock (this); 281 304 282 305 mParent.queryInterfaceTo (aParent); … … 288 311 CheckComArgOutSafeArrayPointerValid(aChildren); 289 312 290 AutoWriteLock alock (this); 291 CHECK_READY(); 292 293 AutoWriteLock chLock (childrenLock ()); 313 AutoCaller autoCaller (this); 314 CheckComRCReturnRC (autoCaller.rc()); 315 316 AutoReadLock alock (this); 317 AutoReadLock chLock (childrenLock ()); 294 318 295 319 SafeIfaceArray <ISnapshot> collection (children()); … … 317 341 ULONG Snapshot::descendantCount() 318 342 { 319 AutoWriteLock alock(this); 320 AssertReturn (isReady(), 0); 321 322 AutoWriteLock chLock (childrenLock ()); 343 AutoCaller autoCaller (this); 344 AssertComRC(autoCaller.rc()); 345 346 AutoReadLock alock (this); 347 348 AutoReadLock chLock (childrenLock ()); 323 349 324 350 ULONG count = (ULONG)children().size(); … … 337 363 * etc. of this snapshot. This snapshot itself is also included in the search. 338 364 */ 339 ComObjPtr 365 ComObjPtr<Snapshot> Snapshot::findChildOrSelf (IN_GUID aId) 340 366 { 341 367 ComObjPtr <Snapshot> child; 342 368 343 AutoWriteLock alock (this); 344 AssertReturn (isReady(), child); 369 AutoCaller autoCaller (this); 370 AssertComRC(autoCaller.rc()); 371 372 AutoReadLock alock (this); 345 373 346 374 if (mData.mId == aId) … … 369 397 AssertReturn (aName, child); 370 398 371 AutoWriteLock alock (this); 372 AssertReturn (isReady(), child); 399 AutoCaller autoCaller (this); 400 AssertComRC(autoCaller.rc()); 401 402 AutoReadLock alock (this); 373 403 374 404 if (mData.mName == aName) … … 405 435 AssertReturnVoid (aNewPath); 406 436 437 AutoCaller autoCaller (this); 438 AssertComRC(autoCaller.rc()); 439 407 440 AutoWriteLock alock (this); 408 AssertReturnVoid (isReady());409 441 410 442 Utf8Str path = mData.mMachine->mSSData->mStateFilePath; … … 430 462 } 431 463 432 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ 464 /** 465 * Returns VirtualBox::mSnapshotsTreeLockHandle(), for convenience. Don't forget 466 * to follow these locking rules: 467 * 468 * 1. The write lock on this handle must be either held alone on the thread 469 * or requested *after* the VirtualBox object lock. Mixing with other 470 * locks is prohibited. 471 * 472 * 2. The read lock on this handle may be intermixed with any other lock 473 * with the exception that it must be requested *after* the VirtualBox 474 * object lock. 475 */ 476 RWLockHandle* Snapshot::treeLock() 477 { 478 return mVirtualBox->snapshotTreeLockHandle(); 479 } 480 481 /** Reimplements VirtualBoxWithTypedChildren::childrenLock() to return 482 * treeLock(). */ 483 RWLockHandle* Snapshot::childrenLock() 484 { 485 return treeLock(); 486 } 487 488 -
trunk/src/VBox/Main/USBControllerImpl.cpp
r20976 r21622 317 317 class ATL_NO_VTABLE USBDeviceFilter : 318 318 public VirtualBoxBaseNEXT, 319 public VirtualBoxSupportErrorInfoImpl 320 public VirtualBoxSupportTranslation 319 public VirtualBoxSupportErrorInfoImpl<USBDeviceFilter, IUSBDeviceFilter>, 320 public VirtualBoxSupportTranslation<USBDeviceFilter>, 321 321 public IUSBDeviceFilter 322 322 { -
trunk/src/VBox/Main/VirtualBoxBase.cpp
r17911 r21622 1153 1153 * @note Locks #childrenLock() for reading. 1154 1154 */ 1155 VirtualBoxBaseNEXT * 1156 VirtualBoxBaseWithChildrenNEXT::getDependentChild (const ComPtr <IUnknown> &aUnk) 1155 VirtualBoxBase* VirtualBoxBaseWithChildrenNEXT::getDependentChild(const ComPtr<IUnknown> &aUnk) 1157 1156 { 1158 1157 AssertReturn (!aUnk.isNull(), NULL); … … 1174 1173 1175 1174 /** Helper for addDependentChild(). */ 1176 void VirtualBoxBaseWithChildrenNEXT::doAddDependentChild (1177 IUnknown *aUnk, VirtualBoxBaseNEXT*aChild)1175 void VirtualBoxBaseWithChildrenNEXT::doAddDependentChild(IUnknown *aUnk, 1176 VirtualBoxBase *aChild) 1178 1177 { 1179 1178 AssertReturnVoid (aUnk != NULL); -
trunk/src/VBox/Main/include/ApplianceImpl.h
r21612 r21622 34 34 class ATL_NO_VTABLE Appliance : 35 35 public VirtualBoxBaseWithChildrenNEXT, 36 public VirtualBoxSupportErrorInfoImpl 37 public VirtualBoxSupportTranslation 36 public VirtualBoxSupportErrorInfoImpl<Appliance, IAppliance>, 37 public VirtualBoxSupportTranslation<Appliance>, 38 38 VBOX_SCRIPTABLE_IMPL(IAppliance) 39 39 { … … 142 142 143 143 class ATL_NO_VTABLE VirtualSystemDescription : 144 public VirtualBoxBaseWithChildren NEXT,145 public VirtualBoxSupportErrorInfoImpl 146 public VirtualBoxSupportTranslation 144 public VirtualBoxBaseWithChildren, 145 public VirtualBoxSupportErrorInfoImpl<VirtualSystemDescription, IVirtualSystemDescription>, 146 public VirtualBoxSupportTranslation<VirtualSystemDescription>, 147 147 VBOX_SCRIPTABLE_IMPL(IVirtualSystemDescription) 148 148 { -
trunk/src/VBox/Main/include/AudioAdapterImpl.h
r19239 r21622 30 30 31 31 class ATL_NO_VTABLE AudioAdapter : 32 public VirtualBoxBase NEXT,33 public VirtualBoxSupportErrorInfoImpl 34 public VirtualBoxSupportTranslation 32 public VirtualBoxBase, 33 public VirtualBoxSupportErrorInfoImpl<AudioAdapter, IAudioAdapter>, 34 public VirtualBoxSupportTranslation<AudioAdapter>, 35 35 VBOX_SCRIPTABLE_IMPL(IAudioAdapter) 36 36 { -
trunk/src/VBox/Main/include/BIOSSettingsImpl.h
r19239 r21622 31 31 32 32 class ATL_NO_VTABLE BIOSSettings : 33 public VirtualBoxSupportErrorInfoImpl 34 public VirtualBoxSupportTranslation 35 public VirtualBoxBase NEXT,33 public VirtualBoxSupportErrorInfoImpl<BIOSSettings, IBIOSSettings>, 34 public VirtualBoxSupportTranslation<BIOSSettings>, 35 public VirtualBoxBase, 36 36 VBOX_SCRIPTABLE_IMPL(IBIOSSettings) 37 37 { -
trunk/src/VBox/Main/include/ConsoleImpl.h
r21173 r21622 79 79 class ATL_NO_VTABLE Console : 80 80 public VirtualBoxBaseWithChildrenNEXT, 81 public VirtualBoxSupportErrorInfoImpl 82 public VirtualBoxSupportTranslation 81 public VirtualBoxSupportErrorInfoImpl<Console, IConsole>, 82 public VirtualBoxSupportTranslation<Console>, 83 83 VBOX_SCRIPTABLE_IMPL(IConsole) 84 84 { -
trunk/src/VBox/Main/include/ConsoleVRDPServer.h
r19239 r21622 233 233 234 234 class ATL_NO_VTABLE RemoteDisplayInfo : 235 public VirtualBoxBase NEXT,236 public VirtualBoxSupportErrorInfoImpl 237 public VirtualBoxSupportTranslation 235 public VirtualBoxBase, 236 public VirtualBoxSupportErrorInfoImpl<RemoteDisplayInfo, IRemoteDisplayInfo>, 237 public VirtualBoxSupportTranslation<RemoteDisplayInfo>, 238 238 VBOX_SCRIPTABLE_IMPL(IRemoteDisplayInfo) 239 239 { -
trunk/src/VBox/Main/include/DHCPServerImpl.h
r19239 r21622 35 35 36 36 class ATL_NO_VTABLE DHCPServer : 37 public VirtualBoxBase NEXT,38 public VirtualBoxSupportErrorInfoImpl 39 public VirtualBoxSupportTranslation 37 public VirtualBoxBase, 38 public VirtualBoxSupportErrorInfoImpl<DHCPServer, IDHCPServer>, 39 public VirtualBoxSupportTranslation<DHCPServer>, 40 40 VBOX_SCRIPTABLE_IMPL(IDHCPServer) 41 41 { -
trunk/src/VBox/Main/include/DVDDriveImpl.h
r19239 r21622 32 32 33 33 class ATL_NO_VTABLE DVDDrive : 34 public VirtualBoxBase NEXT,35 public VirtualBoxSupportErrorInfoImpl 36 public VirtualBoxSupportTranslation 34 public VirtualBoxBase, 35 public VirtualBoxSupportErrorInfoImpl<DVDDrive, IDVDDrive>, 36 public VirtualBoxSupportTranslation<DVDDrive>, 37 37 VBOX_SCRIPTABLE_IMPL(IDVDDrive) 38 38 { -
trunk/src/VBox/Main/include/DisplayImpl.h
r21227 r21622 83 83 84 84 class ATL_NO_VTABLE Display : 85 public VirtualBoxBase NEXT,85 public VirtualBoxBase, 86 86 VBOX_SCRIPTABLE_IMPL(IConsoleCallback), 87 public VirtualBoxSupportErrorInfoImpl 88 public VirtualBoxSupportTranslation 87 public VirtualBoxSupportErrorInfoImpl<Display, IDisplay>, 88 public VirtualBoxSupportTranslation<Display>, 89 89 VBOX_SCRIPTABLE_IMPL(IDisplay) 90 90 { -
trunk/src/VBox/Main/include/FloppyDriveImpl.h
r19239 r21622 32 32 33 33 class ATL_NO_VTABLE FloppyDrive : 34 public VirtualBoxBase NEXT,35 public VirtualBoxSupportErrorInfoImpl 36 public VirtualBoxSupportTranslation 34 public VirtualBoxBase, 35 public VirtualBoxSupportErrorInfoImpl<FloppyDrive, IFloppyDrive>, 36 public VirtualBoxSupportTranslation<FloppyDrive>, 37 37 VBOX_SCRIPTABLE_IMPL(IFloppyDrive) 38 38 { -
trunk/src/VBox/Main/include/FramebufferImpl.h
r21465 r21622 29 29 30 30 class ATL_NO_VTABLE Framebuffer : 31 public VirtualBoxBase NEXT,32 public VirtualBoxSupportErrorInfoImpl 33 public VirtualBoxSupportTranslation 31 public VirtualBoxBase, 32 public VirtualBoxSupportErrorInfoImpl<Framebuffer, IFramebuffer>, 33 public VirtualBoxSupportTranslation<Framebuffer>, 34 34 VBOX_SCRIPTABLE_IMPL(IFramebuffer) 35 35 { … … 76 76 BOOL *aSupported) = 0; 77 77 78 STDMETHOD(GetVisibleRegion)(BYTE *aRectangles, ULONG aCount, 79 ULONG *aCountCopied) = 0; 78 STDMETHOD(GetVisibleRegion)(BYTE *aRectangles, ULONG aCount, 79 ULONG *aCountCopied) = 0; 80 80 STDMETHOD(SetVisibleRegion)(BYTE *aRectangles, ULONG aCount) = 0; 81 81 -
trunk/src/VBox/Main/include/GuestImpl.h
r19239 r21622 31 31 32 32 class ATL_NO_VTABLE Guest : 33 public VirtualBoxSupportErrorInfoImpl 34 public VirtualBoxSupportTranslation 35 public VirtualBoxBase NEXT,33 public VirtualBoxSupportErrorInfoImpl<Guest, IGuest>, 34 public VirtualBoxSupportTranslation<Guest>, 35 public VirtualBoxBase, 36 36 VBOX_SCRIPTABLE_IMPL(IGuest) 37 37 { -
trunk/src/VBox/Main/include/GuestOSTypeImpl.h
r21607 r21622 29 29 30 30 class ATL_NO_VTABLE GuestOSType : 31 public VirtualBoxBase NEXT,32 public VirtualBoxSupportErrorInfoImpl 33 public VirtualBoxSupportTranslation 31 public VirtualBoxBase, 32 public VirtualBoxSupportErrorInfoImpl<GuestOSType, IGuestOSType>, 33 public VirtualBoxSupportTranslation<GuestOSType>, 34 34 VBOX_SCRIPTABLE_IMPL(IGuestOSType) 35 35 { -
trunk/src/VBox/Main/include/HardDiskAttachmentImpl.h
r19239 r21622 28 28 29 29 class ATL_NO_VTABLE HardDiskAttachment : 30 public VirtualBoxBase NEXT,30 public VirtualBoxBase, 31 31 public com::SupportErrorInfoImpl<HardDiskAttachment, IHardDiskAttachment>, 32 32 public VirtualBoxSupportTranslation<HardDiskAttachment>, -
trunk/src/VBox/Main/include/HardDiskFormatImpl.h
r19239 r21622 43 43 */ 44 44 class ATL_NO_VTABLE HardDiskFormat : 45 public VirtualBoxBase NEXT,46 public VirtualBoxSupportErrorInfoImpl 47 public VirtualBoxSupportTranslation 45 public VirtualBoxBase, 46 public VirtualBoxSupportErrorInfoImpl<HardDiskFormat, IHardDiskFormat>, 47 public VirtualBoxSupportTranslation<HardDiskFormat>, 48 48 VBOX_SCRIPTABLE_IMPL(IHardDiskFormat) 49 49 { -
trunk/src/VBox/Main/include/HardDiskImpl.h
r20842 r21622 46 46 class ATL_NO_VTABLE HardDisk 47 47 : public com::SupportErrorInfoDerived<MediumBase, HardDisk, IHardDisk> 48 , public VirtualBoxBaseWithTypedChildren NEXT<HardDisk>48 , public VirtualBoxBaseWithTypedChildren<HardDisk> 49 49 , public VirtualBoxSupportTranslation<HardDisk> 50 50 , VBOX_SCRIPTABLE_IMPL(IHardDisk) … … 52 52 public: 53 53 54 typedef VirtualBoxBaseWithTypedChildrenNEXT <HardDisk>::DependentChildren 55 List; 54 typedef VirtualBoxBaseWithTypedChildren<HardDisk>::DependentChildren List; 56 55 57 56 class MergeChain; -
trunk/src/VBox/Main/include/HostDVDDriveImpl.h
r19239 r21622 26 26 27 27 class ATL_NO_VTABLE HostDVDDrive : 28 public VirtualBoxBase NEXT,29 public VirtualBoxSupportErrorInfoImpl 30 public VirtualBoxSupportTranslation 28 public VirtualBoxBase, 29 public VirtualBoxSupportErrorInfoImpl<HostDVDDrive, IHostDVDDrive>, 30 public VirtualBoxSupportTranslation<HostDVDDrive>, 31 31 VBOX_SCRIPTABLE_IMPL(IHostDVDDrive) 32 32 { -
trunk/src/VBox/Main/include/HostFloppyDriveImpl.h
r19239 r21622 26 26 27 27 class ATL_NO_VTABLE HostFloppyDrive : 28 public VirtualBoxBase NEXT,29 public VirtualBoxSupportErrorInfoImpl 30 public VirtualBoxSupportTranslation 28 public VirtualBoxBase, 29 public VirtualBoxSupportErrorInfoImpl<HostFloppyDrive, IHostFloppyDrive>, 30 public VirtualBoxSupportTranslation<HostFloppyDrive>, 31 31 VBOX_SCRIPTABLE_IMPL(IHostFloppyDrive) 32 32 { -
trunk/src/VBox/Main/include/HostImpl.h
r20042 r21622 52 52 class ATL_NO_VTABLE Host : 53 53 public VirtualBoxBaseWithChildren, 54 public VirtualBoxSupportErrorInfoImpl 55 public VirtualBoxSupportTranslation 54 public VirtualBoxSupportErrorInfoImpl<Host, IHost>, 55 public VirtualBoxSupportTranslation<Host>, 56 56 VBOX_SCRIPTABLE_IMPL(IHost) 57 57 { -
trunk/src/VBox/Main/include/HostNetworkInterfaceImpl.h
r19239 r21622 35 35 36 36 class ATL_NO_VTABLE HostNetworkInterface : 37 public VirtualBoxBase NEXT,38 public VirtualBoxSupportErrorInfoImpl 39 public VirtualBoxSupportTranslation 37 public VirtualBoxBase, 38 public VirtualBoxSupportErrorInfoImpl<HostNetworkInterface, IHostNetworkInterface>, 39 public VirtualBoxSupportTranslation<HostNetworkInterface>, 40 40 VBOX_SCRIPTABLE_IMPL(IHostNetworkInterface) 41 41 { -
trunk/src/VBox/Main/include/KeyboardImpl.h
r19239 r21622 48 48 49 49 class ATL_NO_VTABLE Keyboard : 50 public VirtualBoxBase NEXT,51 public VirtualBoxSupportErrorInfoImpl 52 public VirtualBoxSupportTranslation 50 public VirtualBoxBase, 51 public VirtualBoxSupportErrorInfoImpl<Keyboard, IKeyboard>, 52 public VirtualBoxSupportTranslation<Keyboard>, 53 53 VBOX_SCRIPTABLE_IMPL(IKeyboard) 54 54 { -
trunk/src/VBox/Main/include/MachineDebuggerImpl.h
r19239 r21622 30 30 31 31 class ATL_NO_VTABLE MachineDebugger : 32 public VirtualBoxBase NEXT,33 public VirtualBoxSupportErrorInfoImpl 34 public VirtualBoxSupportTranslation 32 public VirtualBoxBase, 33 public VirtualBoxSupportErrorInfoImpl<MachineDebugger, IMachineDebugger>, 34 public VirtualBoxSupportTranslation<MachineDebugger>, 35 35 VBOX_SCRIPTABLE_IMPL(IMachineDebugger) 36 36 { -
trunk/src/VBox/Main/include/MachineImpl.h
r21446 r21622 78 78 class ATL_NO_VTABLE Machine : 79 79 public VirtualBoxBaseWithChildrenNEXT, 80 public VirtualBoxSupportErrorInfoImpl 81 public VirtualBoxSupportTranslation 80 public VirtualBoxSupportErrorInfoImpl<Machine, IMachine>, 81 public VirtualBoxSupportTranslation<Machine>, 82 82 VBOX_SCRIPTABLE_IMPL(IMachine) 83 83 { … … 873 873 */ 874 874 class ATL_NO_VTABLE SessionMachine : 875 public VirtualBoxSupportTranslation 875 public VirtualBoxSupportTranslation<SessionMachine>, 876 876 public Machine, 877 877 VBOX_SCRIPTABLE_IMPL(IInternalMachineControl) … … 1048 1048 */ 1049 1049 class ATL_NO_VTABLE SnapshotMachine : 1050 public VirtualBoxSupportTranslation 1050 public VirtualBoxSupportTranslation<SnapshotMachine>, 1051 1051 public Machine 1052 1052 { -
trunk/src/VBox/Main/include/MediumImpl.h
r19239 r21622 47 47 virtual public VirtualBoxBaseProto, 48 48 public com::SupportErrorInfoBase, 49 public VirtualBoxSupportTranslation 49 public VirtualBoxSupportTranslation<MediumBase>, 50 50 VBOX_SCRIPTABLE_IMPL(IMedium) 51 51 { … … 212 212 class ATL_NO_VTABLE ImageMediumBase 213 213 : public MediumBase 214 , public VirtualBoxBase NEXT214 , public VirtualBoxBase 215 215 { 216 216 public: … … 293 293 */ 294 294 class ATL_NO_VTABLE FloppyImage 295 : public com::SupportErrorInfoDerived 296 , public VirtualBoxSupportTranslation 295 : public com::SupportErrorInfoDerived<ImageMediumBase, FloppyImage, IFloppyImage> 296 , public VirtualBoxSupportTranslation<FloppyImage> 297 297 , VBOX_SCRIPTABLE_IMPL(IFloppyImage) 298 298 { -
trunk/src/VBox/Main/include/MouseImpl.h
r19614 r21622 50 50 51 51 class ATL_NO_VTABLE Mouse : 52 public VirtualBoxBase NEXT,53 public VirtualBoxSupportErrorInfoImpl 54 public VirtualBoxSupportTranslation 52 public VirtualBoxBase, 53 public VirtualBoxSupportErrorInfoImpl<Mouse, IMouse>, 54 public VirtualBoxSupportTranslation<Mouse>, 55 55 VBOX_SCRIPTABLE_IMPL(IMouse) 56 56 { -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r19239 r21622 31 31 32 32 class ATL_NO_VTABLE NetworkAdapter : 33 public VirtualBoxBase NEXT,34 public VirtualBoxSupportErrorInfoImpl 35 public VirtualBoxSupportTranslation 33 public VirtualBoxBase, 34 public VirtualBoxSupportErrorInfoImpl<NetworkAdapter, INetworkAdapter>, 35 public VirtualBoxSupportTranslation<NetworkAdapter>, 36 36 VBOX_SCRIPTABLE_IMPL(INetworkAdapter) 37 37 { -
trunk/src/VBox/Main/include/ParallelPortImpl.h
r19239 r21622 29 29 30 30 class ATL_NO_VTABLE ParallelPort : 31 public VirtualBoxBase NEXT,32 public VirtualBoxSupportErrorInfoImpl 33 public VirtualBoxSupportTranslation 31 public VirtualBoxBase, 32 public VirtualBoxSupportErrorInfoImpl<ParallelPort, IParallelPort>, 33 public VirtualBoxSupportTranslation<ParallelPort>, 34 34 VBOX_SCRIPTABLE_IMPL(IParallelPort) 35 35 { -
trunk/src/VBox/Main/include/PerformanceImpl.h
r21395 r21622 52 52 53 53 class ATL_NO_VTABLE PerformanceMetric : 54 public VirtualBoxBase NEXT,55 public VirtualBoxSupportTranslation 54 public VirtualBoxBase, 55 public VirtualBoxSupportTranslation<PerformanceMetric>, 56 56 VBOX_SCRIPTABLE_IMPL(IPerformanceMetric) 57 57 { … … 121 121 122 122 class ATL_NO_VTABLE PerformanceCollector : 123 public VirtualBoxBase NEXT,124 public VirtualBoxSupportErrorInfoImpl 125 public VirtualBoxSupportTranslation 123 public VirtualBoxBase, 124 public VirtualBoxSupportErrorInfoImpl<PerformanceCollector, IPerformanceCollector>, 125 public VirtualBoxSupportTranslation<PerformanceCollector>, 126 126 VBOX_SCRIPTABLE_IMPL(IPerformanceCollector) 127 127 { -
trunk/src/VBox/Main/include/ProgressImpl.h
r20220 r21622 40 40 */ 41 41 class ATL_NO_VTABLE ProgressBase : 42 public VirtualBoxBase NEXT,42 public VirtualBoxBase, 43 43 public com::SupportErrorInfoBase, 44 public VirtualBoxSupportTranslation 44 public VirtualBoxSupportTranslation<ProgressBase>, 45 45 VBOX_SCRIPTABLE_IMPL(IProgress) 46 46 { … … 133 133 */ 134 134 class ATL_NO_VTABLE Progress : 135 public com::SupportErrorInfoDerived 136 public VirtualBoxSupportTranslation 135 public com::SupportErrorInfoDerived<ProgressBase, Progress, IProgress>, 136 public VirtualBoxSupportTranslation<Progress> 137 137 { 138 138 … … 305 305 */ 306 306 class ATL_NO_VTABLE CombinedProgress : 307 public com::SupportErrorInfoDerived 308 public VirtualBoxSupportTranslation 307 public com::SupportErrorInfoDerived<ProgressBase, CombinedProgress, IProgress>, 308 public VirtualBoxSupportTranslation<CombinedProgress> 309 309 { 310 310 -
trunk/src/VBox/Main/include/RemoteUSBDeviceImpl.h
r19239 r21622 32 32 33 33 class ATL_NO_VTABLE RemoteUSBDevice : 34 public VirtualBoxBase NEXT,35 public VirtualBoxSupportErrorInfoImpl 36 public VirtualBoxSupportTranslation 34 public VirtualBoxBase, 35 public VirtualBoxSupportErrorInfoImpl<RemoteUSBDevice, IHostUSBDevice>, 36 public VirtualBoxSupportTranslation<RemoteUSBDevice>, 37 37 VBOX_SCRIPTABLE_IMPL(IHostUSBDevice) 38 38 { -
trunk/src/VBox/Main/include/SerialPortImpl.h
r21607 r21622 31 31 32 32 class ATL_NO_VTABLE SerialPort : 33 public VirtualBoxBase NEXT,34 public VirtualBoxSupportErrorInfoImpl 35 public VirtualBoxSupportTranslation 33 public VirtualBoxBase, 34 public VirtualBoxSupportErrorInfoImpl<SerialPort, ISerialPort>, 35 public VirtualBoxSupportTranslation<SerialPort>, 36 36 VBOX_SCRIPTABLE_IMPL(ISerialPort) 37 37 { -
trunk/src/VBox/Main/include/SessionImpl.h
r21520 r21622 42 42 43 43 class ATL_NO_VTABLE Session : 44 public VirtualBoxBase NEXT,45 public VirtualBoxSupportErrorInfoImpl 46 public VirtualBoxSupportTranslation 44 public VirtualBoxBase, 45 public VirtualBoxSupportErrorInfoImpl<Session, ISession>, 46 public VirtualBoxSupportTranslation<Session>, 47 47 VBOX_SCRIPTABLE_IMPL(ISession), 48 48 VBOX_SCRIPTABLE_IMPL(IInternalSessionControl) … … 62 62 BEGIN_COM_MAP(Session) 63 63 COM_INTERFACE_ENTRY2(IDispatch, ISession) 64 COM_INTERFACE_ENTRY2(IDispatch, IInternalSessionControl) 64 COM_INTERFACE_ENTRY2(IDispatch, IInternalSessionControl) 65 65 COM_INTERFACE_ENTRY(IInternalSessionControl) 66 66 COM_INTERFACE_ENTRY(ISupportErrorInfo) -
trunk/src/VBox/Main/include/SharedFolderImpl.h
r19239 r21622 31 31 32 32 class ATL_NO_VTABLE SharedFolder : 33 public VirtualBoxBase NEXT,34 public VirtualBoxSupportErrorInfoImpl 35 public VirtualBoxSupportTranslation 33 public VirtualBoxBase, 34 public VirtualBoxSupportErrorInfoImpl<SharedFolder, ISharedFolder>, 35 public VirtualBoxSupportTranslation<SharedFolder>, 36 36 VBOX_SCRIPTABLE_IMPL(ISharedFolder) 37 37 { -
trunk/src/VBox/Main/include/SnapshotImpl.h
r19239 r21622 30 30 31 31 class SnapshotMachine; 32 class VirtualBox; 32 33 33 34 class ATL_NO_VTABLE Snapshot : 34 public VirtualBoxSupportErrorInfoImpl 35 public VirtualBoxSupportTranslation 36 public VirtualBoxBaseWithTypedChildren 35 public VirtualBoxSupportErrorInfoImpl<Snapshot, ISnapshot>, 36 public VirtualBoxSupportTranslation<Snapshot>, 37 public VirtualBoxBaseWithTypedChildren<Snapshot>, 37 38 VBOX_SCRIPTABLE_IMPL(ISnapshot) 38 39 { … … 51 52 }; 52 53 53 typedef VirtualBoxBaseWithTypedChildren <Snapshot>::DependentChildren 54 SnapshotList; 54 typedef VirtualBoxBaseWithTypedChildren<Snapshot>::DependentChildren SnapshotList; 55 55 56 56 DECLARE_NOT_AGGREGATABLE(Snapshot) … … 66 66 NS_DECL_ISUPPORTS 67 67 68 Snapshot() 69 { }; 70 ~Snapshot() 71 { }; 72 68 73 HRESULT FinalConstruct(); 69 74 void FinalRelease(); 70 75 71 76 // public initializer/uninitializer only for internal purposes 72 HRESULT init (const Guid &aId, IN_BSTR aName, IN_BSTR aDescription, 73 RTTIMESPEC aTimeStamp, SnapshotMachine *aMachine, 74 Snapshot *aParent); 77 HRESULT init(VirtualBox *aVirtualBox, 78 const Guid &aId, 79 IN_BSTR aName, 80 IN_BSTR aDescription, 81 RTTIMESPEC aTimeStamp, 82 SnapshotMachine *aMachine, 83 Snapshot *aParent); 75 84 void uninit(); 76 85 … … 100 109 ComObjPtr <Snapshot> parent() const { return (Snapshot *) mParent; } 101 110 102 /** Shortcut to #dependentChildrenLock() */103 RWLockHandle *childrenLock() const { return dependentChildrenLock(); }104 105 111 /** 106 112 * Shortcut to #dependentChildren(). … … 118 124 static const wchar_t *getComponentName() { return L"Snapshot"; } 119 125 126 RWLockHandle *treeLock(); 127 RWLockHandle *childrenLock(); 128 120 129 private: 121 130 122 ComObjPtr <Snapshot, ComWeakRef> mParent; 131 /** weak VirtualBox parent */ 132 const ComObjPtr<VirtualBox, ComWeakRef> mVirtualBox; 133 134 ComObjPtr<Snapshot, ComWeakRef> mParent; 123 135 124 136 Data mData; -
trunk/src/VBox/Main/include/StorageControllerImpl.h
r19239 r21622 33 33 class ATL_NO_VTABLE StorageController : 34 34 public VirtualBoxBaseWithChildrenNEXT, 35 public VirtualBoxSupportErrorInfoImpl 36 public VirtualBoxSupportTranslation 35 public VirtualBoxSupportErrorInfoImpl<StorageController, IStorageController>, 36 public VirtualBoxSupportTranslation<StorageController>, 37 37 VBOX_SCRIPTABLE_IMPL(IStorageController) 38 38 { -
trunk/src/VBox/Main/include/SystemPropertiesImpl.h
r21446 r21622 35 35 36 36 class ATL_NO_VTABLE SystemProperties : 37 public VirtualBoxBase NEXT,38 public VirtualBoxSupportErrorInfoImpl 39 public VirtualBoxSupportTranslation 37 public VirtualBoxBase, 38 public VirtualBoxSupportErrorInfoImpl<SystemProperties, ISystemProperties>, 39 public VirtualBoxSupportTranslation<SystemProperties>, 40 40 VBOX_SCRIPTABLE_IMPL(ISystemProperties) 41 41 { -
trunk/src/VBox/Main/include/USBControllerImpl.h
r19239 r21622 44 44 class ATL_NO_VTABLE USBController : 45 45 public VirtualBoxBaseWithChildrenNEXT, 46 public VirtualBoxSupportErrorInfoImpl 47 public VirtualBoxSupportTranslation 46 public VirtualBoxSupportErrorInfoImpl<USBController, IUSBController>, 47 public VirtualBoxSupportTranslation<USBController>, 48 48 VBOX_SCRIPTABLE_IMPL(IUSBController) 49 49 { -
trunk/src/VBox/Main/include/USBDeviceImpl.h
r19239 r21622 33 33 */ 34 34 class ATL_NO_VTABLE OUSBDevice : 35 public VirtualBoxBase NEXT,35 public VirtualBoxBase, 36 36 public VirtualBoxSupportErrorInfoImpl<OUSBDevice, IUSBDevice>, 37 37 public VirtualBoxSupportTranslation<OUSBDevice>, -
trunk/src/VBox/Main/include/VFSExplorerImpl.h
r20963 r21622 30 30 31 31 class ATL_NO_VTABLE VFSExplorer : 32 public VirtualBoxBase NEXT,33 public VirtualBoxSupportErrorInfoImpl 34 public VirtualBoxSupportTranslation 32 public VirtualBoxBase, 33 public VirtualBoxSupportErrorInfoImpl<VFSExplorer, IVFSExplorer>, 34 public VirtualBoxSupportTranslation<VFSExplorer>, 35 35 VBOX_SCRIPTABLE_IMPL(IVFSExplorer) 36 36 { -
trunk/src/VBox/Main/include/VRDPServerImpl.h
r19239 r21622 32 32 33 33 class ATL_NO_VTABLE VRDPServer : 34 public VirtualBoxBase NEXT,35 public VirtualBoxSupportErrorInfoImpl 36 public VirtualBoxSupportTranslation 34 public VirtualBoxBase, 35 public VirtualBoxSupportErrorInfoImpl<VRDPServer, IVRDPServer>, 36 public VirtualBoxSupportTranslation<VRDPServer>, 37 37 VBOX_SCRIPTABLE_IMPL(IVRDPServer) 38 38 { -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r20964 r21622 466 466 //////////////////////////////////////////////////////////////////////////////// 467 467 468 /// @todo (dmik) remove after we switch to VirtualBoxBaseNEXT completely469 /**470 * Checks whether this object is ready or not. Objects are typically ready471 * after they are successfully created by their parent objects and become472 * not ready when the respective parent itself becomes not ready or gets473 * destroyed while a reference to the child is still held by the caller474 * (which prevents it from destruction).475 *476 * When this object is not ready, the macro sets error info and returns477 * E_ACCESSDENIED (the translatable error message is defined in null context).478 * Otherwise, the macro does nothing.479 *480 * This macro <b>must</b> be used at the beginning of all interface methods481 * (right after entering the class lock) in classes derived from both482 * VirtualBoxBase and VirtualBoxSupportErrorInfoImpl.483 */484 #define CHECK_READY() \485 do { \486 if (!isReady()) \487 return setError (E_ACCESSDENIED, tr ("The object is not ready")); \488 } while (0)489 490 468 /** 491 469 * Declares an empty constructor and destructor for the given class. … … 1240 1218 //////////////////////////////////////////////////////////////////////////////// 1241 1219 1242 /// @todo (dmik) remove after we switch to VirtualBoxBaseNEXT completely1243 1220 class ATL_NO_VTABLE VirtualBoxBase 1244 1221 : virtual public VirtualBoxBaseProto … … 1252 1229 public: 1253 1230 VirtualBoxBase() 1254 { 1255 mReady = false; 1256 } 1231 {} 1232 1257 1233 virtual ~VirtualBoxBase() 1258 { 1259 } 1234 {} 1260 1235 1261 1236 /** … … 1266 1241 * method's implementation must call setReady (false), 1267 1242 */ 1268 virtual void uninit() {} 1269 1270 1271 // sets the ready state of the object 1272 void setReady(bool isReady) 1273 { 1274 mReady = isReady; 1275 } 1276 // get the ready state of the object 1277 bool isReady() 1278 { 1279 return mReady; 1280 } 1243 virtual void uninit() 1244 {} 1281 1245 1282 1246 static const char *translate (const char *context, const char *sourceText, 1283 1247 const char *comment = 0); 1284 1285 private:1286 1287 // flag determining whether an object is ready1288 // for usage, i.e. methods may be called1289 bool mReady;1290 // mutex semaphore to lock the object1291 };1292 1293 /**1294 * Temporary class to disable deprecated methods of VirtualBoxBase.1295 * Can be used as a base for components that are completely switched to1296 * the new locking scheme (VirtualBoxBaseProto).1297 *1298 * @todo remove after we switch to VirtualBoxBaseNEXT completely.1299 */1300 class VirtualBoxBaseNEXT : public VirtualBoxBase1301 {1302 private:1303 1304 void lock();1305 void unlock();1306 void setReady (bool isReady);1307 bool isReady();1308 1248 }; 1309 1249 … … 1383 1323 1384 1324 template <class C> 1385 const char *VirtualBoxSupportTranslation 1325 const char *VirtualBoxSupportTranslation<C>::sClassName = NULL; 1386 1326 1387 1327 /** … … 1398 1338 const char *aComment = NULL) \ 1399 1339 { \ 1400 return VirtualBoxSupportTranslation 1340 return VirtualBoxSupportTranslation<C>::tr (aSourceText, aComment); \ 1401 1341 } 1402 1342 … … 2083 2023 * has gone. 2084 2024 */ 2085 class VirtualBoxBaseWithChildrenNEXT : public VirtualBoxBase NEXT2025 class VirtualBoxBaseWithChildrenNEXT : public VirtualBoxBase 2086 2026 { 2087 2027 public: … … 2191 2131 void uninitDependentChildren(); 2192 2132 2193 VirtualBoxBase NEXT *getDependentChild(const ComPtr <IUnknown> &aUnk);2133 VirtualBoxBase *getDependentChild(const ComPtr <IUnknown> &aUnk); 2194 2134 2195 2135 private: 2196 2197 /// @todo temporarily reinterpret VirtualBoxBase * as VirtualBoxBaseNEXT * 2198 // until ported HardDisk and Progress to the new scheme. 2199 void doAddDependentChild (IUnknown *aUnk, VirtualBoxBase *aChild) 2200 { 2201 doAddDependentChild (aUnk, 2202 reinterpret_cast <VirtualBoxBaseNEXT *> (aChild)); 2203 } 2204 2205 void doAddDependentChild (IUnknown *aUnk, VirtualBoxBaseNEXT *aChild); 2136 void doAddDependentChild(IUnknown *aUnk, VirtualBoxBase *aChild); 2206 2137 void doRemoveDependentChild (IUnknown *aUnk); 2207 2138 2208 typedef std::map <IUnknown *, VirtualBoxBaseNEXT*> DependentChildren;2139 typedef std::map<IUnknown*, VirtualBoxBase*> DependentChildren; 2209 2140 DependentChildren mDependentChildren; 2210 2141 }; 2211 2142 2212 2143 //////////////////////////////////////////////////////////////////////////////// 2213 2214 /**2215 * Base class to track component's children of some particular type.2216 *2217 * This class is similar to VirtualBoxBaseWithChildren, with the exception2218 * that all children must be of the same type. For this reason, it's not2219 * necessary to use a map to store children, so a list is used instead.2220 *2221 * As opposed to VirtualBoxBaseWithChildren, children added by2222 * #addDependentChild() are <b>strongly</b> referenced, so that they cannot2223 * be externally destructed until #removeDependentChild() is called.2224 *2225 * Also, this class doesn't have the2226 * VirtualBoxBaseWithChildrenNEXT::getDependentChild() method because it would2227 * be not fast for long lists.2228 *2229 * @param C type of child objects (must inherit VirtualBoxBase AND2230 * implement some interface)2231 *2232 * @deprecated Use VirtualBoxBaseWithTypedChildrenNEXT for new classes.2233 */2234 template <class C>2235 class VirtualBoxBaseWithTypedChildren : public VirtualBoxBase2236 {2237 public:2238 2239 typedef std::list <ComObjPtr <C> > DependentChildren;2240 2241 VirtualBoxBaseWithTypedChildren() : mInUninit (false) {}2242 2243 virtual ~VirtualBoxBaseWithTypedChildren() {}2244 2245 /**2246 * Adds the given child to the list of dependent children.2247 * Must be called from the child's init() method,2248 * from under the child's lock.2249 *2250 * @param C the child object to add (must inherit VirtualBoxBase AND2251 * implement some interface)2252 */2253 void addDependentChild (C *child)2254 {2255 AssertReturn (child, (void) 0);2256 2257 AutoWriteLock alock (mMapLock);2258 if (mInUninit)2259 return;2260 2261 mDependentChildren.push_back (child);2262 }2263 2264 /**2265 * Removes the given child from the list of dependent children.2266 * Must be called from the child's uninit() method,2267 * under the child's lock.2268 *2269 * @param C the child object to remove (must inherit VirtualBoxBase AND2270 * implement some interface)2271 */2272 void removeDependentChild (C *child)2273 {2274 AssertReturn (child, (void) 0);2275 2276 AutoWriteLock alock (mMapLock);2277 if (mInUninit)2278 return;2279 2280 mDependentChildren.remove (child);2281 }2282 2283 protected:2284 2285 /**2286 * Returns an internal lock handle to lock the list of children2287 * returned by #dependentChildren() using AutoReadLock/AutoWriteLock:2288 * <code>2289 * AutoReadLock alock (dependentChildrenLock());2290 * </code>2291 *2292 * This is necessary for example to access the list of children returned by2293 * #dependentChildren().2294 */2295 RWLockHandle *dependentChildrenLock() const { return &mMapLock; }2296 2297 /**2298 * Returns the read-only list of all dependent children.2299 * @note2300 * Access the returned list (iterate, get size etc.) only after2301 * doing |AutoWriteLock alock (dependentChildrenLock());|!2302 */2303 const DependentChildren &dependentChildren() const { return mDependentChildren; }2304 2305 /**2306 * Uninitializes all dependent children registered with #addDependentChild().2307 *2308 * @note2309 * This method will call uninit() methods of children. If these methods2310 * access the parent object, uninitDependentChildren() must be called2311 * either at the beginning of the parent uninitialization sequence (when2312 * it is still operational) or after setReady(false) is called to2313 * indicate the parent is out of action.2314 */2315 void uninitDependentChildren()2316 {2317 AutoWriteLock alock (this);2318 AutoWriteLock mapLock (mMapLock);2319 2320 if (mDependentChildren.size())2321 {2322 // set flag to ignore #removeDependentChild() called from child->uninit()2323 mInUninit = true;2324 2325 // leave the locks to let children waiting for #removeDependentChild() run2326 mapLock.leave();2327 alock.leave();2328 2329 for (typename DependentChildren::iterator it = mDependentChildren.begin();2330 it != mDependentChildren.end(); ++ it)2331 {2332 C *child = (*it);2333 Assert (child);2334 if (child)2335 child->uninit();2336 }2337 mDependentChildren.clear();2338 2339 alock.enter();2340 mapLock.enter();2341 2342 mInUninit = false;2343 }2344 }2345 2346 /**2347 * Removes (detaches) all dependent children registered with2348 * #addDependentChild(), without uninitializing them.2349 *2350 * @note This method must be called from under the main object's lock2351 */2352 void removeDependentChildren()2353 {2354 AutoWriteLock alock (mMapLock);2355 mDependentChildren.clear();2356 }2357 2358 private:2359 2360 DependentChildren mDependentChildren;2361 2362 bool mInUninit;2363 mutable RWLockHandle mMapLock;2364 };2365 2144 2366 2145 //////////////////////////////////////////////////////////////////////////////// … … 2392 2171 */ 2393 2172 template <class C> 2394 class VirtualBoxBaseWithTypedChildren NEXT : public VirtualBoxBaseNEXT2173 class VirtualBoxBaseWithTypedChildren : public VirtualBoxBase 2395 2174 { 2396 2175 public: … … 2398 2177 typedef std::list <ComObjPtr <C> > DependentChildren; 2399 2178 2400 VirtualBoxBaseWithTypedChildrenNEXT() {} 2401 2402 virtual ~VirtualBoxBaseWithTypedChildrenNEXT() {} 2179 VirtualBoxBaseWithTypedChildren() 2180 {} 2181 2182 virtual ~VirtualBoxBaseWithTypedChildren() 2183 {} 2403 2184 2404 2185 /** -
trunk/src/VBox/Main/include/VirtualBoxImpl.h
r21520 r21622 64 64 class ATL_NO_VTABLE VirtualBox : 65 65 public VirtualBoxBaseWithChildrenNEXT, 66 public VirtualBoxSupportErrorInfoImpl 67 public VirtualBoxSupportTranslation 66 public VirtualBoxSupportErrorInfoImpl<VirtualBox, IVirtualBox>, 67 public VirtualBoxSupportTranslation<VirtualBox>, 68 68 VBOX_SCRIPTABLE_IMPL(IVirtualBox) 69 69 #ifdef RT_OS_WINDOWS … … 359 359 RWLockHandle *hardDiskTreeLockHandle() { return &mHardDiskTreeLockHandle; } 360 360 361 RWLockHandle *snapshotTreeLockHandle() { return &mSnapshotTreeLockHandle; } 362 361 363 /* for VirtualBoxSupportErrorInfoImpl */ 362 364 static const wchar_t *getComponentName() { return L"VirtualBox"; } … … 507 509 RWLockHandle mHardDiskTreeLockHandle; 508 510 RWLockHandle mChildrenMapLockHandle; 511 RWLockHandle mSnapshotTreeLockHandle; 509 512 510 513 static Bstr sVersion;
Note:
See TracChangeset
for help on using the changeset viewer.