Changeset 26171 in vbox for trunk/src/VBox
- Timestamp:
- Feb 2, 2010 8:37:36 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 57185
- Location:
- trunk/src/VBox/Main
- Files:
-
- 1 deleted
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/AudioAdapterImpl.cpp
r26167 r26171 429 429 * @note Locks this object for writing. 430 430 */ 431 boolAudioAdapter::rollback()431 void AudioAdapter::rollback() 432 432 { 433 433 /* sanity */ 434 434 AutoCaller autoCaller(this); 435 AssertComRCReturn (autoCaller.rc(), false);435 AssertComRCReturnVoid(autoCaller.rc()); 436 436 437 437 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 438 438 439 bool changed = false; 440 441 if (mData.isBackedUp()) 442 { 443 /* we need to check all data to see whether anything will be changed 444 * after rollback */ 445 changed = mData.hasActualChanges(); 446 mData.rollback(); 447 } 448 449 return changed; 439 mData.rollback(); 450 440 } 451 441 -
trunk/src/VBox/Main/MachineImpl.cpp
r26167 r26171 198 198 } 199 199 200 bool Machine::HWData::operator==(const HWData &that) const201 {202 if (this == &that)203 return true;204 205 if (mHWVersion != that.mHWVersion ||206 mHardwareUUID != that.mHardwareUUID ||207 mMemorySize != that.mMemorySize ||208 mMemoryBalloonSize != that.mMemoryBalloonSize ||209 mStatisticsUpdateInterval != that.mStatisticsUpdateInterval ||210 mVRAMSize != that.mVRAMSize ||211 mFirmwareType != that.mFirmwareType ||212 mAccelerate3DEnabled != that.mAccelerate3DEnabled ||213 mAccelerate2DVideoEnabled != that.mAccelerate2DVideoEnabled ||214 mMonitorCount != that.mMonitorCount ||215 mHWVirtExEnabled != that.mHWVirtExEnabled ||216 mHWVirtExNestedPagingEnabled != that.mHWVirtExNestedPagingEnabled ||217 mHWVirtExVPIDEnabled != that.mHWVirtExVPIDEnabled ||218 mHWVirtExExclusive != that.mHWVirtExExclusive ||219 mPAEEnabled != that.mPAEEnabled ||220 mSyntheticCpu != that.mSyntheticCpu ||221 mCPUCount != that.mCPUCount ||222 mCPUHotPlugEnabled != that.mCPUHotPlugEnabled ||223 mClipboardMode != that.mClipboardMode)224 return false;225 226 for (size_t i = 0; i < RT_ELEMENTS (mBootOrder); ++i)227 if (mBootOrder [i] != that.mBootOrder [i])228 return false;229 230 231 for (size_t i = 0; i < RT_ELEMENTS(mCPUAttached); i++)232 {233 if (mCPUAttached[i] != that.mCPUAttached[i])234 return false;235 }236 237 if (mSharedFolders.size() != that.mSharedFolders.size())238 return false;239 240 if (mSharedFolders.size() == 0)241 return true;242 243 /* Make copies to speed up comparison */244 SharedFolderList folders = mSharedFolders;245 SharedFolderList thatFolders = that.mSharedFolders;246 247 SharedFolderList::iterator it = folders.begin();248 while (it != folders.end())249 {250 bool found = false;251 SharedFolderList::iterator thatIt = thatFolders.begin();252 while (thatIt != thatFolders.end())253 {254 if ( (*it)->getName() == (*thatIt)->getName()255 && RTPathCompare(Utf8Str((*it)->getHostPath()).c_str(),256 Utf8Str((*thatIt)->getHostPath()).c_str()257 ) == 0)258 {259 thatFolders.erase (thatIt);260 found = true;261 break;262 }263 else264 ++thatIt;265 }266 if (found)267 it = folders.erase (it);268 else269 return false;270 }271 272 Assert (folders.size() == 0 && thatFolders.size() == 0);273 274 return true;275 }276 277 200 ///////////////////////////////////////////////////////////////////////////// 278 201 // Machine::HDData structure … … 285 208 Machine::MediaData::~MediaData() 286 209 { 287 }288 289 bool Machine::MediaData::operator==(const MediaData &that) const290 {291 if (this == &that)292 return true;293 294 if (mAttachments.size() != that.mAttachments.size())295 return false;296 297 if (mAttachments.size() == 0)298 return true;299 300 /* Make copies to speed up comparison */301 AttachmentList atts = mAttachments;302 AttachmentList thatAtts = that.mAttachments;303 304 AttachmentList::iterator it = atts.begin();305 while (it != atts.end())306 {307 bool found = false;308 AttachmentList::iterator thatIt = thatAtts.begin();309 while (thatIt != thatAtts.end())310 {311 if ( (*it)->matches((*thatIt)->getControllerName(),312 (*thatIt)->getPort(),313 (*thatIt)->getDevice())314 && (*it)->getPassthrough() == (*thatIt)->getPassthrough()315 && (*it)->getMedium().equalsTo((*thatIt)->getMedium())316 )317 {318 thatAtts.erase(thatIt);319 found = true;320 break;321 }322 else323 ++thatIt;324 }325 if (found)326 it = atts.erase (it);327 else328 return false;329 }330 331 Assert (atts.size() == 0 && thatAtts.size() == 0);332 333 return true;334 210 } 335 211 … … 8333 8209 if (m_flModifications & IsModified_NetworkAdapters) 8334 8210 for (ULONG slot = 0; slot < RT_ELEMENTS(mNetworkAdapters); slot++) 8335 if (mNetworkAdapters[slot]) 8336 if (mNetworkAdapters[slot]->rollback()) 8337 networkAdapters[slot] = mNetworkAdapters[slot]; 8211 if ( mNetworkAdapters[slot] 8212 && mNetworkAdapters[slot]->isModified()) 8213 { 8214 mNetworkAdapters[slot]->rollback(); 8215 networkAdapters[slot] = mNetworkAdapters[slot]; 8216 } 8338 8217 8339 8218 if (m_flModifications & IsModified_SerialPorts) 8340 8219 for (ULONG slot = 0; slot < RT_ELEMENTS(mSerialPorts); slot++) 8341 if (mSerialPorts[slot]) 8342 if (mSerialPorts[slot]->rollback()) 8343 serialPorts[slot] = mSerialPorts[slot]; 8220 if ( mSerialPorts[slot] 8221 && mSerialPorts[slot]->isModified()) 8222 { 8223 mSerialPorts[slot]->rollback(); 8224 serialPorts[slot] = mSerialPorts[slot]; 8225 } 8344 8226 8345 8227 if (m_flModifications & IsModified_ParallelPorts) 8346 8228 for (ULONG slot = 0; slot < RT_ELEMENTS(mParallelPorts); slot++) 8347 if (mParallelPorts[slot]) 8348 if (mParallelPorts[slot]->rollback()) 8349 parallelPorts[slot] = mParallelPorts[slot]; 8229 if ( mParallelPorts[slot] 8230 && mParallelPorts[slot]->isModified()) 8231 { 8232 mParallelPorts[slot]->rollback(); 8233 parallelPorts[slot] = mParallelPorts[slot]; 8234 } 8350 8235 8351 8236 if (aNotify) -
trunk/src/VBox/Main/MediumAttachmentImpl.cpp
r26167 r26171 44 44 { } 45 45 46 bool operator==(const BackupableMediumAttachmentData &that) const47 {48 return this == &that49 || (fPassthrough == that.fPassthrough);50 }51 52 46 ComObjPtr<Medium> pMedium; 53 47 /* Since MediumAttachment is not a first class citizen when it … … 282 276 * @note Locks this object for writing. 283 277 */ 284 boolMediumAttachment::rollback()278 void MediumAttachment::rollback() 285 279 { 286 280 LogFlowThisFunc(("ENTER - %s\n", getLogName())); … … 288 282 /* sanity */ 289 283 AutoCaller autoCaller(this); 290 AssertComRCReturn (autoCaller.rc(), false);284 AssertComRCReturnVoid(autoCaller.rc()); 291 285 292 286 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 293 287 294 bool changed = false; 295 296 if (m->bd.isBackedUp()) 297 { 298 /* we need to check all data to see whether anything will be changed 299 * after rollback */ 300 changed = m->bd.hasActualChanges(); 301 m->bd.rollback(); 302 } 303 304 LogFlowThisFunc(("LEAVE - %s - returning %RTbool\n", getLogName(), changed)); 305 return changed; 288 m->bd.rollback(); 289 290 LogFlowThisFunc(("LEAVE - %s\n", getLogName())); 306 291 } 307 292 -
trunk/src/VBox/Main/NetworkAdapterImpl.cpp
r26167 r26171 1126 1126 1127 1127 /** 1128 * Returns true if any setter method has modified settings of this instance. 1129 * @return 1130 */ 1131 bool NetworkAdapter::isModified() 1132 { 1133 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 1134 return m_fModified; 1135 } 1136 1137 /** 1128 1138 * @note Locks this object for writing. 1129 1139 */ 1130 boolNetworkAdapter::rollback()1140 void NetworkAdapter::rollback() 1131 1141 { 1132 1142 /* sanity */ 1133 1143 AutoCaller autoCaller(this); 1134 AssertComRCReturn (autoCaller.rc(), false); 1135 1136 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1137 1138 bool changed = false; 1139 1140 if (mData.isBackedUp()) 1141 { 1142 /* we need to check all data to see whether anything will be changed 1143 * after rollback */ 1144 changed = mData.hasActualChanges(); 1145 mData.rollback(); 1146 } 1147 1148 return changed; 1144 AssertComRCReturnVoid(autoCaller.rc()); 1145 1146 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1147 1148 mData.rollback(); 1149 1149 } 1150 1150 -
trunk/src/VBox/Main/ParallelPortImpl.cpp
r26167 r26171 462 462 463 463 /** 464 * Returns true if any setter method has modified settings of this instance. 465 * @return 466 */ 467 bool ParallelPort::isModified() 468 { 469 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 470 return m->fModified; 471 } 472 473 /** 464 474 * @note Locks this object for writing. 465 475 */ 466 boolParallelPort::rollback()476 void ParallelPort::rollback() 467 477 { 468 478 /* sanity */ 469 479 AutoCaller autoCaller(this); 470 AssertComRCReturn (autoCaller.rc(), false);480 AssertComRCReturnVoid(autoCaller.rc()); 471 481 472 482 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 473 483 474 bool changed = false; 475 476 if (m->bd.isBackedUp()) 477 { 478 /* we need to check all data to see whether anything will be changed 479 * after rollback */ 480 changed = m->bd.hasActualChanges(); 481 m->bd.rollback(); 482 } 483 484 return changed; 484 m->bd.rollback(); 485 485 } 486 486 -
trunk/src/VBox/Main/SerialPortImpl.cpp
r26167 r26171 579 579 580 580 /** 581 * Returns true if any setter method has modified settings of this instance. 582 * @return 583 */ 584 bool SerialPort::isModified() 585 { 586 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS); 587 return m->fModified; 588 } 589 590 /** 581 591 * @note Locks this object for writing. 582 592 */ 583 boolSerialPort::rollback()593 void SerialPort::rollback() 584 594 { 585 595 /* sanity */ 586 596 AutoCaller autoCaller(this); 587 AssertComRCReturn (autoCaller.rc(), false); 588 589 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 590 591 bool changed = false; 592 593 if (m->bd.isBackedUp()) 594 { 595 /* we need to check all data to see whether anything will be changed 596 * after rollback */ 597 changed = m->bd.hasActualChanges(); 598 m->bd.rollback(); 599 } 600 601 return changed; 597 AssertComRCReturnVoid(autoCaller.rc()); 598 599 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 600 601 m->bd.rollback(); 602 602 } 603 603 -
trunk/src/VBox/Main/StorageControllerImpl.cpp
r26167 r26171 54 54 mPortIde1Slave(3) 55 55 { } 56 57 bool operator==(const BackupableStorageControllerData &that) const58 {59 return this == &that60 || ( (mStorageControllerType == that.mStorageControllerType)61 && (strName == that.strName)62 && (mPortCount == that.mPortCount)63 && (mPortIde0Master == that.mPortIde0Master)64 && (mPortIde0Slave == that.mPortIde0Slave)65 && (mPortIde1Master == that.mPortIde1Master)66 && (mPortIde1Slave == that.mPortIde1Slave));67 }68 56 69 57 /** Unique name of the storage controller. */ … … 718 706 719 707 /** @note Locks objects for writing! */ 720 boolStorageController::rollback()721 { 722 AutoCaller autoCaller(this); 723 AssertComRCReturn (autoCaller.rc(), false);708 void StorageController::rollback() 709 { 710 AutoCaller autoCaller(this); 711 AssertComRCReturnVoid(autoCaller.rc()); 724 712 725 713 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 726 714 727 bool dataChanged = false; 728 729 if (m->bd.isBackedUp()) 730 { 731 /* we need to check all data to see whether anything will be changed 732 * after rollback */ 733 dataChanged = m->bd.hasActualChanges(); 734 m->bd.rollback(); 735 } 736 737 return dataChanged; 715 m->bd.rollback(); 738 716 } 739 717 -
trunk/src/VBox/Main/USBControllerImpl.cpp
r26167 r26171 55 55 fEnabledEHCI(false) 56 56 { } 57 58 bool operator==(const BackupableUSBData &that) const59 {60 return this == &that || (fEnabled == that.fEnabled && fEnabledEHCI == that.fEnabledEHCI);61 }62 57 63 58 BOOL fEnabled; … … 727 722 728 723 /** @note Locks objects for writing! */ 729 boolUSBController::rollback()730 { 731 AutoCaller autoCaller(this); 732 AssertComRCReturn (autoCaller.rc(), false);724 void USBController::rollback() 725 { 726 AutoCaller autoCaller(this); 727 AssertComRCReturnVoid(autoCaller.rc()); 733 728 734 729 /* we need the machine state */ 735 730 AutoAnyStateDependency adep(m->pParent); 736 AssertComRCReturn (adep.rc(), false);731 AssertComRCReturnVoid(adep.rc()); 737 732 738 733 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 739 734 740 bool dataChanged = false; 741 742 if (m->bd.isBackedUp()) 743 { 744 /* we need to check all data to see whether anything will be changed 745 * after rollback */ 746 dataChanged = m->bd.hasActualChanges(); 747 m->bd.rollback(); 748 } 735 m->bd.rollback(); 749 736 750 737 #ifdef VBOX_WITH_USB … … 753 740 { 754 741 USBProxyService *service = m->pParent->getVirtualBox()->host()->usbProxyService(); 755 ComAssertRet (service, false);742 Assert(service); 756 743 757 744 /* uninitialize all new filters (absent in the backed up list) */ … … 768 755 { 769 756 USBDeviceFilter *filter = *it; 770 ComAssertRet(filter->getId() != NULL, false);757 Assert(filter->getId() != NULL); 771 758 service->removeFilter(filter->getId()); 772 759 filter->getId() = NULL; … … 792 779 { 793 780 USBDeviceFilter *flt = *it; /* resolve ambiguity */ 794 ComAssertRet(flt->getId() == NULL, false);781 Assert(flt->getId() == NULL); 795 782 flt->getId() = service->insertFilter(&flt->getData().mUSBFilter); 796 783 } … … 815 802 (*it)->rollback(); 816 803 /* call this to notify the USB proxy about changes */ 817 onDeviceFilterChange 804 onDeviceFilterChange(*it); 818 805 } 819 ++ 806 ++it; 820 807 } 821 808 822 809 #endif /* VBOX_WITH_USB */ 823 824 return dataChanged;825 810 } 826 811 -
trunk/src/VBox/Main/include/AudioAdapterImpl.h
r26167 r26171 44 44 Data(); 45 45 46 bool operator== (const Data &that) const47 {48 return this == &that ||49 (mEnabled == that.mEnabled &&50 mAudioDriver == that.mAudioDriver &&51 mAudioController == that.mAudioController);52 }53 54 46 BOOL mEnabled; 55 47 AudioDriverType_T mAudioDriver; … … 92 84 HRESULT saveSettings(settings::AudioAdapter &data); 93 85 94 boolrollback();86 void rollback(); 95 87 void commit(); 96 88 void copyFrom(AudioAdapter *aThat); -
trunk/src/VBox/Main/include/MachineImpl.h
r26167 r26171 225 225 ~UserData(); 226 226 227 bool operator==(const UserData &that) const228 {229 return this == &that230 || ( mName == that.mName231 && mNameSync == that.mNameSync232 && mDescription == that.mDescription233 && mOSTypeId == that.mOSTypeId234 && mSnapshotFolderFull == that.mSnapshotFolderFull235 && mTeleporterEnabled == that.mTeleporterEnabled236 && mTeleporterPort == that.mTeleporterPort237 && mTeleporterAddress == that.mTeleporterAddress238 && mTeleporterPassword == that.mTeleporterPassword239 && mRTCUseUTC == that.mRTCUseUTC);240 }241 242 227 Bstr mName; 243 228 BOOL mNameSync; … … 279 264 HWData(); 280 265 ~HWData(); 281 282 bool operator==(const HWData &that) const;283 266 284 267 Bstr mHWVersion; … … 333 316 MediaData(); 334 317 ~MediaData(); 335 336 bool operator==(const MediaData &that) const;337 318 338 319 typedef std::list< ComObjPtr<MediumAttachment> > AttachmentList; -
trunk/src/VBox/Main/include/MediumAttachmentImpl.h
r26044 r26171 68 68 69 69 // public internal methods 70 boolrollback();70 void rollback(); 71 71 void commit(); 72 72 -
trunk/src/VBox/Main/include/NetworkAdapterImpl.h
r26167 r26171 50 50 mNATNetwork("") /* cannot be null */ 51 51 {} 52 53 bool operator== (const Data &that) const54 {55 return this == &that ||56 (mSlot == that.mSlot &&57 mEnabled == that.mEnabled &&58 mMACAddress == that.mMACAddress &&59 mAttachmentType == that.mAttachmentType &&60 mCableConnected == that.mCableConnected &&61 mLineSpeed == that.mLineSpeed &&62 mTraceEnabled == that.mTraceEnabled &&63 mHostInterface == that.mHostInterface &&64 mInternalNetwork == that.mInternalNetwork &&65 mNATNetwork == that.mNATNetwork);66 }67 52 68 53 NetworkAdapterType_T mAdapterType; … … 139 124 HRESULT saveSettings(settings::NetworkAdapter &data); 140 125 141 bool rollback(); 126 bool isModified(); 127 void rollback(); 142 128 void commit(); 143 129 void copyFrom (NetworkAdapter *aThat); -
trunk/src/VBox/Main/include/ParallelPortImpl.h
r26167 r26171 78 78 HRESULT saveSettings(settings::ParallelPort &data); 79 79 80 bool rollback(); 80 bool isModified(); 81 void rollback(); 81 82 void commit(); 82 83 void copyFrom(ParallelPort *aThat); -
trunk/src/VBox/Main/include/SerialPortImpl.h
r26167 r26171 84 84 HRESULT saveSettings(settings::SerialPort &data); 85 85 86 bool rollback(); 86 bool isModified(); 87 void rollback(); 87 88 void commit(); 88 89 void copyFrom(SerialPort *aThat); -
trunk/src/VBox/Main/include/StorageControllerImpl.h
r26167 r26171 89 89 ULONG getInstance() const; 90 90 91 boolrollback();91 void rollback(); 92 92 void commit(); 93 93 -
trunk/src/VBox/Main/include/USBControllerImpl.h
r26167 r26171 83 83 HRESULT saveSettings(settings::USBController &data); 84 84 85 boolrollback();85 void rollback(); 86 86 void commit(); 87 87 void copyFrom (USBController *aThat); -
trunk/src/VBox/Main/include/VRDPServerImpl.h
r26167 r26171 44 44 struct Data 45 45 { 46 bool operator== (const Data &that) const47 {48 return this == &that ||49 (mEnabled == that.mEnabled &&50 mVRDPPorts == that.mVRDPPorts &&51 mVRDPAddress == that.mVRDPAddress &&52 mAuthType == that.mAuthType &&53 mAuthTimeout == that.mAuthTimeout &&54 mAllowMultiConnection == that.mAllowMultiConnection &&55 mReuseSingleConnection == that.mReuseSingleConnection);56 }57 58 46 BOOL mEnabled; 59 47 Bstr mVRDPPorts; … … 111 99 HRESULT saveSettings(settings::VRDPSettings &data); 112 100 113 boolrollback();101 void rollback(); 114 102 void commit(); 115 103 void copyFrom (VRDPServer *aThat); -
trunk/src/VBox/Main/include/VirtualBoxBase.h
r26044 r26171 1680 1680 } 1681 1681 1682 bool hasActualChanges() const1683 {1684 AssertMsg(this->mData, ("data must not be NULL"));1685 return this->mData != NULL && mBackupData != NULL &&1686 !(*this->mData == *mBackupData);1687 }1688 1689 1682 D *backedUpData() const 1690 1683 {
Note:
See TracChangeset
for help on using the changeset viewer.