Changeset 15157 in vbox
- Timestamp:
- Dec 9, 2008 11:39:21 AM (16 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/MachineImpl.cpp
r15140 r15157 588 588 /* commit all changes made during loading the settings file */ 589 589 commit(); 590 591 /* VirtualBox will not call trySetRegistered(), so592 * inform the USB proxy about all attached USB filters */593 mUSBController->onMachineRegistered (TRUE);594 590 } 595 591 else … … 4151 4147 mData->mRegistered = aRegistered; 4152 4148 4153 /* inform the USB proxy about all attached/detached USB filters */4154 mUSBController->onMachineRegistered (aRegistered);4155 4156 4149 return S_OK; 4157 4150 } … … 7267 7260 7268 7261 /** 7269 * 7270 * 7271 * @param aNotify whether to notify the direct session about changes or not7272 * 7273 * @note Locks objects!7262 * Discards all changes to machine settings. 7263 * 7264 * @param aNotify Whether to notify the direct session about changes or not. 7265 * 7266 * @note Locks objects for writing! 7274 7267 */ 7275 7268 void Machine::rollback (bool aNotify) … … 7453 7446 7454 7447 /** 7455 * Copies all the hardware data from the given machine. 7456 * 7457 * @note 7458 * This method must be called from under this object's lock. 7459 * @note 7460 * This method doesn't call #commit(), so all data remains backed up 7461 * and unsaved. 7448 * Copies all the hardware data from the given machine. 7449 * 7450 * Currently, only called when the VM is being restored from a snapshot. In 7451 * particular, this implies that the VM is not running during this method's 7452 * call. 7453 * 7454 * @note This method must be called from under this object's lock. 7455 * 7456 * @note This method doesn't call #commit(), so all data remains backed up and 7457 * unsaved. 7462 7458 */ 7463 7459 void Machine::copyFrom (Machine *aThat) 7464 7460 { 7465 AssertReturn (mType == IsMachine || mType == IsSessionMachine, (void) 0); 7466 AssertReturn (aThat->mType == IsSnapshotMachine, (void) 0); 7461 AssertReturnVoid (mType == IsMachine || mType == IsSessionMachine); 7462 AssertReturnVoid (aThat->mType == IsSnapshotMachine); 7463 7464 AssertReturnVoid (mData->mMachineState < MachineState_Running || 7465 mData->mMachineState >= MachineState_Discarding); 7467 7466 7468 7467 mHWData.assignCopy (aThat->mHWData); … … 10168 10167 { 10169 10168 /// @todo for now, we ignore errors since we've already 10170 /// and therefore cannot fail. Later, we may want to report a10171 /// warning through the Progress object10169 /// discarded and therefore cannot fail. Later, we may want to 10170 /// report a warning through the Progress object 10172 10171 HRESULT rc2 = (*it)->deleteStorageAndWait(); 10173 10172 if (SUCCEEDED (rc2)) -
trunk/src/VBox/Main/USBControllerImpl.cpp
r15051 r15157 90 90 return S_OK; 91 91 } 92 93 92 94 93 /** … … 418 417 { 419 418 #ifdef VBOX_WITH_USB 419 420 420 CheckComArgNotNull(aFilter); 421 421 … … 455 455 filter->mInList = true; 456 456 457 /// @todo After rewriting Win32 USB support, no more necessary;458 // a candidate for removal.459 #if 0460 /* notify the proxy (only when the filter is active) */461 if (filter->data().mActive)462 #else463 457 /* notify the proxy (only when it makes sense) */ 464 458 if (filter->data().mActive && adep.machineState() >= MachineState_Running) 465 #endif466 459 { 467 460 USBProxyService *service = mParent->virtualBox()->host()->usbProxyService(); … … 473 466 474 467 return S_OK; 475 #else 468 469 #else /* VBOX_WITH_USB */ 470 476 471 ReturnComNotImplemented(); 477 #endif 472 473 #endif /* VBOX_WITH_USB */ 478 474 } 479 475 … … 482 478 { 483 479 #ifdef VBOX_WITH_USB 480 484 481 CheckComArgOutPointerValid(aFilter); 485 482 … … 522 519 filter.queryInterfaceTo (aFilter); 523 520 524 /// @todo After rewriting Win32 USB support, no more necessary;525 // a candidate for removal.526 #if 0527 /* notify the proxy (only when the filter is active) */528 if (filter->data().mActive)529 #else530 521 /* notify the proxy (only when it makes sense) */ 531 522 if (filter->data().mActive && adep.machineState() >= MachineState_Running) 532 #endif533 523 { 534 524 USBProxyService *service = mParent->virtualBox()->host()->usbProxyService(); … … 541 531 542 532 return S_OK; 543 #else 533 534 #else /* VBOX_WITH_USB */ 535 544 536 ReturnComNotImplemented(); 545 #endif 537 538 #endif /* VBOX_WITH_USB */ 546 539 } 547 540 … … 837 830 838 831 #ifdef VBOX_WITH_USB 832 839 833 if (mDeviceFilters.isBackedUp()) 840 834 { … … 850 844 backedList->end()) 851 845 { 852 /// @todo After rewriting Win32 USB support, no more necessary;853 // a candidate for removal.854 #if 0855 /* notify the proxy (only when the filter is active) */856 if ((*it)->data().mActive)857 #else858 846 /* notify the proxy (only when it makes sense) */ 859 847 if ((*it)->data().mActive && 860 adep.machineState() >= MachineState_Running )861 #endif 848 adep.machineState() >= MachineState_Running && 849 adep.machineState() < MachineState_Discarding) 862 850 { 863 851 USBDeviceFilter *filter = *it; … … 872 860 } 873 861 874 /// @todo After rewriting Win32 USB support, no more necessary; 875 // a candidate for removal. 876 #if 0 877 #else 878 if (adep.machineState() >= MachineState_Running) 879 #endif 862 if (adep.machineState() >= MachineState_Running && 863 adep.machineState() < MachineState_Discarding) 880 864 { 881 865 /* find all removed old filters (absent in the new list) … … 918 902 ++ it; 919 903 } 904 920 905 #endif /* VBOX_WITH_USB */ 921 906 … … 963 948 { 964 949 AutoWriteLock peerlock (mPeer); 950 965 951 /* commit all changes to new filters (this will reshare data with 966 952 * peers for those who have peers) */ … … 1044 1030 AssertComRCReturnVoid (thatCaller.rc()); 1045 1031 1032 /* even more sanity */ 1033 Machine::AutoAnyStateDependency adep (mParent); 1034 AssertComRCReturnVoid (adep.rc()); 1035 /* Machine::copyFrom() may not be called when the VM is running */ 1036 AssertReturnVoid (adep.machineState() < MachineState_Running || 1037 adep.machineState() >= MachineState_Discarding); 1038 1046 1039 /* peer is not modified, lock it for reading (aThat is "master" so locked 1047 1040 * first) */ 1048 1041 AutoMultiLock2 alock (aThat->rlock(), this->wlock()); 1049 1042 1050 if (mParent->isRegistered())1051 {1052 /* reuse onMachineRegistered to tell USB proxy to remove all current1053 filters */1054 HRESULT rc = onMachineRegistered (FALSE);1055 AssertComRCReturn (rc, (void) 0);1056 }1057 1058 1043 /* this will back up current data */ 1059 1044 mData.assignCopy (aThat->mData); 1060 1045 1061 1046 #ifdef VBOX_WITH_USB 1047 1048 /* Note that we won't inform the USB proxy about new filters since the VM is 1049 * not running when we are here and therefore no need to do so */ 1050 1062 1051 /* create private copies of all filters */ 1063 1052 mDeviceFilters.backup(); … … 1072 1061 mDeviceFilters->push_back (filter); 1073 1062 } 1063 1074 1064 #endif /* VBOX_WITH_USB */ 1075 1076 if (mParent->isRegistered())1077 {1078 /* reuse onMachineRegistered to tell USB proxy to insert all current1079 filters */1080 HRESULT rc = onMachineRegistered (TRUE);1081 AssertComRCReturn (rc, (void) 0);1082 }1083 }1084 1085 /**1086 * Called by VirtualBox when it changes the registered state1087 * of the machine this USB controller belongs to.1088 *1089 * @param aRegistered new registered state of the machine1090 *1091 * @note Locks nothing.1092 */1093 HRESULT USBController::onMachineRegistered (BOOL aRegistered)1094 {1095 AutoCaller autoCaller (this);1096 AssertComRCReturnRC (autoCaller.rc());1097 1098 /// @todo After rewriting Win32 USB support, no more necessary;1099 // a candidate for removal.1100 #if 01101 notifyProxy (!!aRegistered);1102 #endif1103 1104 return S_OK;1105 1065 } 1106 1066 … … 1118 1078 AssertComRCReturnRC (autoCaller.rc()); 1119 1079 1120 /// @todo After rewriting Win32 USB support, no more necessary;1121 // a candidate for removal.1122 #if 01123 #else1124 1080 /* we need the machine state */ 1125 1081 Machine::AutoAnyStateDependency adep (mParent); … … 1129 1085 if (adep.machineState() < MachineState_Running) 1130 1086 return S_OK; 1131 #endif1132 1087 1133 1088 /* we don't modify our data fields -- no need to lock */ -
trunk/src/VBox/Main/include/USBControllerImpl.h
r15051 r15157 117 117 void copyFrom (USBController *aThat); 118 118 119 HRESULT onMachineRegistered (BOOL aRegistered);120 121 119 #ifdef VBOX_WITH_USB 122 120 HRESULT onDeviceFilterChange (USBDeviceFilter *aFilter,
Note:
See TracChangeset
for help on using the changeset viewer.